Jump to content

[Solved]displayAdminProductsOptions Javascript


Recommended Posts

I'm making a custom module for a customer, and for this module i use the "displayAdminProductsOptionsStepTop" hook.
I successfully added my custom css and js like this:

public function hookactionAdminControllerSetMedia($params)
{
    $this->context->controller->addJS($this->_path.'/views/js/customJSfile.js');
    $this->context->controller->addCSS($this->_path.'/views/css/customCSSfile.css');
}

 

The problem
It loads this js and css file in every backend page, and this gives some conflicts.
Is there a proper way to load the js/css only for the AdminProducts page?

Edited by Inform-All (see edit history)
Link to comment
Share on other sites

For other PS users, not a pretty solution, but it works:

public function hookactionAdminControllerSetMedia($params)
{
	if ($this->context->controller->php_self === "AdminProducts")
	{
        $this->context->controller->addJS($this->_path.'/views/js/customJSfile.js');
	    $this->context->controller->addCSS($this->_path.'/views/css/customCSSfile.css');
	}
}

 

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...