custom/plugins/theme/src/Resources/views/storefront/component/product/card/badges.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/badges.html.twig' %}
  2. {% block component_product_badges_discount %}
  3.     {% if product.available == false %}
  4.         <div class="badge badge-info badge-soldout">
  5.             <span>{{"listing.boxLabelSoldout"|trans|sw_sanitize}}</span>
  6.         </div>
  7.     {% endif %}
  8.     {% set badgeExtension = product.getExtension("doncarneProductBadge").all()|first %}
  9.     {% if badgeExtension %}
  10.         {% if badgeExtension.media %}
  11.             <div class="badge" style="background:{{badgeExtension.colorHexCode}};width:auto;height:auto;">
  12.                 <img style="height:auto;width:100%;max-width:92px;object-fit:contain;" src="{{badgeExtension.media.url}}" alt="{{badgeExtension.media.alt}}">
  13.             </div>
  14.         {% else %}
  15.             <div class="badge" style="background:{{badgeExtension.colorHexCode}}">
  16.                 <span>{{ badgeExtension.translated.name }}</span>
  17.             </div>
  18.         {% endif %}
  19.     {% endif %}
  20.     {% set price = product.calculatedPrice %}
  21.     {% if product.calculatedPrices.count > 0 %}
  22.         {% set price = product.calculatedPrices.last %}
  23.     {% endif %}
  24.     {% set listPrice = price.listPrice.percentage > 0 %}
  25.     {% set hasRange = product.calculatedPrices.count > 1 %}
  26.     {# DONCARNE-104: *DO NOT* show discount badge for beef club customers #}
  27.     {% if not (context.customer and context.customer.groupId == doncarneConfig.beefClubCustomerGroup) %}
  28.         {% if listPrice and not hasRange and not badgeExtension %}
  29.             <div class="badge badge-danger badge-discount">
  30.                 <span>{{"listing.boxLabelDiscount"|trans|sw_sanitize}}</span>
  31.             </div>
  32.         {% endif %}
  33.     {% endif %}
  34. {% endblock %}