lrdo Posted January 28, 2015 Share Posted January 28, 2015 Hello everybody, I'm new in Prestashop and I'm trying to understand how to modify CSS codes in a theme in the same way that we do a child theme in Wordpress. The goal is to be able to install futur theme's updates without affecting my custom codes. So, for this example, let's use the default theme (default-bootstrap). Let's say that I want to customize the Blockcart button. Original codes are: .shopping_cart > a:first-child { padding: 7px 10px 14px 16px; background: #333333; display: block; font-weight: bold; color: #777777; text-shadow: 1px 1px rgba(0, 0, 0, 0.2); overflow: hidden; } And I want to change them for: .shopping_cart > a:first-child { padding: 7px 10px 14px 16px; background: #CF0000; display: block; font-weight: bold; color: #FFE800; text-shadow: 1px 1px rgba(0, 0, 0, 0.5); overflow: hidden; border-radius: 15px 5px; } Ok. Now, the path to this CSS file is: /web/themes/default-bootstrap/css/modules/blockcart/blockcart.css So, I did copy my customized css file in that path: /web/override/themes/default-bootstrap/css/modules/blockcart/blockcart.css I delete the class_index.php file in the /web/cache folder, empty the cache on my web browser, press Ctrl-F5, and nothing changes. Can someone tell me why? (in french or in english) Thank you very much! Link to comment Share on other sites More sharing options...
Rolige Posted January 28, 2015 Share Posted January 28, 2015 The file "/web/themes/default-bootstrap/css/modules/blockcart/blockcart.css" is already overriding to the master file in "/web/modules/blockcart/blockcart.css"You can't override the file "/web/themes/default-bootstrap/css/modules/blockcart/blockcart.css" because this is the override file, so you will need to make the changes here. I hope this help you. Link to comment Share on other sites More sharing options...
lrdo Posted January 28, 2015 Author Share Posted January 28, 2015 Ok, thank you! So, does it mean that if I install an upgrade of the theme in the futur, this file will not be replaced and my customisation will remain? Thanks again! Link to comment Share on other sites More sharing options...
dioniz Posted January 28, 2015 Share Posted January 28, 2015 You should create new theme and copy files from default-bootstrap theme to your new theme and then make changes. Link to comment Share on other sites More sharing options...
Rolige Posted January 28, 2015 Share Posted January 28, 2015 In this case you are using the default theme, then if you upgrade your PrestaShop and this update include changes in these files, of course will be updated.My recommendation is, if you want keep your CSS changes in future upgrades, create a new CSS file in the folder "autoload", eg: /web/themes/default-bootstrap/css/autoload/my-own-styles.cssNow you can insert all your custom styles in my-own-styles.css, or you can create all the files you need, this files will be loaded automatically. 3 Link to comment Share on other sites More sharing options...
lrdo Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) Thank you Cotoko, you have really understood my needs. In fact, I won't use the default template, I will buy one and customize it a bit. What you wrote sounds very good. I did a test but, since I'm not a professional, I would need one more explaination: How come the autoload folder don't have priority over the original folder? It looks like this if I inspect element: media="all" .shopping_cart > a:first-child { padding: 7px 10px 14px 16px; background: #333333; display: block; font-weight: bold; color: #777777; text-shadow: 1px 1px rgba(0, 0, 0, 0.2); overflow: hidden; } media="all" .shopping_cart > a:first-child { padding: 7px 10px 14px 16px; background: #CF0000; display: block; font-weight: bold; color: #FFE800; text-shadow: 1px 1px rgba(0, 0, 0, 0.5); overflow: hidden; border-radius: 15px 5px; } Thank you! Edited January 29, 2015 by lrdo (see edit history) Link to comment Share on other sites More sharing options...
lrdo Posted January 28, 2015 Author Share Posted January 28, 2015 (edited) Here is a screenshot Edited January 29, 2015 by lrdo (see edit history) Link to comment Share on other sites More sharing options...
lrdo Posted January 29, 2015 Author Share Posted January 29, 2015 (edited) Ok, I think I found a good solution. I have deleted the original css file, in the /web/themes/default-bootstrap/css/modules/blockcart. So, it's now the file in the autoload folder that appears. And, in a future upgrade, I will just have to delete again the original file, and my customization will remain. Does this solution sound good to a Moderator? Edited January 29, 2015 by lrdo (see edit history) Link to comment Share on other sites More sharing options...
parsifal Posted February 4, 2015 Share Posted February 4, 2015 (edited) How come the autoload folder don't have priority over the original folder? It looks like this if I inspect element: In your custom CSS file inside the autoload folder, you could use a more detailed selector with greater specificity. For example, instead of this selector: .shopping_cart > a:first-child ...you can use this one: #blockcart_top_wrap .shopping_cart > a:first-child Edited February 4, 2015 by parsifal (see edit history) 1 Link to comment Share on other sites More sharing options...
lrdo Posted February 4, 2015 Author Share Posted February 4, 2015 Ok, thank you Parsifal! 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