Dynamic Product Classes

Hello,

I was wondering if there's an easy way to add classes to individual products (particularly on the Category Grid View page) that echo the categories that each product is assigned to?

I need to add a style specific to products that are allocated to a 'Featured' category.

If the dynamic classes isn't possible, is there any other quick way to achieve this?

Many thanks.

Hello,

I was wondering if there's an easy way to add classes to individual products (particularly on the Category Grid View page) that echo the categories that each product is assigned to?

I need to add a style specific to products that are allocated to a 'Featured' category.

If the dynamic classes isn't possible, is there any other quick way to achieve this?

Many thanks.

If you are familiar with Smarty you can create a new product template and select it in the Product details view list on the editing necessary category page.

You should add a new field to enter the CSS class name for each product or category. And then force this class to be applied to product in the administrator area.

We developed similar modifications, you can contact us in our HelpDesk.

Grid list template has the products:product_multicolumns_list hook

If you familiar with hooks, you can use this hook to override internal content and put it to the div with the required class. Product main category ID can be found in the {$product.main_category} parameter

More details about hooks can be found here:

http://docs.cs-cart.com/4.3.x/developer_guide/addons/hooking/tpl_hooks.html

By the way, if this all issue is about Product details page, you can create another template in the design/themes/[YOUT THEME]/templates/blocks/product_templates/ folder and assign it to the products you need.

But this will not help if these products should be displayed in another way in products list

Note that the product template should be selected on the Update category page:

http://prntscr.com/9flu11

Right, if it is selected on the 'Editing category' page, and 'Parent' is selected as a value of 'Product details view' on the 'Editing product' page, the template will be taken from the category. But you can select the exact template for a product.

Instruction for the new product template can be found here:

http://forum.cs-cart.com/topic/41210-rearrange-the-product-details-page