Jump to content

Edit History

Guillaume_KS

Guillaume_KS

J'ai tenter de faire un override mais j'ai un problème avec du coup

 

<?php


if (!defined('_PS_VERSION_'))
    exit;

class Wysi extends Module
{
    public function __construct()
    {
        $this->name = 'wysi';
        $this->tab = 'front_office_features';
        $this->version = '0.1';
        $this->author = 'advisa';
        $this->need_instance = 0;

        parent::__construct();

        $this->displayName = $this->l('wysi');
        $this->description = $this->l('Add WYSIWYG field in Product Category');
    }

    public function install()
    {
        return parent::install() &&
            $this->registerHook('displayBackOfficeCategory');
    }

    public function uninstall()
    {
        return parent::uninstall();
    }
    public function _installSql() {
        $sqlInstall = "ALTER TABLE " . _DB_PREFIX_ . "category_lang ADD composition TEXT null";
        $returnSql = Db::getInstance()->execute($sqlInstall);
        return $returnSql;
    }
    public function hookDisplayBackOfficeCategory($params)
    {
        $texteSeo = new Category($params['id_texteSeo']);

        $this->context->smarty->assign(array(
            'texteSeo' => $texteSeo->composition,
        ));
        return $this->display(__FILE__, 'wysi.tpl');
    }
}

 

class Category extends CategoryCore
{
    public $composition;

    public function __construct(
        $id_product = null,
        $full = false,
        $id_lang = null,
        $id_shop = null,
        Context $context = null
    ) {
        self::$definition['fields']['composition'] = array(
            'type' => self::TYPE_HTML,
            'lang' => false,
            'required' => false,
            'validate' => 'isCleanHtml'
        );

        parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
    }
}

 

Dans le back-office je reçois l'erreur suivante

 

Quote

[Semantical Error] The annotation "@AdminSecurity" in method PrestaShopBundle\Controller\Admin\Sell\Catalog\CategoryController::indexAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?

Donc j'ai essayer de mettre

 

 use PrestaShopBundle\Controller\Admin\Sell\Catalog\CategoryController

Mais cela ne change pas ce message d'erreur

Guillaume_KS

Guillaume_KS

J'ai tenter de faire un override mais j'ai un problème avec du coup

 

class Category extends CategoryCore
{
    public $composition;

    public function __construct(
        $id_product = null,
        $full = false,
        $id_lang = null,
        $id_shop = null,
        Context $context = null
    ) {
        self::$definition['fields']['composition'] = array(
            'type' => self::TYPE_HTML,
            'lang' => false,
            'required' => false,
            'validate' => 'isCleanHtml'
        );

        parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
    }
}

 

Dans le back-office je reçois l'erreur suivante

 

Quote

[Semantical Error] The annotation "@AdminSecurity" in method PrestaShopBundle\Controller\Admin\Sell\Catalog\CategoryController::indexAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?

Donc j'ai essayer de mettre

 

 use PrestaShopBundle\Controller\Admin\Sell\Catalog\CategoryController

Mais cela ne change pas ce message d'erreur

×
×
  • Create New...