{% block component_product_box_price_info %}
{% set purchaseUnit = product.purchaseUnit %}
{% set listingPrice = product.calculatedListingPrice %}
{% set fromPrice = listingPrice.from %}
{% set cheapest = product.calculatedCheapestPrice %}
{% set real = product.calculatedPrice %}
{% if product.calculatedPrices.count > 0 %}
{% set real = product.calculatedPrices.last %}
{% endif %}
{% set referencePrice = real.referencePrice %}
{% set displayFrom = product.calculatedPrices.count > 1 %}
<div class="product-price-info">
{% block component_product_box_price_unit %}
<p class="product-price-unit">
{# Price is based on the purchase unit #}
{% block component_product_box_price_purchase_unit %}
{% if referencePrice and referencePrice.unitName %}
<span class="product-unit-label">
{{ "listing.boxUnitLabel"|trans|sw_sanitize }}
</span>
<span class="price-unit-content">
{{ referencePrice.purchaseUnit }} {{ referencePrice.unitName }}
</span>
{% endif %}
{% endblock %}
{# Item price is based on a reference unit #}
{% block component_product_box_price_reference_unit %}
{% if referencePrice is not null %}
<span class="price-unit-reference">
({{ referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referencePrice.referenceUnit }} {{ referencePrice.unitName }})
</span>
{% endif %}
{% endblock %}
</p>
{% endblock %}
{% block component_product_box_price %}
<div class="product-price-wrapper">
{% set price = real %}
<div class="product-cheapest-price">
{% if cheapest.unitPrice != real.unitPrice %}
<div>{{ "listing.cheapestPriceLabel"|trans|sw_sanitize }}<span class="product-cheapest-price-price"> {{ cheapest.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</span></div>
{% endif %}
</div>
{% if displayFrom %}
{{ "listing.listingTextFrom"|trans|sw_sanitize }}
{% endif %}
{% set isListPrice = price.listPrice.percentage > 0 %}
<span class="product-price{% if isListPrice and not displayFrom %} with-list-price{% endif %}">
{{ price.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
{% if isListPrice and not displayFrom %}
{% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
{% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
{% set hideStrikeTrough = beforeListPriceSnippetExists or afterListPriceSnippetExists %}
<span class="list-price{% if hideStrikeTrough %} list-price-no-line-through{% endif %}">
{% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
<span class="list-price-price">{{ price.listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
{% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
<span class="list-price-percentage">{{ "detail.listPricePercentage"|trans({'%price%': price.listPrice.percentage })|sw_sanitize }}</span>
</span>
{% endif %}
</span>
</div>
{% endblock %}
</div>
{% endblock %}