Jump to content

[solved]List categories in cart


Recommended Posts

Hi,

I try to figure out to display or check features in cart (Prestashop 1.7.3). But $feature.value in code below works in all product views, but not in cart:

This works fine in product.tpl, product-listgrid.tpl a.s.o.

{foreach from=$product.features item=feature}
      {if $feature.value == 'foobar'}
      <span class="foobar"><img src="foobarimg.png" alt="Foo Bar" /></span>
      {/if}
{/foreach}

But this works not in cart:

{foreach from=$cart.products item=product}
      Debug1:{$product.name} // works
      {foreach from=$product.features item=feature}
           Debug2: {$feature.value} // right count of "Debug2" but no feature name
           {if $feature.value == 'foobar'}
                            {$foobar = 1}
                            Debug: {$foobar} // 0
           {/if}
      {/foreach}
{/foreach}

How do I have to do this? The count of features is ok, but no value accessible?

Thx

Andy

 

Link to comment
Share on other sites

ok, figured out that this works:

{foreach from=$cart.products item=product}
   {$product.name}
       {foreach from=$product.features item=feature}
             {if $feature.id_feature_value == 123}
                 {$foobar = 1}
             {/if}
       {/foreach}
{/foreach}

 

but little confused, that value doesn´t work

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...