Sasni Posted September 24, 2021 Share Posted September 24, 2021 (edited) Hi, I'm writing a module in which I display products related to a specific feature. It looks something like this: in this case I have 2 related products (these are batteries) assigned to my product X with different capacities. another example which is more complicated as I have 32 products related to different colors and sizes (2 sizes + 16 colors) I would like to combine the same values so that they do not duplicate each other. e.g: can you help me how to do it? {foreach from=$accessories item=accessory name=accessories_list} {assign var='accessoryLink' value=$link->getProductLink($accessory.id_product, $accessory.link_rewrite, $accessory.category)} {if $accessory.features} {foreach from=$accessory.features item=feature} {if $feature.id_feature == $id_cechy1 && isset($feature.value)} <a href="{$accessoryLink|escape:'htmlall':'UTF-8'}" title="{$accessory.name|escape:'htmlall':'UTF-8'}" class="variant2 product_image"> <li class="btn btn-default"> {if $show_img == 1} <img src="{$link->getImageLink($accessory.link_rewrite, $accessory.id_image, 'home_default')|escape:'html'}" alt="{$accessory.name|escape:'htmlall':'UTF-8'}" style="height:40px; float:left;" /> {/if} <span class="editable" style="margin: 5px;"> {$feature.value|escape:'htmlall':'UTF-8'} </span> <div class="price"> {if $show_price == 1} {number_format($accessory.price, 2, ',', '')} {/if} </div> </li> </a> {/if} {/foreach} {/if} {/foreach} Edited September 24, 2021 by Sasni update (see edit history) 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