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