SergeR94 Posted September 29 Share Posted September 29 Bonjour Depuis peu, je rencontre cette ligne affichée dans le header du back-office (dans catalogue/produits principalement) : Warning: Undefined variable $translateFileLangsItemJsVars in /home/xxx/xxx/modules/dgtranslationall/dgtranslationall.php on line 2084 Je cherche bien sur comment la retirer. La partie concernée de dgtranslationnall.php est la suivante : public function hookDisplayBackOfficeHeader() { $configure = Tools::getValue('configure'); $controller = Tools::getValue('controller'); if (in_array($configure, array('dgcontenttranslation', 'dgcreativeelementstranslation'))) { return; } $this->initContent(true); $this->initModules(true); $js_vars = array(); $translateTableModalJsVars = $this->displayTranslateTableModal($configure, $controller); if ($translateTableModalJsVars !== false) { $js_vars = array_merge($js_vars, $translateTableModalJsVars); } else { $translateFileLangsItemJsVars = $this->displayTranslateFileLangItemsModal($configure, $controller); if ($translateFileLangsItemJsVars !== false) { $js_vars = array_merge($js_vars, $translateFileLangsItemJsVars); } } if ($controller !== "") { if (( \Dingedi\PsTranslationsApi\DgTranslationTools::getTranslationFieldsAlwaysEnabled() === 1 || (\Dingedi\PsTranslationsApi\DgTranslationTools::getTranslationFieldsEnabled() && $translateFileLangsItemJsVars !== false)) && $configure !== $this->name) { $this->loadAssets(); $js_vars['modules_widget'] = 1; $this->context->controller->js_files[] = $this->_path . 'views/js/dg.modules-widget.js?v=' . $this->version; } } if ($configure === $this->name || !empty($js_vars)) { $this->loadAssets(); $type = Tools::getValue('dgtranslationallpage'); if (in_array($type, array('content', 'modules', 'themes'))) { $this->context->controller->js_files[] = $this->_path . 'views/js/dg.' . $type . '-admin.js?v=' . $this->version; } $dg_base_url = $this->context->link->getAdminLink('AdminModules') . '&configure=' . $this->name; $ps_base_uri = rtrim(__PS_BASE_URI__, '/'); $js_vars = array_merge(array( 'dg_base_url' => $dg_base_url, 'ps_base_uri' => $ps_base_uri, 'ps_id_shop' => \Context::getContext()->shop->id ), $js_vars); $js_vars['ps_faviconnotificationbo'] = 'undefined'; if (\Dingedi\PsTools\DgShopInfos::isPrestaShop16()) { $this->context->smarty->assign($js_vars); return $this->display(__FILE__, 'views/templates/admin/hook/js_vars.tpl'); } else { Media::addJsDef($js_vars); } } } } Par avance merci de vos lumières Serge Link to comment Share on other sites More sharing options...
Eolia Posted September 29 Share Posted September 29 Mettez votre module à jour public function hookDisplayBackOfficeHeader() { if (!\Module::isEnabled($this->name)) { return; } $configure = Tools::getValue('configure'); $controller = Tools::getValue('controller'); if (in_array($configure, array('dgcontenttranslation', 'dgcreativeelementstranslation'))) { return; } $this->initContent(true); $this->initModules(true); $js_vars = array(); $translateTableModalJsVars = $this->displayTranslateTableModal($configure, $controller); $translateFileLangsItemJsVars = false; if ($translateTableModalJsVars !== false) { $js_vars = array_merge($js_vars, $translateTableModalJsVars); } else { $translateFileLangsItemJsVars = $this->displayTranslateFileLangItemsModal($configure, $controller); if ($translateFileLangsItemJsVars !== false) { $js_vars = array_merge($js_vars, $translateFileLangsItemJsVars); } } if ($controller !== "") { if (( \Dingedi\PsTranslationsApi\DgTranslationTools::getTranslationFieldsAlwaysEnabled() === 1 || (\Dingedi\PsTranslationsApi\DgTranslationTools::getTranslationFieldsEnabled() && $translateFileLangsItemJsVars !== false)) && $configure !== $this->name) { if (\Tools::getValue('configure') !== 'popuppro') { $this->loadAssets(); $js_vars['modules_widget'] = 1; $this->context->controller->addJS($this->_path . 'views/js/dg.modules-widget.js?v=' . $this->version, false); } } if ($controller === 'AdminTranslations') { $this->loadAssets(); $this->context->controller->addJS($this->_path . 'views/js/dg.admintranslations-widget.js?v=' . $this->version, false); } } if ($configure === $this->name || !empty($js_vars)) { $this->loadAssets(); $type = Tools::getValue('dgtranslationallpage'); if (in_array($type, array('content', 'modules', 'themes'))) { $this->context->controller->addJS($this->_path . 'views/js/dg.' . $type . '-admin.js?v=' . $this->version, false); } if (\Dingedi\PsTools\DgShopInfos::isPrestaShop9()) { $router = \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('router'); $dg_base_url = $router->generate('admin_module_configure_action', ['module_name' => $this->name]); } else { $dg_base_url = $this->context->link->getAdminLink('AdminModules') . '&configure=' . $this->name; } $ps_base_uri = rtrim(__PS_BASE_URI__, '/'); $js_vars = array_merge(array( 'dg_base_url' => $dg_base_url, 'ps_base_uri' => $ps_base_uri, 'ps_id_shop' => \Context::getContext()->shop->id ), $js_vars); $js_vars['ps_faviconnotificationbo'] = 'undefined'; if (\Dingedi\PsTools\DgShopInfos::isPrestaShop16()) { $this->context->smarty->assign($js_vars); return $this->display(__FILE__, 'views/templates/admin/hook/js_vars.tpl'); } else { Media::addJsDef($js_vars); } } } Link to comment Share on other sites More sharing options...
SergeR94 Posted September 29 Author Share Posted September 29 Bonjour et, une fois encore, merci pour cette réponse rapide. En revanche, lorsque j'ai voulu mettre à jour avec votre code, j'ai eu une erreur 500. Link to comment Share on other sites More sharing options...
Eolia Posted September 29 Share Posted September 29 J'ai pas dit de copier mon code. Au pire ajoutez juste la ligne $translateFileLangsItemJsVars = false; Je vous ai dit de mettre à jour le module, c'est différent. Link to comment Share on other sites More sharing options...
SergeR94 Posted September 29 Author Share Posted September 29 Bonjour Il n'y a pas de mise à jour de proposée. Mais j'ai copié votre ligne, et là ça fonctionne apparemment bien. Merci une fois encore Serge Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now