Jump to content

Quick help with $feature


teralite
 Share

Recommended Posts

Hi!

 

Im trying to get the product features in the product list and has come to a problem.

 

I want to use the name or id of the feature to show a picture instead of the value of the feature.

 

I have done this:

 

{if isset($product.features)}
<div class="features">
{foreach from=$product.features item=feature name=pr_features}

</div>
{/if}

 

and get the array like this:

Array ( [name] => Diameter (mm) [value] => 60 [id_feature] => 1 ) 1Array ( [name] => Dimbar [value] => Ja [id_feature] => 2 ) 1Array ( [name] => Höjd (mm) [value] => 45 [id_feature] => 3 ) 1Array ( [name] => Längd (mm) [value] => 45 [id_feature] => 4 ) 1

 

Is it possible to use the id_feature with an if statement to get the correct value?

 

for example:

 

{if $id_feature == 1}<span id="diameter" title="{$feature.value}mm diameter"></span><span id="diameter_text">{$feature.value}</span> {/if}

 

The problem is that i cant get the function to work, i dont get any result.

 

Anyone that can help me out?

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More