Zen Cart has a pair of classes for active categories, .category-subs-parent and .category-subs-selected, but they will only operate when the category displays as text. You can add the test for current category elsewhere and get a class you will be able to apply the hover bg image to.
Add this code
PHP Code:
//mark current category
if ($box_categories_array[$i]['current']) {
$new_style .= '-current';
}
// /mark current category
as shown to get persistent hover on subcats as well as top cats
PHP Code:
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';
}
//mark current category
if ($box_categories_array[$i]['current']) {
$new_style .= '-current';
}
// /mark current category
$current_path = str_replace("cPath=","",$box_categories_array[$i]['path']);
or as shown here to get persistent hover on top cats only
PHP Code:
case ($box_categories_array[$i]['top'] == 'true'):
$new_style = 'category-top';
//mark current category
if ($box_categories_array[$i]['current']) {
$new_style .= '-current';
}
// /mark current category
break;
case ($box_categories_array[$i]['has_sub_cat']):
$new_style = 'category-subs';
break;
default:
$new_style = 'category-products';
}
$current_path = str_replace("cPath=","",$box_categories_array[$i]['path']);
Add to your stylesheet for each category like this
Code:
a.catBg25:hover {
background-image: url(../images/catbg25hover.gif);
}
a.category-top-current.catBg25 {
background-image: url(../images/catbg25hover.gif);
}
Try this and let me know how it works.
Bookmarks