@rthur Posted September 14, 2023 Share Posted September 14, 2023 (edited) Bonjour, Sur Presta 1.7.8.9, je n'arrive pas à activer un module à cause de cette erreur : L'action enable est impossible pour le module cmsproducts. Impossible d'installer la surcharge : La méthode initContent de la classe CmsController est déjà surchargée par le module powerfulformgenerator version 2.7.9 au 2023-04-21 12:25:44 . J'ai ce code dans l'override CmsController,php : public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); if ($this->assignCase == 1) { if ($this->cms->indexation == 0) { $this->context->smarty->assign('nobots', true); } if (version_compare(Tools::substr(_PS_VERSION_, 0, 3), '1.7', '>=')) { $currentCms = $this->objectPresenter->present($this->cms); $currentCms['content'] = $this->returnContent($currentCms['content']); $this->context->smarty->assign(array( 'cms' => $currentCms, )); $this->setTemplate( 'cms/page', array('entity' => 'cms', 'id' => $this->cms->id) ); } else { if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) { $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS'); } elseif (isset($this->cms_category->meta_title)) { $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS'); } $this->cms->content = $this->returnContent($this->cms->content); $this->context->smarty->assign(array( 'cms' => $this->cms, 'content_only' => (int)Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite) )); $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); } } elseif ($this->assignCase == 2) { if (version_compare(Tools::substr(_PS_VERSION_, 0, 3), '1.7', '>=')) { $this->context->smarty->assign($this->getTemplateVarCategoryCms()); $this->setTemplate('cms/category'); } else { $this->context->smarty->assign(array( 'category' => $this->cms_category, //for backward compatibility 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id), 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite) )); $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); } } } Savez-vous comment corriger cette erreur ? Merci Edited September 14, 2023 by @rthur (see edit history) Link to comment Share on other sites More sharing options...
wepresta Posted September 14, 2023 Share Posted September 14, 2023 2 hours ago, @rthur said: Bonjour, Sur Presta 1.7.8.9, je n'arrive pas à activer un module à cause de cette erreur : L'action enable est impossible pour le module cmsproducts. Impossible d'installer la surcharge : La méthode initContent de la classe CmsController est déjà surchargée par le module powerfulformgenerator version 2.7.9 au 2023-04-21 12:25:44 . J'ai ce code dans l'override CmsController,php : public function initContent() { parent::initContent(); $parent_cat = new CMSCategory(1, $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('cgv_id', Configuration::get('PS_CONDITIONS_CMS_ID')); if ($this->assignCase == 1) { if ($this->cms->indexation == 0) { $this->context->smarty->assign('nobots', true); } if (version_compare(Tools::substr(_PS_VERSION_, 0, 3), '1.7', '>=')) { $currentCms = $this->objectPresenter->present($this->cms); $currentCms['content'] = $this->returnContent($currentCms['content']); $this->context->smarty->assign(array( 'cms' => $currentCms, )); $this->setTemplate( 'cms/page', array('entity' => 'cms', 'id' => $this->cms->id) ); } else { if (isset($this->cms->id_cms_category) && $this->cms->id_cms_category) { $path = Tools::getFullPath($this->cms->id_cms_category, $this->cms->meta_title, 'CMS'); } elseif (isset($this->cms_category->meta_title)) { $path = Tools::getFullPath(1, $this->cms_category->meta_title, 'CMS'); } $this->cms->content = $this->returnContent($this->cms->content); $this->context->smarty->assign(array( 'cms' => $this->cms, 'content_only' => (int)Tools::getValue('content_only'), 'path' => $path, 'body_classes' => array($this->php_self.'-'.$this->cms->id, $this->php_self.'-'.$this->cms->link_rewrite) )); $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); } } elseif ($this->assignCase == 2) { if (version_compare(Tools::substr(_PS_VERSION_, 0, 3), '1.7', '>=')) { $this->context->smarty->assign($this->getTemplateVarCategoryCms()); $this->setTemplate('cms/category'); } else { $this->context->smarty->assign(array( 'category' => $this->cms_category, //for backward compatibility 'cms_category' => $this->cms_category, 'sub_category' => $this->cms_category->getSubCategories($this->context->language->id), 'cms_pages' => CMS::getCMSPages($this->context->language->id, (int)$this->cms_category->id, true, (int)$this->context->shop->id), 'path' => ($this->cms_category->id !== 1) ? Tools::getPath($this->cms_category->id, $this->cms_category->name, false, 'CMS') : '', 'body_classes' => array($this->php_self.'-'.$this->cms_category->id, $this->php_self.'-'.$this->cms_category->link_rewrite) )); $this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); } } } Savez-vous comment corriger cette erreur ? Merci Bonjour, Il faut ajouter le code de la méthode initContent de l'override CmsController du module cmsproducts dans votre override déjà en place, puis supprimer l'override du module et enfin installer. Link to comment Share on other sites More sharing options...
Mediacom87 Posted September 14, 2023 Share Posted September 14, 2023 Il faudrait déjà savoir ce que fait l'override de base et si en fin de compte le retirer simplement ne serait pas la meilleure solution. 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