Guest Posted February 13, 2007 Posted February 13, 2007 Hello, I would like to change the filter dropdown for manufacturer or category from a dropdown to a link-list. This is my current code which generates the dropdown: <?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 ' <table><tr><td align="center" class="main">' . 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></tr></table>' . "\n"; } } ?> Thanks for any supportive advice in advance.
Moleiro Posted April 19, 2008 Posted April 19, 2008 I need help to do the same. HELP ANYONE! THANKS TO ALL
mduggy Posted February 22, 2011 Posted February 22, 2011 A little late i know, but i needed this and couldnt find it, so i wrote it. Hope it helps someone! <p class="category_text"> <? if (isset($HTTP_GET_VARS['manufacturers_id'])) { ?> <a href="<?=tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'])?>"><?=TEXT_ALL_CATEGORIES?></a><br /> <? } else { ?> <a href="<?=tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cPath)?>"><?=TEXT_ALL_MANUFACTURERS?></a><br /> <? } while ($filterlist = tep_db_fetch_array($filterlist_query)) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { $filter_keys = 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']; } else { $filter_keys = 'cPath=' . $cPath; } $filter_keys .= '&sort=' . $HTTP_GET_VARS['sort']; $filter_keys .= '&filter_id=' . $filterlist['id']; ?> <? if(isset($_GET['filter_id']) && $_GET['filter_id'] == $filterlist['id']) echo "<b>"; ?> <a href="<?=tep_href_link(FILENAME_DEFAULT, $filter_keys)?>"><?=$filterlist['name']?></a> <? if(isset($_GET['filter_id']) && $_GET['filter_id'] == $filterlist['id']) echo "</b>"; ?> <br /> <? } ?> </p>
ken0306 Posted October 18, 2012 Posted October 18, 2012 Hi, it doesn't work, did you install it on the 2.2 or 2.3? thank you ken
Recommended Posts
Archived
This topic is now archived and is closed to further replies.