yay Posted February 19, 2015 Share Posted February 19, 2015 I have a three level category structure that looks something like this: Women Tops Blouses Jackets Shoes Casual shoes Training shoes Men Shirts Long-sleeve Short-sleeve Shoes Sneakers Trainers I want to use a certain color for styling elements on all Men categories and another color for all Women categories. So all sub-categories and sub-sub-categories should have the same color as their "grandparent" category. So my solution was to add this to the body class tag in header.tpl. {if $page_name == 'category'} category-{$id_category_parent}{/if} This works great but only for two levels. When I'm in say the Blouses category on level 3, the returned parent ID will of course be Tops instead of Women. I know there is a $category->level_depth command that might be helpful but I still can't figure out how to access the "grandparent" category ID for level 3 categories. Any ideas? Link to comment Share on other sites More sharing options...
fred-vinapresta Posted February 19, 2015 Share Posted February 19, 2015 did you try in your css to put for example: #category-1, #category-1 ul li a{color: #F3F3F3 !important;} #category-2, #category-2 ul li a{color: #B2B2B2 !important;} Link to comment Share on other sites More sharing options...
yay Posted February 20, 2015 Author Share Posted February 20, 2015 (edited) Yes the CSS works but I want to avoid having to add specific CSS for all level two and three categories since that means the CSS has to be updated every time a new category is added. Edited February 20, 2015 by yay (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now