Jump to content

[SOLVED] Hide features with specific ID in product description PS 1.7


tosR

Recommended Posts

Hello I am trying to find out solution to hide features with specific ID to being showed in browser. 

I have product-details.tpl and there is this code:

{block name='product_features'}
    {if $product.grouped_features}
      <section class="product-features">
        <h3 class="h6">{l s='Data sheet' d='Shop.Theme.Catalog'}</h3>
        <dl class="data-sheet">
          {foreach from=$product.grouped_features item=feature}
            <dt class="name">{$feature.name}</dt>
            <dd class="value">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>	
          {/foreach}
        </dl>
      </section>
    {/if}
  {/block}

And I need to hide for example features with ID 20 and 21. How can I achieve this? I was trying to add {if id_feature==20}display:none;{/if} but it not helped.

 

Thanks for your help

Link to comment
Share on other sites

Just from the top of my head. So it may not be entirely correct:

          {foreach from=$product.grouped_features item=feature}
			{if $feature.id_feature == 20}{continue}{/if}
            <dt class="name">{$feature.name}</dt>
            <dd class="value">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>	
          {/foreach}

 

Link to comment
Share on other sites

Yes, it works very well I used it like this:

 

{block name='product_features'}
    {if $product.grouped_features}
      <section class="product-features">
        <h3 class="h6">{l s='Data sheet' d='Shop.Theme.Catalog'}</h3>
        <dl class="data-sheet">
          {foreach from=$product.grouped_features item=feature}
		  {if $feature.id_feature == 20}{continue}{/if}
		  {if $feature.id_feature == 21}{continue}{/if}
		  {if $feature.id_feature == 22}{continue}{/if}
		  {if $feature.id_feature == 23}{continue}{/if}
            <dt class="name">{$feature.name}</dt>
            <dd class="value">{$feature.value|escape:'htmlall'|nl2br nofilter}</dd>	
          {/foreach}
        </dl>
      </section>
    {/if}
  {/block}

is possible to somehow write it in one row, or needs to be for each feature ID own code like I have it

 

I mean something like this:

{if $feature.id_feature == 20,21,22,23}{continue}{/if}

thanks

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

  • tosR changed the title to [SOLVED] Hide features with specific ID in product description PS 1.7
  • 1 year later...

Hello,

this solution works great thanks.

But if there's only this kind of hidden features ID on a product, the tab features title is shown on the products page.

I would like the features tab title not appeared in this case.

Any idea ?

many thanks

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