dev99999 Posted July 23, 2018 Share Posted July 23, 2018 (edited) Hi, I try to override blocktags.css from module blocktags, it is an .css file in the module's root directory. I try to override this in /themes/mytheme/modules/blocktags/blocktags.css, but it doesnt work. Also tried in /css/blocktags.css etc. but no success. It works only in /themes/mytheme/assets/css/custom.css (changed css) ? Edited July 23, 2018 by dev99999 (see edit history) Link to comment Share on other sites More sharing options...
GuusMichielsen Posted July 24, 2018 Share Posted July 24, 2018 (edited) I came here looking for this exact problem. I assume the blocktags-module doesn't have a stylesheet in the [root]/modules/blocktags folder? (If it does, you should be able to override the css by using the same folder-structure in [root]/themes/your-theme/modules/blocktags - and place your css in the equivalent place.) What I ended up doing was: 1. Register the new stylesheet (Basically tell Prestashop there is a new stylesheet available) in a php-file that extends the module-php, and place it in the [root]/override/modules/module-name folder (You probably have to create this folder). It should look something like this: <?php class BlocktagsOverride extends Blocktags { public function hookHeader() { $this->context->controller->registerStylesheet('modules-blocktags', 'modules/'.$this->name.'/css/blocktags.css', ['media' => 'all', 'priority' => 150]); } } ?> 2. Create the new stylesheet and place it in [root]/themes/your-theme/modules/module-name/css (Or wherever you point when registering the stylesheet) 3. See the magic happen (if not; clear cache and pray) I have to add that I'm not super confident about this solution, it works, but I'm not sure this is how it is intended. What I would like is to override the php in the theme-folder (and not the [root]/override folder), because if the theme is swapped out, the css in the theme is gone which makes the override unnecessary. Guus Edited July 31, 2018 by GuusMichielsen (see edit history) Link to comment Share on other sites More sharing options...
dev99999 Posted August 8, 2018 Author Share Posted August 8, 2018 Hi Guus (Dutch I guess, me too), Thank you very much for the solution, I go to try this and let you know, this is better then what I did and it is just a part of the theme but per module (I think) .. Dev99999 Link to comment Share on other sites More sharing options...
streletsky Posted August 31, 2019 Share Posted August 31, 2019 on presta 1.7.6 you can just add to your theme for example your module css is in here [root]/modules/blocktags/views/css/[filename].css module should have hookDisplayHeader public function hookDisplayHeader($params) { $this->context->controller->addCSS($this->_path . 'views/css/[filename].css', 'all'); themes css should be here [root]/themes/your-theme/modules/blocktags/views/css/[filename].css 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