Jump to content

prestashop 1.7 back.js not visible in custom module admin area


Jluis

Recommended Posts

Hi ,
I developed a module on prestashop 1.7, the file back.js is not called . I added it through the function addJS at the level hookBackOfficeHeader but it doesn't work .

public function hookBackOfficeHeader()
    {
        
        if (Tools::getValue('module_name') == $this->name) {
            $this->context->controller->addJS($this->_path . '/views/js/typeahead.bundle.js');
            $this->context->controller->addJS($this->_path.'views/js/back.js');
            $this->context->controller->addCSS($this->_path.'views/css/back.css');
       }
    }

how could i resolve it ?

Link to comment
Share on other sites

  • 7 months later...

  public function hookDisplayBackOfficeHeader($params)
        {
          $this->context->controller->addJs('modules/'.$this->name.'/views/js/cartbackaccessories.js');

        }

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
On 11/11/2018 at 1:27 AM, Jluis said:

Hi ,
I developed a module on prestashop 1.7, the file back.js is not called . I added it through the function addJS at the level hookBackOfficeHeader but it doesn't work .


public function hookBackOfficeHeader()
    {
        
        if (Tools::getValue('module_name') == $this->name) {
            $this->context->controller->addJS($this->_path . '/views/js/typeahead.bundle.js');
            $this->context->controller->addJS($this->_path.'views/js/back.js');
            $this->context->controller->addCSS($this->_path.'views/css/back.css');
       }
    }

how could i resolve it ?

The problem is that you can get the Tools::getValue('module_name') only if you submitted your module configuration form and this is stupid that Prestashop include it in the "example module".

I recommend that you use :

if (Tools::getValue('configure') == $this->name) {
	$this->context->controller->addJS($this->_path.'views/js/back.js');
	$this->context->controller->addCSS($this->_path.'views/css/back.css');
}

 

  • Like 1
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...