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