I couldn't locate the exampe I had previously worked out like this, so had to redo it...
You will modify this section of tpl_categories.php:
PHP Code:
for ($i=0;$i<sizeof($box_categories_array);$i++) {
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';
}
This code will return just the top category id for whatever the current cat is:
PHP Code:
$current_top = str_replace(strstr("_",$box_categories_array[$i]['path']),"",str_replace("cPath=","",$box_categories_array[$i]['path']));
Insert this between the "for" and "switch" statements.
PHP Code:
case ($current_top == '3'):
$new_style = 'category-subof3';
break;
Insert one of these for each top cat you wish to distinguish, in the spot noted. They must be in exactly this location to work correctly.
PHP Code:
for ($i=0;$i<sizeof($box_categories_array);$i++) {
$current_top = str_replace(strstr("_",$box_categories_array[$i]['path']),"",str_replace("cPath=","",$box_categories_array[$i]['path']));
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;
/* add all individual subcat cases here*/
case ($current_top == '3'):
$new_style = 'category-subof3';
break;
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
break;
default:
$new_style = 'category-products';
}
Style these like
a.category-subof3-text {background-color: #112233;}
a.category-subof4-text {background-color: #223344;}
Bookmarks