Post by Opencart_k » Fri Jun 09, 2017 10:19 pm

Hello
I would like to have different background color in each category. How can I make that please?
???
I use opencart 2.3.0.2

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by Johnathan » Fri Jun 09, 2017 10:32 pm

Dynamic Styling can do this. You set up the styling you want for a page, then apply it to a Layout for the category page, and assign that category the layout (in its Design tab).

Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Opencart_k » Sat Jun 10, 2017 5:26 pm

Thank you a lot for your answer, I was looking or a non-commercial solution.
Maybe making it from back-end with a custom solution, maybe at header.tpl file .

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by Opencart_k » Mon Jun 12, 2017 7:50 pm

Hello
I would like to have different background color in each category. How can I make that please?
I use opencart 2.3.0.2

I tried to use in header.tpl

Code: Select all

<?php if (!isset($this->request->get['path']) || $this->request->get['path'] == '25_29') { ?>
<link href="catalog/view/theme/default/stylesheet/stylesheet.css" rel="stylesheet">
<?php } 

 elseif (!isset($this->request->get['route']) || $this->request->get['route'] == 'information/contact') { ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet2.css" />
<?php } 

else { ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet3.css" />
<?php } 

?>
But it seems not to work. What am I doing wrong?

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by pprmkr » Mon Jun 12, 2017 8:12 pm

Opencart's catalog/controller/common/header.php determines route, path, information_id or product_id and creates $class variable:

Code: Select all

$data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
Take a look at the source of your website and copy class set to <body>, for example:

Code: Select all

<body class="product-category-18_45">
Then add css to stylesheet:

Code: Select all

.product-category-18_45 {
    background: #ff0000;
}

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by Opencart_k » Mon Jun 12, 2017 8:31 pm

Thank you a lot pprmkr!
That works perfectly and is a great way to achieve it!
There is no need to create whole stylesheet file but just some classes for the categories.

Great, thank you!

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by Opencart_k » Tue Jun 13, 2017 5:53 pm

In the simple installation of opencart locally in my computer I achieved it.
In my real website I use journal2 theme.
There, the body class in my category page is empty :

Code: Select all

<body class="">
Any ideas how to develop it there?

p.s. I get at the top (where is the only spot that category path is shown) but if I try as before it does not work:

Code: Select all

<html
dir="ltr" lang="el" class="firefox firefox53 win journal-desktop is-admin is-guest skin-5 responsive-layout infinite-scroll center-header mega-header catalog-currency catalog-cart lang-flag lang-flag-mobile currency-symbol currency-symbol-mobile no-top-on-mobile collapse-footer-columns filter-columns-mobile mobile-menu-on-tablet extended-layout header-center header-sticky sticky-menu backface product-grid-second-image product-list-second-image category-page category-page-888 layout-3 route-product-category oc2 oc23 one-column no-currency" data-j2v="2.9.8">

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by Opencart_k » Tue Jun 13, 2017 7:40 pm

Finally I used :

Code: Select all

.category-page-888 .category-info {
    background-color: #91363D !important;
}  
But I had to edit a different file and put the code there. The file is in catalog\view\theme\journal2\css\journal.css

I hope someone finds that useful !!

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by cyclops12 » Tue Jun 20, 2017 4:07 am

Glad you got it working and well done for posting up your solution
May help others in future with similar problems :banana:

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by IP_CAM » Tue Jun 20, 2017 9:14 am

Well, there would have been a nice free Background Image Mod too, after all... ::)
and it functions just swell, just to mention it too!
Background Image Change(VQMOD) free, OC v.1.5.x - 2.3.0.2:
https://www.opencart.com/index.php?rout ... n_id=16044
Image

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 1 guest