简体   繁体   中英

Getting product features into description as smarty - Prestashop 1.7

I have a question about 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. In version 1.6 it was this code:

 {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?

Thank you! :)

In this version, all products features are transferred by array $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.

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:

{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 . And you still should use |escape:'htmlall' - it's very important.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM