Php 将产品功能描述为smarty-Prestashop 1.7

Php 将产品功能描述为smarty-Prestashop 1.7,php,html,prestashop,smarty,prestashop-1.7,Php,Html,Prestashop,Smarty,Prestashop 1.7,我有一个关于Prestashop 1.7.3.0 smarty的问题 我想在产品描述中显示产品功能,但我不知道在新的prestashop中应该使用哪个smarty。在版本1.6中,代码如下: {foreach from=$features item=feature} {if $feature.id_feature = 1} <tr> <td>{$feature.value|escape:'htmlall':'UTF-8'}

我有一个关于Prestashop 1.7.3.0 smarty的问题

我想在产品描述中显示产品功能,但我不知道在新的prestashop中应该使用哪个smarty。在版本1.6中,代码如下:

 {foreach from=$features item=feature}
     {if $feature.id_feature = 1}
        <tr>
           <td>{$feature.value|escape:'htmlall':'UTF-8'}</td>
           <td>{$feature.id|escape:'htmlall':'UTF-8'}</td>
        </tr>
     {/if}
 {/foreach}
{foreach from=$features item=feature}
{如果$feature.id_feature=1}
{$feature.value |转义:'htmlall':'UTF-8'}
{$feature.id | escape:'htmlall':'UTF-8'}
{/if}
{/foreach}
有人知道Prestashop 1.7的正确解决方案吗


谢谢!:)

在此版本中,所有产品功能都通过数组$product.features传输。因此,您可以像在以前的版本中一样使用它,但将您的
from=$features
替换为
from=$product.features
,而且您也不需要再使用
;escape:'htmlall':'UTF-8'

我看到Alexander犯了一个小错误,我选中并在prestashop 1.7.3.0中显示产品功能,您应该使用类似以下代码:

{foreach from=$product.grouped_features item=feature}
    <dt class="name">{$feature.name}</dt>
    <dd class="value">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>
{/foreach}
{foreach from=$product.grouped\u features item=feature}
{$feature.name}
{$feature.value | escape:'htmlall'| nl2br nofilter}
{/foreach}
如您所见,您必须使用
$product.features
而不仅仅是
$product.features
。您仍然应该使用
| escape:'htmlall'
-这非常重要