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

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/product/card/price-unit.html.twig' %}
  2. {% block component_product_box_price_info %}
  3.     {# @deprecated tag:v6.5.0 - purchaseUnit will be removed, use product.purchaseUnit if needed #}
  4.     {% set purchaseUnit = product.purchaseUnit %}
  5.     {# @deprecated tag:v6.5.0 - listingPrice will be removed without replacement, since it was removed from the product struct #}
  6.     {% set listingPrice = product.calculatedListingPrice %}
  7.     {# @deprecated tag:v6.5.0 - fromPrice will be removed without replacement #}
  8.     {% set fromPrice = listingPrice.from %}
  9.     {% set cheapest = product.calculatedCheapestPrice %}
  10.     {% set real = product.calculatedPrice %}
  11.     {% if product.calculatedPrices.count > 0 %}
  12.         {% set real = product.calculatedPrices.last %}
  13.     {% endif %}
  14.     {% set referencePrice = real.referencePrice %}
  15.     {% set displayFrom = product.calculatedPrices.count > 1 %}
  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 }} / {{ 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.             {# Custom switch, this is made for Shop The Look products. As Shop #}
  42.             {% if product.calculatedPrice %}
  43.                 {# Original prices, default shopware #}
  44.                 {% set price = real %}
  45.                 {% set isListPrice = price.listPrice.percentage > 0 %}
  46.                 {% set unitPrice = price.unitPrice %}
  47.                 {% set listPrice = price.listPrice.price %}
  48.             {% else %}
  49.                 {# Custom prices, for products that are included by Shop The Look #}
  50.                 {% set price = product.price.elements|first %}
  51.                 {% set isListPrice = price.gross < price.listPrice.gross %}
  52.                 {% set unitPrice = price.gross %}
  53.                 {% set listPrice = price.listPrice.gross %}
  54.             {% endif %}
  55.             {% if displayFrom %}
  56.                 {{ "listing.listingTextFrom"|trans|sw_sanitize }}
  57.             {% endif %}
  58.             {% if isListPrice and not displayFrom %}
  59.                 {% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
  60.                 {% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
  61.                 {% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
  62.                 <span class="list-price original-price text-xs line-through mr-1 md:mr-2">
  63.                     {{ listPrice|number_format(2) }}
  64.                 </span>
  65.                 {% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
  66.             {% endif %}
  67.             <span class="product-price current-price inline-block text-xs{% if isListPrice and not displayFrom %} sale-price text-red-500 font-bold{% endif %}">
  68.                 {{ unitPrice }}
  69.             </span>
  70.         </div>
  71.     {% endblock %}
  72. {% endblock %}