Jump to content

backOfficeHeader


waxdaddy

Recommended Posts

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

  • 9 months later...

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 by t0m3kk (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...