templates/bundles/SyliusShopBundle/Product/Box/_content.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. {% set classe_card = '' %}
  3. {% for taxon in  product.taxons %}
  4.     {% if taxon.code == 'cadeau'  %}
  5.         {% set classe_card = 'product-card--gift' %}
  6.     {% endif %}
  7. {% endfor %}
  8. {% set productUrl = path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale})  %}
  9. <div class="ui fluid card product swiper-slide product-card {{ classe_card }}" {{ sylius_test_html_attribute('product') }}>
  10.     <a href="{{ productUrl }}#p" class="product-card__image">
  11.         {% for attr in product.attributes %}
  12.             {% if attr.code == 'AOP' and attr.value == '1' %}
  13.                 <img src="{{ asset('assets/shop/img/aop.png') }}" alt="APO" class="product-card__badge">
  14.             {% endif %}
  15.         {% endfor %}
  16.         {% for attr in product.attributes %}
  17.             {% if attr.code == 'Exclusivite' and attr.value == '1' %}
  18.                 <img src="{{ asset('assets/shop/img/exclusivite.png') }}" alt="Exclusivite" class="product-card__badge">
  19.             {% endif %}
  20.         {% endfor %}
  21.         {% for attr in product.attributes %}
  22.             {% if attr.code == 'IGP' and attr.value == '1' %}
  23.                 <img src="{{ asset('assets/shop/img/igp.png') }}" alt="IGP" class="product-card__badge">
  24.             {% endif %}
  25.         {% endfor %}
  26.         {% if product.imagesByType('thumbnail') is not empty %}
  27.             {% set path = product.imagesByType('thumbnail').first.path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
  28.         {% elseif product.images.first %}
  29.             {% set path = product.images.first.path|imagine_filter(filter|default('sylius_shop_product_large_thumbnail')) %}
  30.         {% else %}
  31.             {% set path = '//placehold.it/200x200' %}
  32.         {% endif %}
  33.         <img src="{{ path }}" {{ sylius_test_html_attribute('main-image') }} alt="{{ product.name }}" class="ui bordered image" />
  34.     </a>
  35.     <a href="{{ productUrl }}#p" class="product-card__content" {{ sylius_test_html_attribute('product-content') }}>
  36.         <h2 href="{{ productUrl }}#p" class="header sylius-product-name product-card__name h4" {{ sylius_test_html_attribute('product-name', product.name) }}>{{ product.name }}</h2>
  37.         <p href="{{ productUrl }}#p" class="product-card__description">
  38.             {{ product.shortDescription | raw }}
  39.         </p>
  40.         {% if not product.variants.empty() %}
  41.             {% set variant = product|sylius_resolve_variant %}
  42.             {% set price = money.calculatePrice(product|sylius_resolve_variant) %}
  43.             {% for attr in  product.attributes %}
  44.                 {% if attr.code == 'BASE_PRICE' %}
  45.                     {% set price = money.convertAndFormat(attr.value) %}
  46.                 {% endif %}
  47.             {% endfor %}
  48.             <div class="product-card__prices-block">
  49.                 <div class="sylius-product-price product-card__price" {{ sylius_test_html_attribute('product-price') }}>
  50.                 {% if product.variants|length > 1 %}
  51.                 <em>{{ 'sylius.ui.apartirde'|trans }}</em>
  52.                 {% endif %}
  53.                 {{ price }}</div>
  54.                 {% set hasDiscount = variant|sylius_has_discount({'channel': sylius.channel}) %}
  55.                 <span class="product-details__prices product-details__prices--old" id="product-original-price" {{ sylius_test_html_attribute('product-original-price', money.calculateOriginalPrice(variant)) }}>
  56.                     {% if hasDiscount %}
  57.                         <del>{{ money.calculateOriginalPrice(variant) }}</del>
  58.                     {% endif %}
  59.                 </span>
  60.                 {#<div class="sylius-product-price product-card__price" {{ sylius_test_html_attribute('product-price') }}>{{ money.calculatePrice(product|sylius_resolve_variant) }}</div>#}
  61.             </div>
  62.             {#<em>{{ variant.shortname }}</em>#}
  63.             <div class="button button--secondary button--small product-card__button">{{ 'sylius.ui.view_more'|trans }}</div>
  64.         {% endif %}
  65.     </a>
  66. </div>