{% block component_product_box_price_info %}
{% set purchaseUnit = product.purchaseUnit %}
{% set listingPrice = product.calculatedListingPrice %}
{% set fromPrice = listingPrice.from %}
{% set referncePrice = product.calculatedPrice.referencePrice %}
<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 purchaseUnit and purchaseUnit != 0 %}
<span class="product-unit-label">
{{ "listing.boxUnitLabel"|trans|sw_sanitize }}
</span>
<span class="price-unit-content">
{{ purchaseUnit }} {{ product.unit.translation('name') }}
</span>
{% endif %}
{% endblock %}
{# Item price is based on a reference unit #}
{% block component_product_box_price_reference_unit %}
{% if referncePrice is not null %}
<span class="price-unit-reference">
{% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
({{ "listing.listingTextFrom"|trans|sw_sanitize }} {{ fromPrice.referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ fromPrice.referencePrice.referenceUnit }} {{ fromPrice.referencePrice.unitName }})
{% else %}
({{ referncePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referncePrice.referenceUnit }} {{ referncePrice.unitName }})
{% endif %}
</span>
{% endif %}
{% endblock %}
</p>
{% endblock %}
{% block component_product_box_price %}
{% set listPrice = product.priceRange or product.calculatedPrices.count > 0 ? null : product.calculatedPrice.listPrice %}
{% set advancedPricesFlag = product.calculatedPrices.count > 0 %}
{% if product.calculatedPrices.count < 2 %}
{% set advancedPricesFlag = false %}
{% endif %}
{% if listPrice is null and product.calculatedPrices|length == 1 %}
{% set listPrice = product.calculatedPrices|first.listPrice %}
{% endif %}
{% if advancedPricesFlag and listPrice is null %}
{% block component_product_box_block_list_price_wrapper %}
{% set cheapestPrice = product.calculatedPrices|first %}
{% for calcPrice in product.calculatedPrices %}
{% if cheapestPrice.unitPrice > calcPrice.unitPrice %}
{% set cheapestPrice = calcPrice %}
{% endif %}
{% endfor %}
<span class="product-price product-advanced-list-price-wrapper">
{{ "listing.listingTextFrom"|trans|sw_sanitize }} <b>{{ cheapestPrice.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</b>
</span>
{% endblock %}
{% else %}
<p class="product-price{% if listPrice.percentage > 0 %} with-list-price{% endif %}">
{% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
{{ fromPrice.unitPrice|currency }}
-
{{ listingPrice.to.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
{% elseif product.calculatedPrices|length == 1 %}
{{ product.calculatedPrices.first.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
{% if listPrice.percentage > 0 %}
<span class="list-price{% if "listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0 %} list-price-no-line-through{% endif %}">
{{"listing.beforeListPrice"|trans|trim}} {{ listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} {{"listing.afterListPrice"|trans|trim}}
</span>
{% endif %}
{% else %}
{{ product.calculatedPrice.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
{% if listPrice.percentage > 0 %}
<span class="list-price{% if "listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0 %} list-price-no-line-through{% endif %}">
{{"listing.beforeListPrice"|trans|trim}} {{ listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} {{"listing.afterListPrice"|trans|trim}}
</span>
{% endif %}
{% endif %}
</p>
{% endif %}
{% endblock %}
</div>
{% endblock %}