[英]Getting product features into description as smarty - Prestashop 1.7
I have a question about Prestashop 1.7.3.0 smarty.我有一个关于 Prestashop 1.7.3.0 smarty 的问题。
I would like to display a product features in product description but I dont know which smarty should I use in new prestashop.我想在产品描述中显示产品功能,但我不知道我应该在新的 prestashop 中使用哪个 smarty。 In version 1.6 it was this code:
在 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}
Does anyone know right solution for Prestashop 1.7?有人知道 Prestashop 1.7 的正确解决方案吗?
Thank you!谢谢! :)
:)
In this version, all products features are transferred by array $product.features.在这个版本中,所有产品特性都通过数组 $product.features 传输。 So you can use it as in the previous version but replace your
from=$features
with from=$product.features
, and also you don't need to use |escape:'htmlall':'UTF-8'
anymore.因此,您可以像在以前的版本中一样使用它,但将您的
from=$features
替换from=$features
from=$product.features
,而且您也不再需要使用|escape:'htmlall':'UTF-8'
。
I see that Alexander made a small mistake, I checked and in prestashop 1.7.3.0 to display product features you should use code similar to below:我看到亚历山大犯了一个小错误,我在 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}
As you can see you must use $product.grouped_features
not just $product.features
.如您所见,您必须使用
$product.grouped_features
而不仅仅是$product.features
。 And you still should use |escape:'htmlall'
- it's very important.你仍然应该使用
|escape:'htmlall'
- 这很重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.