Jump to content

Problèmes surcharge CMSController.php


Recommended Posts

Bonjour j'ai un souci avec l'activation de deux module: cmsproduct et Powerfull Form generator.

Powerfull Form generator est activé et configurer tout marche niquel le problèmes quand je veux activer l'autre module un message d'erreur arrive 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.2 au 2019-02-05 13:26:13 .

donc voilà je ne sais pas comment faire pour resoudre le problemes. je vous met les deux fichiers CmsController si ça peut vous aider

CMSPRODUCT_CmsController.php

POWERFUL_CmsController.php

Link to comment
Share on other sites

Tu dois assembler manuellement les 2 override en 1

Consolider dans une même fonction les 2 segments de code

Et forcer l'installation manuellement

 

Partant de CMSController:

Injecter

        preg_match_all('/\{powerfulform\:[(0-9\,)]+\}/i', $contents, $matches);
        foreach ($matches[0] as $index => $match) {
            $explode = explode(":", $match);
            $contents = str_replace($match, $this->generatePFG(str_replace("}", "", $explode[1])), $contents);
        }

        return $contents;

Dans la returnContent actuelle

 

Injecter

        $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');
            }
        }

Dans la initContent actuelle

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