waxdaddy Posted August 17, 2011 Share Posted August 17, 2011 Has anybody got an example of how to use the 'backOfficeHeader' hook to insert JS into the back office header section? Link to comment Share on other sites More sharing options...
waxdaddy Posted August 17, 2011 Author Share Posted August 17, 2011 So i got the backOfficeHeader hook working but for some reason 'Tools::addJS' doesn't work. I resorted to just returning a string containing the JS i wanted to insert. public function install() { if(!parent::install() || !$this->installModuleTab('AdminNewsLetter', array(1=>'Newsletter', 2=>'Newsletter'), 0) || !$this->registerHook('header') || !$this->registerHook('backOfficeHeader')) { return false; }else{ return true; } } public function hookBackOfficeHeader() { $oLink = new Link; $sSearchUrl = $oLink->getPageLink('search.php'); $js .='<script type="text/javascript">var searchurl = "'.$sSearchUrl.'";</script>'; $js .= '<script type="text/javascript" src="/prestashop/js/jquery.autocomplete.js"></script>'; $js .= '<script type="text/javascript" src="/prestashop/js/autocompletesearch.js"></script>'; return $js; } Is the fact addJS doesn't work a bug? Or should it not work anyway for the back office header?? can't see why it wouldn't Link to comment Share on other sites More sharing options...
t0m3kk Posted May 20, 2012 Share Posted May 20, 2012 (edited) So i got the backOfficeHeader hook working but for some reason 'Tools::addJS' doesn't work. I resorted to just returning a string containing the JS i wanted to insert. public function install() { if(!parent::install() || !$this->installModuleTab('AdminNewsLetter', array(1=>'Newsletter', 2=>'Newsletter'), 0) || !$this->registerHook('header') || !$this->registerHook('backOfficeHeader')) { return false; }else{ return true; } } public function hookBackOfficeHeader() { $oLink = new Link; $sSearchUrl = $oLink->getPageLink('search.php'); $js .='<script type="text/javascript">var searchurl = "'.$sSearchUrl.'";</script>'; $js .= '<script type="text/javascript" src="/prestashop/js/jquery.autocomplete.js"></script>'; $js .= '<script type="text/javascript" src="/prestashop/js/autocompletesearch.js"></script>'; return $js; } Is the fact addJS doesn't work a bug? Or should it not work anyway for the back office header?? can't see why it wouldn't Tools::addCSS also doesn't work... but I'll use your code Edited May 20, 2012 by t0m3kk (see edit history) 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