Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

products in drop down menu working, if anyone's interested


Trinity

Recommended Posts

I noticed when looking for a mod for this, that a few people were having a hard time with it... this works, but its a little convoluted.

 

first, I went into includes/modules/product_listing_col.php and added a select box...

 

$info_box_contents = array();

 $row = 0;

 $col = 0;

 $listing = tep_db_query($listing_sql);

   // select text string...  notice the name of the select box (product_id,

   // not products_id)

 $sel_text = '<form action="' . tep_href_link(FILENAME_PRODUCT_INFO, $listing_values['products_id']) . '"><select name="product_id">';

while ($listing_values = tep_db_fetch_array($listing)) {

   $listing_values['products_name'] = tep_get_products_name($listing_values['products_id']);

   $lc_text= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a><br>';

       if ($listing_values['specials_new_products_price']) {

             $lc_text .= ' <s>' .  $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span> ';

             // fill options while looping... (special prices)

             $sel_text .= '<option value="' . $listing_values['products_id'] . '">' . $listing_values['products_name'] .' ]--[ ' .  $currencies->display_price($listing_values['specials_new_products_price']) . '</option>';

     } else {

             $lc_text .= ' ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . ' ';



// fill object (this is non-sale, every day regular prices)	

$sel_text .= '<option value="' . $listing_values['products_id'] . '">' . $listing_values['products_name'] . ' ]--[ ' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</option>';

           }

   if (PRODUCT_LIST_BUY_NOW) {

     $lc_text .= '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a> ';      

   }

   $info_box_contents[$row][$col] = array('align' => 'center',

                                          'params' => 'class="smallText" width="33%" valign="top"',

                                          'text' => $lc_text);

   $col ++;

   if ($col > PRODUCT_LIST_COL_NUM-1) {

     $col = 0;

     $row ++;

   }

 

 }

              // close the select box

$sel_text .= "      </select>n";

$sel_text .= '<input type="submit" value="go">';

$sel_text .= "</form>";

echo $sel_text;

              // i commented this out so the table wouldnt be created under the listbox 

              //new contentBox($info_box_contents);

 

then into product_info.php, I changed the all of the

$HTTP_GET_VARS[ 'products_id' ]

to what I named the select :

$HTTP_GET_VARS[ 'product_id' ]

 

I would suggest search and replace. I think theres about 7 instances.

 

 

enjoy...

 

Trinity

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...