{% import "@SyliusShop/Common/Macro/money.html.twig" as money %} {# Valeurs par défaut (pour éviter les erreurs si aucune variante) #} {% set has_discount = false %} {% set price = null %} {% set original_price = null %} {% set applied_promotions = [] %} {% if not product.enabledVariants.empty() %} {% set variant = product|sylius_resolve_variant %} {% if variant is not null %} {% set has_discount = variant|sylius_has_discount({'channel': sylius.channel}) %} {% set price = money.calculatePrice(variant) %} {% set original_price = money.calculate_original_price(variant) %} {% set applied_promotions = variant.getappliedPromotionsForChannel(sylius.channel) %} {% endif %} {% endif %} {% set nonVariantImages = [] %} {% set variantImages = [] %} {% for image in product.images %} {% if image.productVariants|length == 0 %} {% set nonVariantImages = nonVariantImages|merge([image]) %} {% else %} {% set variantImages = variantImages|merge([image]) %} {% endif %} {% endfor %} {% set orderedImages = nonVariantImages|merge(variantImages) %} {% set cardImage = orderedImages|first %} {% set cardImagePath = null %} {% if cardImage %} {% set cardImagePath = cardImage.path|imagine_filter('sylius_shop_product_original') %} {% else %} {% set cardImagePath = '//placehold.it/400x300' %} {% endif %}
{# Badge si promo / réduction #} {% if has_discount %} Promo {% endif %} {# Lien vers la page produit #}
{{ product.name|e }}
{# Bloc d’effet d’animation #}
{# Nom du produit #} {# Prix (incluant logiques de promotion / stock) via ton fragment #}
{% include '@SyliusShop/Product/Box/_price.html.twig' with {'product': product} %}
{# Exemple d’options (taille, couleur, etc.) si tu en as besoin #} {#
+2 colors
#}