Black Belt
- Join Date:
- Jul 2005
- Location:
- Upstate NY
- Posts:
- 21,876
- Plugin Contributions:
- 8
Parent Categories Separated In 3 sideboxes
A quick way to include all subcategories of a particular top cat is to type cast the value as an integer; any numbers following an _ will be discarded.
$cPTest = (int)str_replace("cPath=","",$box_categories_array[$i]['path']);
if(in_array($cPTest, explode(",",'3,7,7_25'))) {
// code to be executed
}
With three boxes to display different categories, copy this code into each one and adjust the numbers to reflect the desired top categories for that box.
For actual use in a version of tpl_categories.php, find thisphp 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 { and change to this ```php
$cPTest = (int)str_replace("cPath=","",$box_categories_array[$i]['path']);
if ((!in_array($cPTest, explode(",",'3,7,7_25'))) or 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 {