Wednesday 15 July 2015

css - Magento Styling Products in a Particular Category -


In Magenta, how can I treat products in a particular category differently?

Say, I have a category "special" and I want to present a little different from the rest of my products.

I initially thought about hooking up the custom style to the name of that class category, but it does not seem silly, because if you use those products directly, So they do not always appear in that category (such as saying in cookies or sessions) and the custom style is ignored.

Regardless of giving a custom layout template in that category, but I'm not using them as a layout and not using styles and in order to avoid problems in future, use I do not want to erase.

Before this worry? Thanks for the help!

You have 2 code oriented solutions:

  • If the "category" concept is that you are accessing a product through a category (on your product page, display a breadcrumbs category), then you (your catalog / product / view.phil) Dana :: Registry ('current_category') which contains your current_category and compare it to your "Special Category" (which is the configuration variable Otherwise, if you want your style to be applied even when you do not reach your product through category navigation. , You must manually check your product categories ( $ product- & gt

    PS: Keep in mind that as an episode a special Comparison with category (can be stored as a configuration variable

    Products can be assigned to many categories

    Hopes help you TML

No comments:

Post a Comment