Jump to content

Extracting one specific 'feature' for product list page


wobe

Recommended Posts

Hi everyone,

I'm trying to display one specific product feature on my product list (product_list.tpl).
The feature's name is "Taille", with the values "36", "38", "40" and so on....
I found this post, but I can't
seem to figure out how to use it for my case. Already I can't find any ID for my features, just
name and value, and secondly I suppose my problem might be due to integrating the feature
on the product list page as opposed to the product page (where the features display without problem).

This is the code I tried to paste into a new div in my product_list.tpl :

>{if $features}
<!-- product's features -->
</pre>
<ul>
   {foreach from=$features item=feature}
     {if $feature.id|intval eq 8} 
{$feature.name|escape:'htmlall':'UTF-8'} {$feature.value|escape:'htmlall':'UTF-8}
     {/if}
   {/foreach}
</ul>
<br>


...actually not as ul and li, but as a simple paragraph within a div element.
I tried to modify the line {if $feature.id|intval eq 8}, but all my attempts failed...

If anyone could point me in the right direction, that'd be greatly appreciated !!

Link to comment
Share on other sites

  • 4 weeks later...

Ignoring the surrounding HTML this is how I have achieved the result you are looking (just listing the Feature value in my case):

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



Incidentally I have used code like this on the homepage (in featured products block), category pages and on product pages.

If you have any issues let me know.

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...