Twitch Hide Any Category v1.0

Completed Feb 1st 2012 tested on ZenCart version 1.39h

This modification will allow you to hide any category you specify in includes/templates/YOUR_TEMPLATE/sideboxes/tpl_categories.php.

Simply replace/add in the code below to manually hide categories.

How it works:
As the sidebox php loop runs it simply outputs <basic html tags along with> <your category title> creating the sidebox with the many categories you see.

This code will 'empty' the $content variable for the specific category you choose before it gets wrapped in html code. It's a very simple output filter.

Any category can be removed regardless of it's hierarchy.

I have tested it on a ZenCart 1.39h with multisite, wholesale, dual pricing and a host of other custom mods without any complications.

• Step 1

Change this:

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 .= '<li><div class="betterCategories"><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
if ($box_categories_array[$i]['current']) {


To this:
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 {

//Twitch Hide Any Category Step 1 of 2 - Jan 31 2012 starts
if ($box_categories_array[$i] ['path'] == 'cPath=3_10') {
//this line filters out the cPath=CategoryYouWantToHide
$content .= '';
//this line clears the line data so it will NOT be inserted into the sidebox
} else {
//repeat 5 lines above to remove another category you MUST ADD AN END BRACKET below
if ($box_categories_array[$i] ['path'] == 'cPath=3_7') {
//this line filters out the cPath=CategoryYouWantToHide
$content .= '';
//this line clears the line data so it will NOT be inserted into the sidebox
} else {
//repeat 5 lines above to remove another category you MUST ADD AN END BRACKET below
//Twitch Hide Any Category Step 1 of 2 - Jan 31 2012 ends

$content .= '<li><div class="betterCategories"><a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
if ($box_categories_array[$i]['current']) {


• Step 2

Change this:

$content .= '</div></li>' . "\n";
//$content .= '<br />' . "\n";
}
}


To this:

$content .= '</div></li>' . "\n";
//$content .= '<br />' . "\n";
}
}
//Twitch Hide Any Category Step 2 of 2 - Jan 31 2012 starts
//IMPORTANT - For each category you remove add one end bracket below
}}
//Twitch Hide Any Category Step 2 of 2 - Jan 31 2012 ends

• That's It!

You will notice it is setup to remove 2 categories - 3_10 and 3_7 - which are not in any numeric order. Just add another 5 lines of code in step 1 along with the end bracket in step 2 if you want to hide another category.

Feel free to report your findings and uses of this code in this thread!

Twitch.