custom/plugins/KayloBasicTheme/src/Resources/views/storefront/component/product/card/price-unit.html.twig line 1

Open in your IDE?
  1. {% block component_product_box_price_info %}
  2.     {# @deprecated tag:v6.5.0 - purchaseUnit will be removed, use product.purchaseUnit if needed #}
  3.     {% set purchaseUnit = product.purchaseUnit %}
  4.     {# @deprecated tag:v6.5.0 - listingPrice will be removed without replacement, since it was removed from the product struct #}
  5.     {% set listingPrice = product.calculatedListingPrice %}
  6.     {# @deprecated tag:v6.5.0 - fromPrice will be removed without replacement #}
  7.     {% set fromPrice = listingPrice.from %}
  8.     {% set cheapest = product.calculatedCheapestPrice %}
  9.     {% set real = product.calculatedPrice %}
  10.     {% if product.calculatedPrices.count > 0 %}
  11.         {% set real = product.calculatedPrices.last %}
  12.     {% endif %}
  13.     {% set referencePrice = real.referencePrice %}
  14.     {% set displayFrom = product.calculatedPrices.count > 1 %}
  15.     <div class="product-price-info">
  16.         {% block component_product_box_price_unit %}
  17.             <p class="product-price-unit">
  18.                 {# Price is based on the purchase unit #}
  19.                 {% block component_product_box_price_purchase_unit %}
  20.                     {% if referencePrice and referencePrice.unitName %}
  21.                         <span class="product-unit-label">
  22.                             {{ "listing.boxUnitLabel"|trans|sw_sanitize }}
  23.                         </span>
  24.                         <span class="price-unit-content">
  25.                             {{ referencePrice.purchaseUnit }} {{ referencePrice.unitName }}
  26.                         </span>
  27.                     {% endif %}
  28.                 {% endblock %}
  29.                 {# Item price is based on a reference unit #}
  30.                 {% block component_product_box_price_reference_unit %}
  31.                     {% if referencePrice is not null %}
  32.                         <span class="price-unit-reference">
  33.                             ({{ referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referencePrice.referenceUnit }} {{ referencePrice.unitName }})
  34.                         </span>
  35.                     {% endif %}
  36.                 {% endblock %}
  37.             </p>
  38.         {% endblock %}
  39.         {% block component_product_box_price %}
  40.             <div class="product-price-wrapper">
  41.                 {% set price = real %}
  42.                 <div class="product-cheapest-price">
  43.                     {% if cheapest.unitPrice != real.unitPrice %}
  44.                         <div>{{ "listing.cheapestPriceLabel"|trans|sw_sanitize }}<span class="product-cheapest-price-price"> {{ cheapest.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</span></div>
  45.                     {% endif %}
  46.                 </div>
  47.                 {% if displayFrom %}
  48.                     {{ "listing.listingTextFrom"|trans|sw_sanitize }}
  49.                 {% endif %}
  50.                 {% set isListPrice = price.listPrice.percentage > 0 %}
  51.                 <span class="product-price{% if isListPrice and not displayFrom %} with-list-price{% endif %}">
  52.                     {{ price.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  53.                     {% if isListPrice and not displayFrom %}
  54.                         {% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
  55.                         {% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
  56.                         {% set hideStrikeTrough = beforeListPriceSnippetExists or afterListPriceSnippetExists %}
  57.                         <span class="list-price{% if hideStrikeTrough %} list-price-no-line-through{% endif %}">
  58.                             {% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
  59.                             <span class="list-price-price">{{ price.listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
  60.                             {% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
  61.                             <span class="list-price-percentage">{{ "detail.listPricePercentage"|trans({'%price%': price.listPrice.percentage })|sw_sanitize }}</span>
  62.                         </span>
  63.                     {% endif %}
  64.                 </span>
  65.             </div>
  66.         {% endblock %}
  67.     </div>
  68. {% endblock %}