
Originally Posted by
DivaVocals
I hate to resurrect such an old post, but in testing a Zen Cart v1.5.1 update to the hideCategories add-on, I was FINALLY able to replicate the issue reported by the creator of this post.. For whatever reason, this issue ONLY occurs when the hideCategories add-on is installed.. I tried the solution posted a while back (see above) and it does indeed resolve the issue.. What I need to know before I claim victoru and add this to the hideCategories fileset is what will this break??
Calling out to Ajeh as she was the one trying to help resolve/troubleshoot this before..
More information.. As was pointed out previously by gazag, if one is using the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, the categories dropdown on the Advanced Search page will default to the last category on the dropdown list instead of "All Categories". Once I restore to the Zen Cart default for the includes/templates/custom_template/sideboxes/tpl_categories.php file, the dropdown defaults to "All Categories" as it should.. If I use the includes/templates/custom_template/sideboxes/tpl_categories.php file with the code modified for the hideCategories add-on, and then use the code posted by moosesoom, then all is right with the world..
Here is the relevant categories sidebox code if anyone is interested..
Code:
// Begin hideCategories code
list($nada, $mycpath)= split('=', $box_categories_array[$i]['path']);
$mycid = split('_', $mycpath);
$categories_id = array_pop($mycid);
$hide_status = $db->Execute("select visibility_status
FROM " . TABLE_HIDE_CATEGORIES . "
WHERE categories_id = " . $categories_id . "
LIMIT 1");
if ($hide_status->fields['visibility_status'] < 1) {
// End hideCategories code
switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
// case ($box_categories_array[$i]['path'] == 'cPath=3'):
// $new_style = 'category-holiday';
// break;
case ($box_categories_array[$i]['top'] == 'true'):
$new_style = 'category-top';
break;
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
break;
default:
$new_style = 'category-products';
}
if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
// skip if this is for the document box (==3)
} else {
$content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
if ($box_categories_array[$i]['current']) {
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
} else {
$content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
}
} else {
$content .= $box_categories_array[$i]['name'];
}
if ($box_categories_array[$i]['has_sub_cat']) {
$content .= CATEGORIES_SEPARATOR;
}
$content .= '</a>';
if (SHOW_COUNTS == 'true') {
if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
$content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
}
}
$content .= '<br />' . "\n";
}
}
} // hideCategories code
I just need to know if moosesoom's code is okay to use. It appears to fix the issue reported.. I just don't know what other "damage" it might do, and just need some feedback..

Originally Posted by
gazag
Ajeh,
By process of elimination i have discovered where the error was for the advanced search issue i am having - it is in the tpl_Categories file in my_template/sideboxes
Have you got any ideas at what to change????
I have attached the two documents - the one that says moddedforhiddencategories is the one that works fine with advanced search but the categories aren't hidden in the categories sidebox
the other one works fine for hidden but not for the advanced search!!
Your help is much appreciated!