Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Where is the tep_draw_pull_down_menu function located????


Guest

Recommended Posts

I am trying to add a search function in my header navigation bar. What I want to do is add a drop-down list box that calls to my DB in the product table in a new field called sizes. I want the customer to be able to choose a size (Mens, Ladies, or All), as well as all the categories, which i have successfully added, and a price range drop-down, instead of the price-to, price-from option in the advanced search. I am selling watches, by the way. I can see that the categories drop-down calls to 'categories_id' in catalog/advanced_search.php:

<td class="headerNavigation" align="right">Category:</td>

<td class="fieldValue" align="right"><?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => 'All Categories')))); ?></td>

 

I believe I need to change 'categories_id', to 'products_size', however

where do I go to define 'products_size' and make it display Mens, Ladies?

 

Here's my site: http://www.clocksandwatchesonline.com

Link to comment
Share on other sites

The pull down is in catalog/includes/functions/html_output.php - however, do not try to modify it.

 

Instead, build your own function. As you can see, the code you pasted here uses the function tep_get_categories from catalog/includes/functions/general.php to build the array outputted to the pulldown. Build a similar function yourself, add it to general.php and call it in the same manner.

 

You could probably use radio buttons to select the search between men's, ladies and all.

 

The products size - which I imagine you have added as an attribute can be called from the products_options table in the database

Link to comment
Share on other sites

Hi,

 

the function is located in catalog/includes/functions/html_output.php.

 

You can see there the variables you need to pass to it. In particular, pay attention to $values, which is a 2 dimensional array. You need to constuct your array in the form:

 

$values[]['id']

$values[]['text']

 

Where id is the numerical value associated with a given option and text is what the user sees in the list to base their choice on.

 

Here's some code that I used recently to create such a drop down from a database table:

 

$boxes_query = tep_db_query("select cards_infobox_id, cards_infobox_name from " . TABLE_CARDS_INFOBOXES);

$i=0;

while ($box = tep_db_fetch_array ($boxes_query)){

$values[$i]['id']= $box['cards_infobox_id'];

$values[$i]['text']= $box['cards_infobox_name'];

$i++;

}

echo tep_draw_form('box_selection', FILENAME_CARDS_INFOBOX_ADMIN,'');

echo tep_draw_pull_down_menu('box_select', $values, $box_id, 'onChange="this.form.submit();"');

 

There's probably a neater way of creating the array (I'm awaiting the advice of the people who read more of their php literature here......lol), but it works.

 

Hope this helps,

 

 

 

 

Mark

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...