PS 1.7 HTML 产品功能

PS 1.7 HTML in Product Feature

Prestashop 1.7.4.1
我只想为功能添加两个新字段,但这看起来更复杂,我已经尝试过此 Prestashop custom field,但即使遵循 PS 覆盖文档,它也不适用于我的版本。 我的主要目标是拥有允许 HTML 内部产品功能的标题、图标和描述。

但这对于一个简单的任务来说似乎太多了,所以我想知道如何启用所见即所得文本区域,我设法将输入从文本类型更改为文本区域:

array(
                    'type' => 'textarea',
                    'label' => $this->trans('Value', array(), 'Admin.Global'),
                    'name' => 'value',
                    'lang' => true,
                    'size' => 255,
                    'hint' => $this->trans('Invalid characters:', array(), 'Admin.Notifications.Info').' <>;=#{}',
                    'required' => true
                ),

所以,问题是,如何在产品功能中启用 HTML 编辑器。
我是 PrestaShop 的新手,我在论坛上阅读过,但没有找到关于此实现的帮助。
提前谢谢你。

2018 年 10 月 10 日更新 6:56 (GTM-5)
我修复了 HTML 部分,现在是验证问题,它仍然阻止所有 html 标签...

PrestaShop 在 tpl 文件上使用 HTML 转义:

<td>{$feature.name|escape:'html':'UTF-8'}</td>
<td>{$feature.value|escape:'html':'UTF-8'}</td>

您必须将其更改为显示 HTML(在您的主题上):

<td>{$feature.name}</td>
<td>{$feature.value}</td>

将此添加到您的字段数组:'autoload_rte' => true 这样您就可以为功能输入值激活 TinyMce 编辑器,如果我没记错的话,功能是:initFormFeatureValue(),在同一个函数查找 Tools::safeOutput(Tools::getValue('back', '')); 并在 ); 之前添加 true 检查是否有效。
更新
打开文件夹 classes 中的 FeaturesValue.php,在行 53

中查找
'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),`

替换为:

'value' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 255),

然后在您的 TPL product-details.tpl 中查找:

  {block name='product_features'}
    {if $product.grouped_features}
      <section class="product-features">
        <p class="h6">{l s='Data sheet' d='Shop.Theme.Catalog'}</p>
        <dl class="data-sheet">
          {foreach from=$product.grouped_features item=feature}
            <dt class="name">{$feature.name}</dt>
            <dd class="value">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
          {/foreach}
        </dl>
      </section>
    {/if}
  {/block}

替换为:

{block name='product_features'}
  {if $product.grouped_features}
     <section class="product-features">
        <p class="h6">{l s='Data sheet' d='Shop.Theme.Catalog'}</p>
        <dl class="data-sheet">
          {foreach from=$product.grouped_features item=feature}
             <dt class="name">{$feature.name}</dt>
             <dd class="value">{$feature.value nofilter}</dd>
          {/foreach}
        </dl>
     </section>
  {/if}
{/block}

在此块中,您只需将 {$feature.value|escape:'htmlall'|nl2br nofilter} 更改为 {$feature.value nofilter},就是这样...
我希望它有效,请记住,在产品 edit/new 中添加新功能时,您只能 select 从您拥有的内容中,我的意思是,如果您在编辑产品时想要自定义值特征自定义值的输入仍将在 type text 中,但我希望通过此您对如何更改其余部分有更好的想法。