Originally Posted by
gjh42
autoace - The rules would generally be in a stylesheet, not a PHP file. In short, you can add #indexBody in front of a copy of any style rule, and the different properties in that (like "display: none;") will apply only to "index" pages like category and product listings.
You could also modify the function cat_active_level_manage() in categories_dressing_functions.php.
Can you show me how to modify the function cat_active_level_manage() in categories_dressing_functions.php to show *ONLY* the ACTIVE categories/sub-cat on the parent and sub-cat pages?
PHP Code:
function cat_active_level_manage($path) {
$skip_cat = 0;
if (defined('CAT_BOX_ACTIVE_LEVEL')) {
$test_level = 0;
$cat_box_active_level = explode('|',constant('CAT_BOX_ACTIVE_LEVEL'));
$cPath_top = (int)$_GET['cPath'];
$path_top = (int)$path;
$cat_depth = substr_count($path,'_');
//tests for various kinds of skipping - more can be added
switch ($cat_box_active_level[0]){
case 0:
$test_level = 1;
break;
case 1://active tree only
if($cPath_top != $path_top) $skip_cat = 1;
break;
case 2://active only (all tops when no cat selected)
if($cPath_top != $path_top and $cPath_top != 0) $skip_cat = 1;
break;
case 3://full active tree, others per level
if($cPath_top != $path_top) $test_level = 1;
break;
case 4://like 3, active branches only
if($cPath_top == $path_top){
if ($cat_depth >= 2){//only test sub-subcats+
$path_ids = explode('_',$path);
$path_parent = $path_ids[count($path_ids)-2];
if (!in_array($path_parent,explode('_',$_GET['cPath']))) $skip_cat = 1;//show only subcats w parent in $cPath
}
} else {//if not active test for level
$test_level = 1;
}
break;
case 5:// show active, no top, per levels
if ($cat_depth == 0 or $cPath_top != $path_top) {
$skip_cat = 1;
}else{
$test_level = 1;
}
break;
}//switch
if ($test_level){
switch ('true'){
case ($cat_box_active_level[1] > $cat_depth):
$skip_cat = 1;
break;
case ($cat_box_active_level[2] < $cat_depth):
$skip_cat = 1;
break;
}//switch
}//if
}//defined
return $skip_cat;
}
***
I have these defines in my categories_dressing_defines file:
define('CAT_BOX_ACTIVE_LEVEL', '0|0|1');//shows only top level cats and 1st level sub-cats
--which is what I want but ONLY on the home page.
define('CAT_BOX_ACTIVE_LEVEL', '2|0|1');//active only (all tops when no cat selected)
--on parent and sub-cat pages
Bookmarks