Prestashop-如何在特定挂钩中呈现.tpl?

时间:2020-04-25 13:50:21

标签: php prestashop prestashop-1.7 prestashop-modules

我是prestashop的新手,这可能很明显,但是我将此代码链接到模块中的.tpl文件。

<?php
    if(!defined('_PS_VERSION_'))
        return false;

    class FormCUI extends Module implements \PrestaShop\PrestaShop\Core\Module\WidgetInterface
    {
        private $templateFile;

        public function __construct($name = null, Context $context = null)
        {
            $this->name = 'formCUI';
            $this->author = 'CristainCutitei';
            $this->version = '1.0';

            $this->bootstrap = true;
            parent::__construct();

            $this->displayName = $this->trans('Form CUI', array(), 'Modules.FormCUI.Admin');
            $this->description = $this->trans('Allow users CUI in register form',array(),'Modules.FormCUI.Admin');
            $this->ps_versions_compliancy = array('min'=>'1.7', 'max'=>_PS_VERSION_);

            $this->templateFile = 'module:formCUI/views/templates/hook/FormCUI.tpl';
        }

        public function renderWidget($hookName, array $configuration)
        {
            return $this->fetch($this->templateFile);
        }

        public function getWidgetVariables($hookName, array $configuration)
        {
            return array(
                'message' => "Hello, this product is great!"
            );
        }
    }

我想在AdditionalCustomerFormFields挂钩中显示小部件以拥有新字段吗? 预先谢谢你!

0 个答案:

没有答案