I tried sending to my module prestashop addons. I got a message "Technical validation has been declined". This message contain the
You need to add a condition in hookBackOfficeHeader to include your file only the pages that you want.
My hookBackOfficeHeader hook is:
public function hookBackOfficeHeader()
{
$this->context->controller->addCSS($this->_path.'views/css/back.css');
$this->context->controller->addJquery();
$this->context->controller->addJS($this->_path.'views/js/back.js?v=1.0');
}
I need to use this css and js files just product edit page and module configuration page. How can i add a condition for this pages?
Regards
There is many ways, I'll write the most easy:
public function hookBackOfficeHeader()
{
if(
(Tools::getValue('controller') == 'AdminProducts' AND Tools::getValue('id_product'))
OR
(Tools::getValue('controller') == 'AdminModules' AND
(Tools::getValue('configure') == YOURMODULENAME OR Tools::getValue('module_name') == YOURMODULENAME)
)
){
$this->context->controller->addCSS($this->_path.'views/css/back.css');
$this->context->controller->addJquery();
$this->context->controller->addJS($this->_path.'views/js/back.js?v=1.0');
}
}