custom/plugins/zenitPlatformStratus/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. {# TODO: @zenit check on sw update #}
  3. {# Discount badge with Percentage #}
  4.  {% block component_product_badges_discount %}
  5.      {% set price = product.calculatedPrice %}
  6.      {% if product.calculatedPrices.count > 0 %}
  7.          {% set price = product.calculatedPrices.last %}
  8.      {% endif %}
  9.      {% set listPrice = price.listPrice.percentage > 0 %}
  10.      {% set hasRange = product.calculatedPrices.count > 1 %}
  11.      {% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
  12.      {% if displayParent %}
  13.          {% set displayFromVariants = displayParent and price.unitPrice !== product.calculatedCheapestPrice.unitPrice %}
  14.      {% endif %}
  15.      {% if listPrice and not hasRange and not displayFromVariants %}
  16.          <div class="badge badge-danger badge-discount">
  17.              {# ... @zenit add if statement #}
  18.              {% set pricePercentage = theme_config('zen-product-listing-card-list-price-percentage') ?: 'default' %}
  19.              {% if pricePercentage is same as ('badge-rounded') %}
  20.                  {{ price.listPrice.percentage|round }}
  21.              {% elseif pricePercentage is same as ('badge') %}
  22.                  {{ price.listPrice.percentage }}
  23.              {% endif %}
  24.              <span>&#37;</span>
  25.          </div>
  26.      {% endif %}
  27.  {% endblock %}