Open cart ... Different CSS for each category

I am trying to upload a completely different CSS file for each category to my shopping cart. I tried using the switch statement in header.tpl, but that didn't help me.

Basically, I have only four categories, and everyone will have different CSS. As in category 56, different, 57 different, 58 different and 59 different.

How can I do it?

+4
source share
1 answer

You can add the desired css file through the category.php controller file.

File:

 catalog/controller/product/category.php 

To find:

 $this->document->setTitle($category_info['meta_title']); 

Add before this:

 if($category_id == 20){ $this->document->addStyle('catalog/view/theme/mytheme/stylesheet/category20.css'); } 
+1
source

Source: https://habr.com/ru/post/1389129/


All Articles