ken0306 Posted October 30, 2012 Posted October 30, 2012 Hi, I was trying to make my own side box for categories and manufactures filter box ( it is part of code that using on the index.php pages. ). I move the manufactures filter dropdown box and change to list link style on to a side box. By combine the product specification add on, I manage to disable the manufactures filter, but still showing categories on the side box. It works as what I expect, but the script generate a error Empty delimiter. I know that is because of the return value can't be empty, but I don't know how to fix it. can some one help me out. here is my code. <?php if (isset($HTTP_GET_VARS['manufacturers_id']) == 0 ) { ?> <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } echo '<div id="filter_box">'; while ($categories = tep_db_fetch_array($categories_query)) { $cPath_new = tep_get_path($categories['categories_id']); echo ' <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"> <span class="filter_name"> ' . $categories['categories_name'] . ' </span> </a>' . "\n"; } echo '</div>'; // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> <!-- categories_eof //--> <?php } else { // optional Product List Filter 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) { ?> <? if (isset($HTTP_GET_VARS['manufacturers_id'])) { ?> <div id="filter_box"> <a href="<?=tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'])?>"><li class="filter_title"><?=TEXT_ALL_CATEGORIES?></li> </a> <? } 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 .= '&brand_id=' . $filterlist['id']; ?> <? if(isset($_GET['brand_id']) && $_GET['brand_id'] == $filterlist['id']) echo '<b class="filter_active">'; ?> <a href="<?=tep_href_link(FILENAME_DEFAULT, $filter_keys)?>"><span class="filter_name"><?=$filterlist['name']?></span></a> <? if(isset($_GET['brand_id']) && $_GET['brand_id'] == $filterlist['id']) echo '</b>'; ?> <? } ?> </div> <?php } } ?> thank you ken
germ Posted October 30, 2012 Posted October 30, 2012 strpos('_', $cPath) Should be: strpos($cPath, '_') If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
ken0306 Posted October 30, 2012 Author Posted October 30, 2012 Hi Jim after I change strpos('_', $cPath) to strpos($cPath, '_'), the categories still on my side box when I in the actual categories browsing products. So, how do I disable the categories box on the products categories products listing area? thank you
germ Posted October 31, 2012 Posted October 31, 2012 It's unsure to me what page you're on when you DON'T want the category box displayed. Perhaps you can PM me a link to the page? :unsure: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.