Jump to content

How to display a custom feature value?


Graphics Back Label

Recommended Posts

Goog morning,

 

I work with Prestashop 1.6.1.7 and I'd like display a feature value of a product within the product list (where you see a list of products) below its name.

We sell garments and in the BO I created a custom feature value (the material of garments, like Cashmere for example) and I'd like to display this value below its name on the product list.

I had added this following code to display the feature value on the product.tpl and it works only there.. I think this variable it's not a "global, public" variable (I just play with PHP, I'm not an expert)

{foreach from=$features item=feature}
<tr class="{cycle values="odd,even"}">
{if isset($feature.value)}
<td>{$feature.name|escape:'html':'UTF-8'}</td>
<td>{$feature.value|escape:'html':'UTF-8'}</td>
{/if}
</tr>
{/foreach}
Edited by Graphics Back Label (see edit history)
Link to comment
Share on other sites

Try maybe this as well

{if isset($features) && $features}
 {foreach from=$features item=feature}
  {if $feature.id_feature == ID OF FEATURE HERE}
    <span>{$feature.name|escape:'html':'UTF-8'}</span>: <span>{$feature.value|escape:'html':'UTF-8'}</span>
  {/if}
 {/foreach}
{/if}

Type ID of feature in ID OF HERE, you will have more control.

Edited by hakeryk2 (see edit history)
Link to comment
Share on other sites

  • 2 years later...

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