vendor/shopware/storefront/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.                 {% set isListPrice = price.listPrice.percentage > 0 %}
  43.                 {% set isRegulationPrice = price.regulationPrice != null %}
  44.                 <div class="product-cheapest-price{% if isListPrice and price.regulationPrice.price and not displayFrom %} with-list-price{% endif %}{% if isRegulationPrice and displayFrom %} with-regulation-price{% endif %}">
  45.                     {% if cheapest.unitPrice != real.unitPrice %}
  46.                         <div>{{ "listing.cheapestPriceLabel"|trans|sw_sanitize }}<span class="product-cheapest-price-price"> {{ cheapest.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</span></div>
  47.                     {% endif %}
  48.                 </div>
  49.                 {% if displayFrom %}
  50.                     {{ "listing.listingTextFrom"|trans|sw_sanitize }}
  51.                 {% endif %}
  52.                 <span class="product-price{% if isListPrice and not displayFrom %} with-list-price{% endif %}">
  53.                     {{ price.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  54.                     {% if isListPrice and not displayFrom %}
  55.                         {% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
  56.                         {% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
  57.                         {% set hideStrikeTrough = beforeListPriceSnippetExists or afterListPriceSnippetExists %}
  58.                         <span class="list-price{% if hideStrikeTrough %} list-price-no-line-through{% endif %}">
  59.                             {% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
  60.                             <span class="list-price-price">{{ price.listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
  61.                             {% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
  62.                             <span class="list-price-percentage">{{ "detail.listPricePercentage"|trans({'%price%': price.listPrice.percentage })|sw_sanitize }}</span>
  63.                         </span>
  64.                     {% endif %}
  65.                 </span>
  66.                 {% if isRegulationPrice %}
  67.                     <span class="product-price with-regulation-price">
  68.                         {% if isListPrice %}<br/>{% endif %}<span class="regulation-price">{{ "general.listPricePreviously"|trans({'%price%': price.regulationPrice.price|currency }) }}{{ "general.star"|trans|sw_sanitize }}</span>
  69.                     </span>
  70.                 {% endif %}
  71.             </div>
  72.         {% endblock %}
  73.     </div>
  74. {% endblock %}