jeanbono Posted December 21, 2020 Posted December 21, 2020 Salut à tous, Je voudrais simplement ajouter une classe CSS sur mes aperçus de produits (miniatures au sens PS) lorsque ceux-ci sont personnalisables. Du coup en regardant le code du product.tpl je vois qu'il utilise le tableau $product.customizations.fields pour savoir si des champs personnalisés existent. Alors j'ai appliqué ce code sur /themes/monthemeactif/templates/catalog/_partials/miniatures/product.tpl {block name='product_miniature_item'} <article class="product-miniature js-product-miniature mb-3{if count($product.customizations.fields)} personnalisable{/if}" data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}"> Mais rien n'y fait malgré vidage de caches la classe n'apparait pas. Serait-possible que PS ne pré-charge pas la variable $product.customizations.fields sur les miniatures mais que sur les pages produit ? Merci d'avance ! Share this post Link to post Share on other sites More sharing options...
jeanbono Posted December 31, 2020 Posted December 31, 2020 Petit up et bonne fêtes à tous Share this post Link to post Share on other sites More sharing options...
Alexandre Carette Posted December 31, 2020 Posted December 31, 2020 Salut {if $product.customizable ==2}ta_class{/if} bonne fêtes a toi , cdt Share this post Link to post Share on other sites More sharing options...
jeanbono Posted December 31, 2020 Posted December 31, 2020 Salut, Top merci ! J'ai juste adapté en {if $product.customizable > 0} Pour prendre en compte aussi le cas où le champ de perso est facultatif (à ce moment là $product.customizable vaut 1) Je le précise pour ceux qui arriveraient sur ce topic. ++ 1 Share this post Link to post 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