custom/plugins/AlexMax/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. {# ThemeWare: Set theme variables #}
  3. {% set twtProductBadgesDiscountBadgeShow = theme_config('twt-product-badges-discount-badge-show') %}
  4. {% set twtProductBadgesDiscountBadgeType = theme_config('twt-product-badges-discount-badge-type') %}
  5. {% set twtProductBadgesNewBadgeShow = theme_config('twt-product-badges-new-badge-show') %}
  6. {% set twtProductBadgesShippingFreeBadgeShow = theme_config('twt-product-badges-shipping-free-badge-show') %}
  7. {% set twtProductBadgesSoldBadgeShow = theme_config('twt-product-badges-sold-badge-show') %}
  8. {% set twtProductBadgesStockBadgeShow = theme_config('twt-product-badges-stock-badge-show') %}
  9. {% set twtProductBadgesTopsellerBadgeShow = theme_config('twt-product-badges-topseller-badge-show') %}
  10. {% set twtProductBadgesDiscountBadgeCompatibility = theme_config('twt-product-badges-discount-badge-compatibility') %}
  11. {% set twtProductBadgesTopsellerBadgeCompatibility = theme_config('twt-product-badges-topseller-badge-compatibility') %}
  12. {% set twtProductBadgesNewBadgeCompatibility = theme_config('twt-product-badges-new-badge-compatibility') %}
  13. {% block component_product_badges_discount %}
  14.     {% if twtProductBadgesStockBadgeShow == 2 %}
  15.         {% sw_include '@Storefront/storefront/themeware/includes/twt-badge-stock-include.html.twig' ignore missing with {
  16.             product: product,
  17.             type: 'listing'
  18.         } %}
  19.     {% endif %}
  20.     {% if twtProductBadgesSoldBadgeShow == 2 %}
  21.         {% sw_include '@Storefront/storefront/themeware/includes/twt-badge-sold-include.html.twig' ignore missing with {
  22.             product: product,
  23.             type: 'listing'
  24.         } %}
  25.     {% endif %}
  26.     {% if twtProductBadgesShippingFreeBadgeShow == 2 %}
  27.         {% sw_include '@Storefront/storefront/themeware/includes/twt-badge-shipping-free-include.html.twig' ignore missing with {
  28.             product: product,
  29.             type: 'listing'
  30.         } %}
  31.     {% endif %}
  32.     {% if zeobvVisibleDiscountConfig.showDiscountsOnListingPages
  33.         or shopware.config.ZeobvVisibleDiscounts.config.showDiscountsOnListingPages %}
  34.         {% set listPrice = product.calculatedPrice.listPrice %}
  35.         {% if listPrice.price and listPrice.price < product.calculatedPrice.unitPrice %}
  36.             {% set discount = (100 - ((product.calculatedListingPrice.from.unitPrice/listPrice.price) * 100))|round(2, 'floor') %}
  37.         {% elseif listPrice.price and product.calculatedPrice.unitPrice %}
  38.             {% set discount = (100 - ((product.calculatedPrice.unitPrice/listPrice.price) * 100))|round(2, 'floor') %}
  39.         {% endif %}
  40.         {% set badgeConfig = product.extension('zeobvVisibleDiscountInfo').badgeConfig %}
  41.         {% if zeobvVisibleDiscountConfig.showDiscountBadgeOnListingPages %}
  42.             {% if badgeConfig|length > 0 %}
  43.                 {% for badge in badgeConfig %}
  44.                     {% set label = badge.label ? badge.label : (discount >= 1 ? discount|round(zeobvVisibleDiscountConfig.percentagePrecision) ~ " %" : false) %}
  45.                     <div>
  46.                         <div class="badge badge-danger badge-discount"{% if badge.color %} style="background-color: {{ badge.color }}"{% endif %}>
  47.                             <span>{{ label }}</span>
  48.                         </div>
  49.                     </div>
  50.                 {% endfor %}
  51.             {% elseif discount >= 1 %}
  52.                 <div class="badge badge-danger badge-discount">
  53.                     <span>{{ discount|round(zeobvVisibleDiscountConfig.percentagePrecision) }} &#37;</span>
  54.                 </div>
  55.             {% endif %}
  56.         {% endif %}
  57.     {% else %}
  58.         {{ parent() }}
  59.     {% endif %}
  60. {% endblock %}