tosR Posted January 31, 2021 Share Posted January 31, 2021 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 More sharing options...
musicmaster Posted February 1, 2021 Share Posted February 1, 2021 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 More sharing options...
tosR Posted February 1, 2021 Author Share Posted February 1, 2021 (edited) 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 February 1, 2021 by tosR (see edit history) Link to comment Share on other sites More sharing options...
Sycomor Posted February 8, 2022 Share Posted February 8, 2022 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 More sharing options...
Sycomor Posted February 14, 2022 Share Posted February 14, 2022 Hello Many thanks for this advice. It works perfectly. Great! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now