themes/BootstrapChildTheme/SyliusShopBundle/views/Product/Box/_content.html.twig line 1

Open in your IDE?
  1. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}
  2. {% set variant = product|sylius_resolve_variant %}
  3. {% set hasDiscount = variant ? variant|sylius_has_discount({'channel': sylius.channel}) : null %}
  4. {% set tagAttributes = product.attributesByLocale(app.request.locale, app.request.defaultLocale, sylius_base_locale)|filter(attribute => attribute.code == 'tag1' or attribute.code == 'tag2')|sort_by('attribute.position') %}
  5. {% set discount = variant ? money.calculateDiscount(variant, {'channel': sylius.channel, 'zone': sylius.channel.defaultTaxZone}) : null %}
  6. {% set tier_prices = variant ? variant.getTierPricesForChannel(sylius.channel, sylius.customer) : null %}
  7. {% set enabledVariants = product.enabledVariants %}
  8. <div class="product{% if h_100 is defined and h_100 %} h-100{% endif %}" {{ sylius_test_html_attribute('product') }}>
  9.     <div class="product-image-wrap">
  10.         <a class="product-image-link" href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}">
  11.             {% if hasDiscount %}
  12.                 <span class="labels-wrap">
  13.                     <span class="discount-content">
  14.                         <span class="label">-{{ discount }}%</span>
  15.                     </span>
  16.                 </span>
  17.             {% endif %}
  18.             {% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product, 'class': 'card-img-top'} %}
  19.             {% if product.labels %}
  20.                 <span class="labels-bottom-wrap">
  21.                     <span class="labels-content">
  22.                         {% for label in product.labels %}
  23.                             {% if label.code != 'top_all_categories' %}
  24.                                 <span class="label {{ label.code -}}">{{- label.name -}}</span>
  25.                             {% endif %}
  26.                         {% endfor %}
  27.                     </span>
  28.                 </span>
  29.             {% endif %}
  30.         </a>
  31.     </div>
  32.     <div class="product-content">
  33.         <h6 class="product-name fw-medium" {{ sylius_test_html_attribute('product-name', product.name) }}>
  34.             <a class="link-heading stretched-link" href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}">{{ product.name }}</a>
  35.         </h6>
  36.         <div class="product-description">
  37.             {% if product.shortDescription %}
  38.                 {{ product.shortDescription|striptags|unescape|u.truncate(100, '...', false) }}
  39.             {% else %}
  40.                 {{ product.description|striptags|unescape|u.truncate(100, '...', false) }}
  41.             {% endif %}
  42.         </div>
  43.     </div>
  44.     <div class="product-bottom">
  45.         {% if not product.enabledVariants.empty() %}
  46.             <div class="product-price-wrap">
  47.                 {% if product.minPrice %}
  48.                     <span class="text-nowrap">
  49.                         <span class="product-price-from cfs-8">{{ 'app.ui.price_from'|trans }}</span>
  50.                         <span class="product-price min-price cfs-5" {{ sylius_test_html_attribute('product-price') }}>{{ money.convertAndFormatSpecial(product.minPrice, {'divisor': 100000, 'scale': 3 }) }}</span>
  51.                     </span>
  52.                     {% if product.maxPrice %}
  53.                         <span class="text-nowrap">
  54.                             <span class="product-price-from cfs-8">{{ 'app.ui.price_to'|trans }}</span>
  55.                             <span class="product-price min-price cfs-5" {{ sylius_test_html_attribute('product-price') }}>{{ money.convertAndFormatSpecial(product.maxPrice, {'divisor': 100000, 'scale': 3 }) }}</span>
  56.                         </span>
  57.                     {% endif %}
  58.                 {% elseif enabledVariants|length == 1 %}
  59.                     {% if hasDiscount %}<span class="product-original-price cfs-8">{{ money.calculateOriginalPriceWithoutTax(variant, {'divisor': 100000, 'scale': 3, 'channel': sylius.channel, 'zone': sylius.channel.defaultTaxZone}) }}</span>{% endif %}
  60.                     <span class="product-price cfs-5" {{ sylius_test_html_attribute('product-price') }}>{{ money.calculatePrice(product|sylius_resolve_variant) }}</span>
  61.                 {% endif %}
  62.             </div>
  63.         {% endif %}
  64.         {% if product.minQuantity %}
  65.             <div class="product-min-quantity cfs-9">{{ 'app.product_box.min_qty'|trans({ '%qty%': product.minQuantity }) }}</div>
  66.         {% endif %}
  67.     </div>
  68. </div>