prestashop_newuser Posted August 16, 2013 Share Posted August 16, 2013 Hi, I am just a newbie to the prestashop. I am doing a module from scratch. In the module I need to add some link to css and js file. For that I have used Tools::addcss(($this->_path).'css/search.css', 'all'); Tools::addjs(($this->_path).'js/search.js', 'all'); and this one is working fine but there is one error telling that Warning: Function addCSS() is deprecated . So I checked for some documentation and got something to work. So I used $this->context->controller->addjs('js/search.js', 'all'); but this one is not working at all. So can someone kindly tell me how to solve this issue? Any help and suggestions will be really appreciable. Thanks Link to comment Share on other sites More sharing options...
razaro Posted August 16, 2013 Share Posted August 16, 2013 (edited) Try with $this->context->controller->addJS(($this->_path).'js/search.js'); Edited August 16, 2013 by razaro (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 16, 2013 Share Posted August 16, 2013 here is the code for ps 1.5.x $this->context->controller->addJS($this->_path.'myscript.js'); $this->context->controller->addCSS($this->_path.'mycss.css'); 1 Link to comment Share on other sites More sharing options...
Azoda.net Posted November 25, 2014 Share Posted November 25, 2014 here is my code (prestashop 1.6),but my css is not run,pls explain help me why did ? public function hookHeader($params) { if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index') $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS($this->_path.'css/npt.css', 'all'); } Link to comment Share on other sites More sharing options...
Recommended Posts