Intersekt Posted October 24, 2012 Share Posted October 24, 2012 I made a module for my shop for both left and right columns. On left column it works without any problem, in the right column it doesn't work because it doesn't load the css and the js file. This is a piece of code: function hookRightColumn($params) { return $this->hookLeftColumn($params); } function hookLeftColumn($params) { global $smarty; if (version_compare(_PS_VERSION_,'1.5','>')) { $this->context->controller->addJS(($this->_path).'blockXXX.js'); $this->context->controller->addCSS(($this->_path).'blockXXX.css', 'all'); } else { Tools::addJS(($this->_path).'blockXXX.js'); Tools::addCSS(($this->_path).'blockXXX.css', 'all'); } <etc> return $this->display(__FILE__, 'blockXXX.tpl'); } What's the problem? Link to comment Share on other sites More sharing options...
SoluNeXT Posted October 24, 2012 Share Posted October 24, 2012 (edited) Hi! addJS and addCSS don't work in right columns (do not ask me why!) The solution is simple: function hookHeader($params) { if (version_compare(_PS_VERSION_,'1.5','>')) { $this->context->controller->addJS(($this->_path).'blockXXX.js'); $this->context->controller->addCSS(($this->_path).'blockXXX.css', 'all'); } else { Tools::addJS(($this->_path).'blockXXX.js'); Tools::addCSS(($this->_path).'blockXXX.css', 'all'); } function hookRightColumn($params) { return $this->hookLeftColumn($params); } function hookLeftColumn($params) { global $smarty; <etc> return $this->display(__FILE__, 'blockXXX.tpl'); }</etc> } And link your module to the Header... Let's find me at http://solunext.fr or https://www.facebook.com/SoluNeXT.sas Edited October 24, 2012 by SoluNeXT (see edit history) Link to comment Share on other sites More sharing options...
Intersekt Posted October 25, 2012 Author Share Posted October 25, 2012 Thanks, that worked perfectly 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