vendor/shopware/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 referncePrice = product.calculatedPrice.referencePrice %}
  6.     <div class="product-price-info">
  7.         {% block component_product_box_price_unit %}
  8.             <p class="product-price-unit">
  9.                 {# Price is based on the purchase unit #}
  10.                 {% block component_product_box_price_purchase_unit %}
  11.                     {% if purchaseUnit and purchaseUnit != 0 %}
  12.                         <span class="product-unit-label">
  13.                             {{ "listing.boxUnitLabel"|trans|sw_sanitize }}
  14.                         </span>
  15.                         <span class="price-unit-content">
  16.                             {{ purchaseUnit }} {{ product.unit.translation('name') }}
  17.                         </span>
  18.                     {% endif %}
  19.                 {% endblock %}
  20.                 {# Item price is based on a reference unit #}
  21.                 {% block component_product_box_price_reference_unit %}
  22.                     {% if referncePrice is not null %}
  23.                         <span class="price-unit-reference">
  24.                             {% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
  25.                                 ({{ "listing.listingTextFrom"|trans|sw_sanitize }} {{ fromPrice.referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ fromPrice.referencePrice.referenceUnit }}&nbsp;{{ fromPrice.referencePrice.unitName }})
  26.                             {% else %}
  27.                                 ({{ referncePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referncePrice.referenceUnit }} {{ referncePrice.unitName }})
  28.                             {% endif %}
  29.                         </span>
  30.                     {% endif %}
  31.                 {% endblock %}
  32.             </p>
  33.         {% endblock %}
  34.         {% block component_product_box_price %}
  35.             {% set listPrice = product.priceRange or product.calculatedPrices.count > 0 ? null : product.calculatedPrice.listPrice %}
  36.             {% set advancedPricesFlag = product.calculatedPrices.count > 0 %}
  37.             {% if product.calculatedPrices.count < 2 %}
  38.                 {% set advancedPricesFlag = false %}
  39.             {% endif %}
  40.             {% if listPrice is null and product.calculatedPrices|length == 1 %}
  41.                 {% set listPrice = product.calculatedPrices|first.listPrice %}
  42.             {% endif %}
  43.             {% if advancedPricesFlag and listPrice is null %}
  44.                 {% block component_product_box_block_list_price_wrapper %}
  45.                     {% set cheapestPrice = product.calculatedPrices|first %}
  46.                     {% for calcPrice in product.calculatedPrices %}
  47.                         {% if cheapestPrice.unitPrice > calcPrice.unitPrice %}
  48.                             {% set cheapestPrice = calcPrice %}
  49.                         {% endif %}
  50.                     {% endfor %}
  51.                     <span class="product-price product-advanced-list-price-wrapper">
  52.                         {{ "listing.listingTextFrom"|trans|sw_sanitize }} <b>{{ cheapestPrice.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</b>
  53.                     </span>
  54.                 {% endblock %}
  55.             {% else %}
  56.                 <p class="product-price{% if listPrice.percentage > 0 %} with-list-price{% endif %}">
  57.                     {% if (product.priceRange and product.isGrouped) or product.calculatedPrices.count > 1 %}
  58.                         {{ fromPrice.unitPrice|currency }}
  59.                         -
  60.                         {{ listingPrice.to.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  61.                     {% elseif product.calculatedPrices|length == 1 %}
  62.                         {{ product.calculatedPrices.first.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  63.                         {% if listPrice.percentage > 0 %}
  64.                             <span class="list-price{% if "listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0  %} list-price-no-line-through{% endif %}">
  65.                                 {{"listing.beforeListPrice"|trans|trim}} {{ listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} {{"listing.afterListPrice"|trans|trim}}
  66.                             </span>
  67.                         {% endif %}
  68.                     {% else %}
  69.                         {{ product.calculatedPrice.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  70.                             {% if listPrice.percentage > 0 %}
  71.                                 <span class="list-price{% if "listing.beforeListPrice"|trans|length > 0 or "listing.afterListPrice"|trans|length > 0  %} list-price-no-line-through{% endif %}">
  72.                                     {{"listing.beforeListPrice"|trans|trim}} {{ listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} {{"listing.afterListPrice"|trans|trim}}
  73.                                 </span>
  74.                             {% endif %}
  75.                     {% endif %}
  76.                 </p>
  77.             {% endif %}
  78.         {% endblock %}
  79.     </div>
  80. {% endblock %}