m3442a Posted August 8, 2018 Share Posted August 8, 2018 Hello, hope somebody can help me. I try to add a div class to a category and this need to be inherit for all subcategories. Example <div class="{if category->id == '1' || $category->id_parent == '1'}cat_a{/if}"</div> But this just add the class for the category self and the first subcategories, not the sub-subcategories and the levels below. How can add the class for all level depth inside the category 1? Here another example: CAT A SUBCAT A 1 SUB-SUBCAT A 1 1 SUB-SUBCAT A 1 2 CAT B SUBCAT B 1 SUB-SUBCAT B 1 1 SUB-SUBCAT B 1 2 For all this i would to put into header tpl. this logic. I open the categories with megamenu, and if i on some category site then need to see different classes for that categories <div class="{if category->id == 'A' or any Subcategories in all levels}cat_a{/if}"</div> <div class="{if category->id == 'B' or any Subcategories in all levels}cat_b{/if}"</div> " If select category A or any Child Category from A in any levels, then add the class "CAT_A" to the div " If select category B or any Child Category from B in any levels, then add the class "CAT_B" to the div CAT A and B and C...is not the root category Thanks for help 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