Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a category drop down menu to search results


philmatthews

Recommended Posts

Hi everyone.

 

I've been trying to add a category drop down menu (the same as the one displayed if you select a manufacturer with more 1 category) to the search results page.

 

I've tried editing the code in the advanced_search_result.php and the product_listing.php module but I can't get it to work (my PHP knowledge is quite limited)

 

Any help or advice would be very much appreciated!

 

I think the following code (from index.php) is used to create the menu but I am not sure where to put it or how to modify so it works on the search results page:

 

<?php
// optional Product List Filter
   if (PRODUCT_LIST_FILTER > 0) {
     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
     } else {
       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
     }
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '            <td align="center" class="main"><font color="#5F86BD">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
       if (isset($HTTP_GET_VARS['manufacturers_id'])) {
         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
         $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
       } else {
         echo tep_draw_hidden_field('cPath', $cPath);
         $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
       }
       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
       while ($filterlist = tep_db_fetch_array($filterlist_query)) {
         $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
       }
       echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
       echo '</form></td>' . "\n";
     }
   }

 

Thanks everyone : )

Phil

Link to comment
Share on other sites

  • 8 months later...
Hi everyone.

 

I've been trying to add a category drop down menu (the same as the one displayed if you select a manufacturer with more 1 category) to the search results page.

 

I've tried editing the code in the advanced_search_result.php and the product_listing.php module but I can't get it to work (my PHP knowledge is quite limited)

 

Any help or advice would be very much appreciated!

 

I think the following code (from index.php) is used to create the menu but I am not sure where to put it or how to modify so it works on the search results page:

 

 

Thanks everyone : )

Phil

 

 

Does anyone know if this is possible or has been done? This would be nice to have :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...