Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_draw_pull_down_menu, how to use?


cgchris99

Recommended Posts

Posted

I am working on a contribution and am fairly new to php.

I have an array

 

$sortby = array(1 => 'by Product name',2 => 'by Manufacturer');

 

How do I use the tep_draw_pull_down_menu to display a pull down for this sort order?

 

I tried this but it doesn't give the desired results

<?php echo 'Sort by ' . tep_draw_pull_down_menu('sortby', $sortby, '1', 'onChange="this.form.submit();"'); ?><input type="hidden" name="selected_box" value="reports">

 

Thanks for any information or help.

 

Chris

Posted

define('TEXT_BY_PRODUCT_NAME', 'by Product Name');
define('TEXT_BY_MANUFACTURER', 'by Manufacturer');
$sortby = array();
$sortby[] = array('id' => '1', 'text' => TEXT_BY_PRODUCT_NAME);
$sortby[] = array('id' => '2', 'text' => TEXT_BY_MANUFACTURER);

This replaces your sortby assignment. The actual tep_draw_pull_down_menu call is correct. You should move the defines to the language files for compatibility.

 

Hth,

Matt

Always back up before making changes.

Archived

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

×
×
  • Create New...