custom/plugins/AcrisPromotionCS/src/Resources/views/storefront/page/checkout/checkout-item.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/checkout/checkout-item.html.twig' %}
  2. {% block page_checkout_item %}
  3.     {% set allDiscounts = [] %}
  4.     {% set lineItems = [] %}
  5.     {% if page.cart.lineItems is defined %}
  6.         {% set lineItems = page.cart.lineItems %}
  7.     {% elseif page.order.lineItems is defined %}
  8.         {% set lineItems = page.order.lineItems %}
  9.     {% endif %}
  10.     {% if lineItems %}
  11.         {% for item in lineItems %}
  12.             {% if item.type is same as ("promotion") and item.payload.discountDisplay is same as ("positionBased") %}
  13.                 {% if item.payload.composition is defined %}
  14.                     {% for discount in item.payload.composition %}
  15.                         {% if (lineItem.identifier and discount.id == lineItem.identifier) or discount.id == lineItem.id %}
  16.                             {% set allDiscounts = allDiscounts|merge([discount|merge([item])]) %}
  17.                         {% endif %}
  18.                     {% endfor %}
  19.                 {% endif %}
  20.             {% endif %}
  21.         {% endfor %}
  22.     {% endif %}
  23.     {{ parent() }}
  24. {% endblock %}
  25. {% block page_checkout_item_container %}
  26.     {% if isDiscount is same as (true) and lineItem.payload.discountDisplay is same as ("positionBased") and isAcrisDiscountPositionBased is not defined %}
  27.         {# hide general discount #}
  28.     {% else %}
  29.         {% if allDiscounts %}
  30.             <div class="cart-item-has-discount-position-based">
  31.                 {{ parent() }}
  32.             </div>
  33.             {% block page_checkout_item_discounts %}
  34.                 {% for item in allDiscounts %}
  35.                     {% set lineItem = item[0] %}
  36.                     {% block page_checkout_item_discount %}
  37.                         {% if lineItem and lineItem.payload.discountDisplay is same as ("positionBased") %}
  38.                             {% set discountIncludeFile = '@Storefront/storefront/page/checkout/checkout-item.html.twig' %}
  39.                             {% block page_checkout_item_discount_include %}
  40.                                 {% sw_include discountIncludeFile with {
  41.                                     'lineItem': lineItem,
  42.                                     'isAcrisDiscountPositionBased': true,
  43.                                     'priceDiscount': item.discount
  44.                                 } %}
  45.                             {% endblock %}
  46.                         {% endif %}
  47.                     {% endblock %}
  48.                 {% endfor %}
  49.             {% endblock %}
  50.         {% else %}
  51.             {{ parent() }}
  52.         {% endif %}
  53.     {% endif %}
  54. {% endblock %}
  55. {% block page_checkout_item_quantity_label %}
  56.     {% if isAcrisDiscountPositionBased %}{% else %}{{ parent() }}{% endif %}
  57. {% endblock %}
  58. {% block page_checkout_item_total_price_inner %}
  59.     {% if isAcrisDiscountPositionBased is same as (true) and priceDiscount %}- {{ priceDiscount|currency }}{% block page_checkout_item_total_price_tax_symbol %}{{ parent() }}{% endblock %}{% else %}{{ parent() }}{% endif %}
  60. {% endblock %}