Jump to content

Smarty - Only display certain features


vezek
 Share

Recommended Posts

Hi

 

I am sure it must very simple but I cannot manage to make it work, I have this table:

 

{if $features}
 <table >
	  <col/>
	  <col />
	  <tbody>
	  {foreach from=$features item=feature}
		  <tr>
			  <th>{$feature.name|escape:'htmlall':'UTF-8'} :</th>
			  <td>{$feature.value|escape:'htmlall':'UTF-8'}</td>
		  </tr>
	  {/foreach}
	  </tbody>
  </table>
  {/if}

 

This loops through all the features but I would like to remove only one feature from the loop. I know the feature's ID but I do not know how to integrate it the code above.

 

Many thanks.

Share this post


Link to post
Share on other sites

Hi.

 

{foreach from=$features item=feature}
{if $feature.id_feature != [iD_OF_FEATURE]}
                         <tr>
                                 <th>{$feature.name|escape:'htmlall':'UTF-8'} :</th>
                                 <td>{$feature.value|escape:'htmlall':'UTF-8'}</td>
                         </tr>
{/if}
                 {/foreach}

 

This should work.

 

Regards.

 

Robin.

 

The CartExpert Team

Share this post


Link to post
Share on other sites

  • 8 months later...

Hi, how can I make this for PS 1.4.8.2 ?

 

I used this, but not:

 

{if isset($product.features)}

{foreach from=$product.features item=feature name=features}

{if $feature.id_feature == 1}

<span>{$feature.name|escape:'htmlall':'UTF-8'}: {$feature.value|escape:'htmlall':'UTF-8'}</span>

{/if}

{/foreach}

{/if}

Share this post


Link to post
Share on other sites

Hi, how can I make this for PS 1.4.8.2 ?

 

I used this, but not:

 

{if isset($product.features)}

{foreach from=$product.features item=feature name=features}

{if $feature.id_feature == 1}

<span>{$feature.name|escape:'htmlall':'UTF-8'}: {$feature.value|escape:'htmlall':'UTF-8'}</span>

{/if}

{/foreach}

{/if}

 

but you want to display only one feature or hide it?

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