Search code examples
phphtmlmysqlprestashop

Show product features in cart summary in Prestashop


I am trying to show product features in the cart summary on one page checkout with using below code in shopping-cart-product-line.tpl but giving error.

{foreach from=$product.features item=feature name=features}
{if $feature.id_feature == 9}   
{$features.value|escape:'htmlall':'UTF-8'}
{/if} 
{/foreach}

Do I need to do anything with CartController.php?

Error Notice: Undefined index: value in path/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 89


Solution

  • Try this way

    {assign var="features" value=Product::getFrontFeaturesStatic(Context::getContext()->language->id, $product.id_product)} 
    
    {foreach $features as $feature}
    {if $feature.id_feature == 6}
    <div>{$feature.value|escape:'htmlall':'UTF-8'}</div>
    {/if}
    
    {/foreach}