addJS function not working for admin in prestashop

I am trying to add javascript file in prestashop admin using backOfficeHeader hook using a module but nothing happened. My code is given below.

public function install()
    if (!parent::install()
        || !$this->registerHook('backOfficeHeader'))
        return false;

    return parent::install() && 

 public function hookBackOfficeHeader() {


If you are using PS 1.5 or 1.6 you should use hook "actionAdminControllerSetMedia".

Your module installer should check which prestashop version is used and then register the needed hook.

 if (version_compare(substr(_PS_VERSION_, 0, 3), '1.5', '<'))

Then you need to addJS on each hook in its version format: PS>=1.5

 public function hookActionAdminControllerSetMedia($params) { 


public function hookBackOfficeHeader($params) { 

did u try to check addJS path? I think nothing more can be possible if other JS files working. Try to use $this->_path.


1) Output path and check if it is valid. 2) Reload page and check network. Page load your script or not? 3) Remember to reset module if u change something with hooks. 4) Check module hooks.

For me "this->_path" dosn't work. My solution is to use $_SERVER['DOCUMENT_ROOT']

public function hookActionAdminControllerSetMedia($params)
    // add necessary javascript to products back office
    if($this->context->controller->controller_name == 'AdminProducts' && Tools::getValue('id_product'))


 ? Prestashop Admin panel Menu's Not visible
 ? Starter Theme Prestashop 1.7 is blank
 ? Starter Theme Prestashop 1.7 is blank
 ? Starter Theme Prestashop 1.7 is blank
 ? Prestashop1.6 theme on prestashop 1.7
 ? Prestashop 1.7 Installation Ubuntu 14.04 LAMP Too many redirects
 ? Prestashop 1.7 Update Error
 ? Prestashop 1.7 unable to save order address
 ? Prestashop 1.7 unable to display custom module
 ? Prestashop 1.7 stock manager option not showing