Anissneo Posted July 25, 2017 Share Posted July 25, 2017 Bonjour à tous, J'ai utilisé le code proposé ici et ça fonctionne parfaitement. Par contre dans ce code <ul class="productcats"> {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} {if $cat.id_category!=2} <li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li> {/if} {/foreach} </ul> Je souhaiterai exclure plusieurs catégories. J'ai essayé {if $cat.id_category!=2 || $cat.id_category!=3 || $cat.id_category!=4} et ça ne fonctionne pas.quelqu'un pour m'aider? Merci d'avance Link to comment Share on other sites More sharing options...
Matt K. Posted July 26, 2017 Share Posted July 26, 2017 Salut ! Je pense qu'il faut plutôt faire : {if $cat.id_category!=2 && $cat.id_category!=3 && $cat.id_category!=4} 1 Link to comment Share on other sites More sharing options...
Anissneo Posted July 26, 2017 Author Share Posted July 26, 2017 (edited) Salut ! Je pense qu'il faut plutôt faire : {if $cat.id_category!=2 && $cat.id_category!=3 && $cat.id_category!=4} Impeccable C'est bête mais j'ai passé 2 heures dessus. Merci Matt K. Edited July 26, 2017 by Anissneo (see edit history) Link to comment Share on other sites More sharing options...
Anissneo Posted July 26, 2017 Author Share Posted July 26, 2017 (edited) Par contre, sais-tu comment faire pour customiser la liste des catégories. En réalité, la plupart des produits appartiennent à plusieurs catégories et sous-catégories, et je souhaiterai si possible customiser la liste (comme dans le sitemap par ex : catégories et sous catégories). Merci encore Edited July 26, 2017 by Anissneo (see edit history) Link to comment Share on other sites More sharing options...
Matt K. Posted July 26, 2017 Share Posted July 26, 2017 De rien. Par contre c'est plus compliqué pour avoir la hiérarchie. ^^ ça va être à toi de récupérer les catégories, de les ordonner en fonction de leur parent et ensuite de les afficher avec un style personnalisé. Malheureusement, j'ai pas de solution simple à te donner maintenant. :/ Peut-être quelqu'un d'autre aura une piste ? 1 Link to comment Share on other sites More sharing options...
Norben Posted November 9, 2020 Share Posted November 9, 2020 Bonjour, Pour ce bout de code, c'est possible d'afficher que les noms de catégories du dernier niveau en faisant qq modifs ? <ul class="productcats"> {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} {if $cat.id_category!=2} <li><a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a></li> {/if} {/foreach} </ul> Merci d'avance. 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