{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
{% set classe_card = '' %}
{% for taxon in product.taxons %}
{% if taxon.code == 'cadeau' %}
{% set classe_card = 'product-card--gift' %}
{% endif %}
{% endfor %}
{% set productUrl = path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) %}
<div class="ui fluid card product swiper-slide product-card {{ classe_card }}" {{ sylius_test_html_attribute('product') }}>
<a href="{{ productUrl }}#p" class="product-card__image">
{% for attr in product.attributes %}
{% if attr.code == 'AOP' and attr.value == '1' %}
<img src="{{ asset('assets/shop/img/aop.png') }}" alt="APO" class="product-card__badge">
{% endif %}
{% endfor %}
{% for attr in product.attributes %}
{% if attr.code == 'Exclusivite' and attr.value == '1' %}
<img src="{{ asset('assets/shop/img/exclusivite.png') }}" alt="Exclusivite" class="product-card__badge">
{% endif %}
{% endfor %}
{% for attr in product.attributes %}
{% if attr.code == 'IGP' and attr.value == '1' %}
<img src="{{ asset('assets/shop/img/igp.png') }}" alt="IGP" class="product-card__badge">
{% endif %}
{% endfor %}
{% if product.imagesByType('thumbnail') is not empty %}
{% set path = product.imagesByType('thumbnail').first.path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
{% elseif product.images.first %}
{% set path = product.images.first.path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
{% else %}
{% set path = '//placehold.it/200x200' %}
{% endif %}
<img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ product.name }}" class="ui bordered image" />
</a>
<a href="{{ productUrl }}#p" class="product-card__content" {{ sylius_test_html_attribute('product-content') }}>
<h2 href="{{ productUrl }}#p" class="header sylius-product-name product-card__name h4" {{ sylius_test_html_attribute('product-name', product.name) }}>{{ product.name }}</h2>
<p href="{{ productUrl }}#p" class="product-card__description">
{{ product.shortDescription | raw }}
</p>
{% if not product.variants.empty() %}
{% set variant = product|sylius_resolve_variant %}
{% set price = money.calculatePrice(product|sylius_resolve_variant) %}
{% for attr in product.attributes %}
{% if attr.code == 'BASE_PRICE' %}
{% set price = money.convertAndFormat(attr.value) %}
{% endif %}
{% endfor %}
<div class="product-card__prices-block">
<div class="sylius-product-price product-card__price" {{ sylius_test_html_attribute('product-price') }}>
{% if product.variants|length > 1 %}
<em>{{ 'sylius.ui.apartirde'|trans }}</em>
{% endif %}
{{ price }}</div>
{% set hasDiscount = variant|sylius_has_discount({'channel': sylius.channel}) %}
<span class="product-details__prices product-details__prices--old" id="product-original-price" {{ sylius_test_html_attribute('product-original-price', money.calculateOriginalPrice(variant)) }}>
{% if hasDiscount %}
<del>{{ money.calculateOriginalPrice(variant) }}</del>
{% endif %}
</span>
{#<div class="sylius-product-price product-card__price" {{ sylius_test_html_attribute('product-price') }}>{{ money.calculatePrice(product|sylius_resolve_variant) }}</div>#}
</div>
{#<em>{{ variant.shortname }}</em>#}
<div class="button button--secondary button--small product-card__button">{{ 'sylius.ui.view_more'|trans }}</div>
{% endif %}
</a>
</div>