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. {# @deprecated tag:v6.5.0 - purchaseUnit will be removed, use product.purchaseUnit if needed #}
  3. {% set purchaseUnit = product.purchaseUnit %}
  4. {# @deprecated tag:v6.5.0 - listingPrice will be removed without replacement, since it was removed from the product struct #}
  5. {% set listingPrice = product.calculatedListingPrice %}
  6. {# @deprecated tag:v6.5.0 - fromPrice will be removed without replacement #}
  7. {% set fromPrice = listingPrice.from %}
  8. {% set cheapest = product.calculatedCheapestPrice %}
  9. {% set real = product.calculatedPrice %}
  10. {% if product.calculatedPrices.count > 0 %}
  11. {% set real = product.calculatedPrices.last %}
  12. {% endif %}
  13. {% set referencePrice = real.referencePrice %}
  14. {% set displayFrom = product.calculatedPrices.count > 1 %}
  15. {% set displayParent = product.variantListingConfig.displayParent and product.parentId === null %}
  16. {% if displayParent %}
  17. {% set displayFromVariants = displayParent and real.unitPrice !== cheapest.unitPrice %}
  18. {% set real = cheapest %}
  19. {% endif %}
  20. <div class="product-price-info">
  21. {% block component_product_box_price_unit %}
  22. <p class="product-price-unit">
  23. {# Price is based on the purchase unit #}
  24. {% block component_product_box_price_purchase_unit %}
  25. {% if referencePrice and referencePrice.unitName %}
  26. <span class="product-unit-label">
  27. {{ "listing.boxUnitLabel"|trans|sw_sanitize }}
  28. </span>
  29. <span class="price-unit-content">
  30. {{ referencePrice.purchaseUnit }} {{ referencePrice.unitName }}
  31. </span>
  32. {% endif %}
  33. {% endblock %}
  34. {# Item price is based on a reference unit #}
  35. {% block component_product_box_price_reference_unit %}
  36. {% if referencePrice is not null %}
  37. <span class="price-unit-reference">
  38. ({{ referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referencePrice.referenceUnit }} {{ referencePrice.unitName }})
  39. </span>
  40. {% endif %}
  41. {% endblock %}
  42. </p>
  43. {% endblock %}
  44. {% block component_product_box_price %}
  45. <div class="product-price-wrapper">
  46. {% set price = real %}
  47. {% set isListPrice = price.listPrice.percentage > 0 %}
  48. {% set isRegulationPrice = price.regulationPrice != null %}
  49. <div class="product-cheapest-price{% if isListPrice and isRegulationPrice and not displayFrom and not displayFromVariants %} with-list-price{% endif %}{% if isRegulationPrice and not displayFrom and displayFromVariants %} with-regulation-price{% endif %}{% if displayFrom and isRegulationPrice %} with-from-price{% endif %}">
  50. {% if cheapest.unitPrice != real.unitPrice %}
  51. <div>{{ "listing.cheapestPriceLabel"|trans|sw_sanitize }}<span class="product-cheapest-price-price"> {{ cheapest.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}</span></div>
  52. {% endif %}
  53. </div>
  54. {% if displayFrom or (displayParent and displayFromVariants) %}
  55. {{ "listing.listingTextFrom"|trans|sw_sanitize }}
  56. {% endif %}
  57. <span class="product-price{% if isListPrice and not displayFrom and not displayFromVariants %} with-list-price{% endif %}">
  58. {{ price.unitPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  59. {% if isListPrice and not displayFrom and not displayFromVariants %}
  60. {% set afterListPriceSnippetExists = "listing.afterListPrice"|trans|length > 0 %}
  61. {% set beforeListPriceSnippetExists = "listing.beforeListPrice"|trans|length > 0 %}
  62. {% set hideStrikeTrough = beforeListPriceSnippetExists or afterListPriceSnippetExists %}
  63. <span class="list-price{% if hideStrikeTrough %} list-price-no-line-through{% endif %}">
  64. {% if beforeListPriceSnippetExists %}{{ "listing.beforeListPrice"|trans|trim|sw_sanitize }}{% endif %}
  65. <span class="list-price-price">{{ price.listPrice.price|currency }}{{ "general.star"|trans|sw_sanitize }}</span>
  66. {% if afterListPriceSnippetExists %}{{ "listing.afterListPrice"|trans|trim|sw_sanitize }}{% endif %}
  67. <span class="list-price-percentage">{{ "detail.listPricePercentage"|trans({'%price%': price.listPrice.percentage })|sw_sanitize }}</span>
  68. </span>
  69. {% endif %}
  70. </span>
  71. {% if isRegulationPrice %}
  72. <span class="product-price with-regulation-price">
  73. {% if isListPrice %}<br/>{% endif %}<span class="regulation-price">{{ "general.listPricePreviously"|trans({'%price%': price.regulationPrice.price|currency }) }}{{ "general.star"|trans|sw_sanitize }}</span>
  74. </span>
  75. {% endif %}
  76. </div>
  77. {% endblock %}
  78. </div>
  79. {% endblock %}