Bonjour,
voici trois exemple pour ne pas afficher en doublon les marques :
Exemple 1
{loop name="triemarque" type="brand"}
{assign var='titleBrand' value=$TITLE}
{loop name="les-brand-produits" type="product" brand=$ID category={$smarty.get.category_id} limit="1"}
<a href="" id="brand-{$BRAND_ID}" class="tagBrand">{$titleBrand}</a>
{/loop}
{/loop}
<hr/>
Exemple 2
{$listebrands=[]}
{loop name="les-brand-produits" type="product" category={$smarty.get.category_id}}
{loop name="triemarque" type="brand" product=$ID}
{if !isset($listebrands[$ID])}
<a href="" id="brand-{$ID}" class="tagBrand">{$TITLE}</a>
{$listebrands[$ID]=true}
{/if}
{/loop}
{/loop}
<hr/>
Exemple 3
{$brands=[]}
{loop name="les-brand-produits" type="product" category={$smarty.get.category_id}}
{loop name="triemarque" type="brand" product=$ID}
{capture 'rowBrand'}
<a href="" id="brand-{$ID}" class="tagBrand">{$TITLE}</a>
{/capture}
{$brands[$ID]=$smarty.capture.rowBrand}
{/loop}
{/loop}
{foreach from=$brands key=k item=row}
{$row nofilter}
{/foreach}
Pour cette exemple 3, possibilité de faire $brands[$TITLE] et de rajouter un tri avant le foreach pour avoir la liste dans l'ordre alphabétique.
Bonne journée.
Last edited by CoolWaa (08-02-2016 12:47:11)