custom/plugins/WynTheme/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.   <div class="product-price-info">
  17.     {% block component_product_box_price_unit %}
  18.       {% if (referencePrice and referencePrice.unitName) or referencePrice is not null %}
  19.         <p class="product-price-unit">
  20.           {# Price is based on the purchase unit #}
  21.           {% block component_product_box_price_purchase_unit %}
  22.             {% if referencePrice and referencePrice.unitName %}
  23.               <span class="product-unit-label">
  24.                 {{ "listing.boxUnitLabel"|trans|sw_sanitize }}
  25.               </span>
  26.               <span class="price-unit-content">
  27.                 {{ referencePrice.purchaseUnit }} {{ referencePrice.unitName }}
  28.               </span>
  29.             {% endif %}
  30.           {% endblock %}
  31.           {# Item price is based on a reference unit #}
  32.           {% block component_product_box_price_reference_unit %}
  33.             {% if referencePrice is not null %}
  34.               <span class="price-unit-reference">
  35.                 ({{ referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referencePrice.referenceUnit }} {{ referencePrice.unitName }})
  36.               </span>
  37.             {% endif %}
  38.           {% endblock %}
  39.         </p>
  40.       {% endif %}
  41.     {% endblock %}
  42.     {% block component_product_box_price %}
  43.       {% set price = real %}
  44.       {% set isListPrice = price.listPrice.percentage > 0 %}
  45.       <div class="product-price-wrapper{% if isListPrice and not displayFrom %} with-list-price{% endif %}">
  46.         {% if cheapest.unitPrice != real.unitPrice %}
  47.           <div class="product-cheapest-price">
  48.             <div>{{ "listing.cheapestPriceLabel"|trans|sw_sanitize }}<span
  49.                 class="product-cheapest-price-price"> {{ cheapest.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
  50.             </div>
  51.           </div>
  52.         {% endif %}
  53.         {% if displayFrom %}
  54.           {{ "listing.listingTextFrom"|trans|sw_sanitize }}
  55.         {% endif %}
  56.         <span class="product-price">
  57.           {{ price.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  58.           {% if isListPrice and not displayFrom %}
  59.             {% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
  60.             {% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
  61.             {% set hideStrikeTrough = beforeListPriceSnippetExists or afterListPriceSnippetExists %}
  62.             <span class="list-price{% if hideStrikeTrough %} list-price-no-line-through{% endif %}">
  63.               {% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
  64.               <span class="list-price-price">{{ price.listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
  65.               {% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
  66.               <span class="list-price-percentage">
  67.                 {{ "detail.listPricePercentage"|trans({'%price%': price.listPrice.percentage })|sw_sanitize }}
  68.               </span>
  69.             </span>
  70.           {% endif %}
  71.         </span>
  72.       </div>
  73.     {% endblock %}
  74.   </div>
  75. {% endblock %}