artellando Posted March 28, 2019 Share Posted March 28, 2019 Hi, I am making my own modified version of the stock blockreassurance module. Right now it is working, but I am still unable to add a .css file with the styling for this module. While looking for a solution, I tried a few things before posting here: 1) Call addCss() inside hookDisplayHeader() public function install() { ... $this->registerHook('header'); ... } public function hookDisplayHeader($params) { $this->context->controller->addCss($this->_path.'views/css/my.css', 'all'); } 2) Call registerStylesheet() inside hookDisplayHeader() public function install() { ... $this->registerHook('header'); ... } public function hookDisplayHeader($params) { if ('product' === $this->context->controller->php_self) { $this->context->controller->registerStylesheet( 'module-myblockreassurance-style', 'modules/'.$this->name.'views/css/my.css', ['media' => 'all', 'priority' => 200,] ); } } 3) The official docs way: https://devdocs.prestashop.com/1.7/themes/getting-started/asset-management/#without-a-front-controller-module public function install() { ... $this->registerHook('actionFrontControllerSetMedia'); ... } public function hookActionFrontControllerSetMedia($params) { if ('product' === $this->context->controller->php_self) { $this->context->controller->registerStylesheet( 'module-myblockreassurance-style', 'modules/'.$this->name.'views/css/my.css', ['media' => 'all', 'priority' => 200,] ); } } Am I doing something wrong? Thanks in advance 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