Jluis Posted November 11, 2018 Share Posted November 11, 2018 Hi , I developed a module on prestashop 1.7, the file back.js is not called . I added it through the function addJS at the level hookBackOfficeHeader but it doesn't work . public function hookBackOfficeHeader() { if (Tools::getValue('module_name') == $this->name) { $this->context->controller->addJS($this->_path . '/views/js/typeahead.bundle.js'); $this->context->controller->addJS($this->_path.'views/js/back.js'); $this->context->controller->addCSS($this->_path.'views/css/back.css'); } } how could i resolve it ? Link to comment Share on other sites More sharing options...
keithg Posted July 9, 2019 Share Posted July 9, 2019 public function hookDisplayBackOfficeHeader($params) { $this->context->controller->addJs('modules/'.$this->name.'/views/js/cartbackaccessories.js'); } 1 Link to comment Share on other sites More sharing options...
Bruno G Posted June 8, 2020 Share Posted June 8, 2020 On 11/11/2018 at 1:27 AM, Jluis said: Hi , I developed a module on prestashop 1.7, the file back.js is not called . I added it through the function addJS at the level hookBackOfficeHeader but it doesn't work . public function hookBackOfficeHeader() { if (Tools::getValue('module_name') == $this->name) { $this->context->controller->addJS($this->_path . '/views/js/typeahead.bundle.js'); $this->context->controller->addJS($this->_path.'views/js/back.js'); $this->context->controller->addCSS($this->_path.'views/css/back.css'); } } how could i resolve it ? The problem is that you can get the Tools::getValue('module_name') only if you submitted your module configuration form and this is stupid that Prestashop include it in the "example module". I recommend that you use : if (Tools::getValue('configure') == $this->name) { $this->context->controller->addJS($this->_path.'views/js/back.js'); $this->context->controller->addCSS($this->_path.'views/css/back.css'); } 1 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