custom/plugins/fourtwosixBuyByQmUnit/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_container %}
  3.     {% set productUnitAkeneoKey = page.cart.data.elements["product-"~ lineItem.id].unit.translated.customFields["akeneo_key"] %}
  4.     {% set productPurchaseUnit = page.cart.data.elements["product-"~ lineItem.id].purchaseUnit %}
  5.     {% set enableUnitConversion = productUnitAkeneoKey !== "set" and  productUnitAkeneoKey !== "box" and productPurchaseUnit !== 1.0 %}
  6.     {% block page_checkout_item_quantity_number %}
  7.         {% if controllerAction == "finishPage" %}
  8.             {% if enableUnitConversion %}
  9.                 <div class="d-flex justify-content-end cart-item-quantity">
  10.                     {{ lineItem.price.referencePrice.purchaseUnit * lineItem.quantity }}
  11.             </div>
  12.             {% else %}
  13.                 {{ parent() }}
  14.             {% endif %}
  15.         {% endif %}
  16.     {% endblock %}
  17.     {% if true and page.cart.data.elements["product-"~ lineItem.id].unit.translated.name == null %}
  18.         {{ parent() }}
  19.     {% else %}
  20.         <div class="cart-item cart-item-{{ lineItem.type }}{% if isDiscount %} is-discount{% endif %}{{ cartItemClasses }} fourtwosix-qm-unit" data-buybyqmunit-plugin="true">
  21.             <div class="row cart-item-row">
  22.                 {% block page_checkout_item_info %}
  23.                     {{ parent() }}
  24.                 {% endblock %}
  25.                 {% block page_checkout_item_quantity_qm %}
  26.                     <div class="col-12 col-sm-4 col-md-4 cart-item-quantity">
  27.                         {% if lineItem.quantityInformation and lineItem.stackable and not isChild %}
  28.                             <form action="{{ path('frontend.checkout.line-item.change-quantity', {'id': lineItem.id}) }}" class="cart-item-quantity-container cartForm" method="post" data-form-auto-submit="true">
  29.                                 {{ sw_csrf('frontend.checkout.line-item.change-quantity') }}
  30.                                 {% if activeRoute == "frontend.checkout.cart.page" %}
  31.                                     <input type="hidden" name="redirectTo" value="frontend.checkout.cart.page">
  32.                                 {% elseif activeRoute == "frontend.checkout.confirm.page" %}
  33.                                     <input type="hidden" name="redirectTo" value="frontend.checkout.confirm.page">
  34.                                 {% endif %}
  35.                                 {% set quantityUnit = page.cart.data.elements["product-"~ lineItem.id].purchaseUnit %}
  36.                                 {% set quantityPack = page.cart.data.elements["product-"~ lineItem.id].referenceUnit %}
  37.                                 {% set minPurchase = page.cart.data.elements["product-"~ lineItem.id].minPurchase %}
  38.                                 {% set purchaseSteps = page.cart.data.elements["product-"~ lineItem.id].purchaseSteps %}
  39.                                 {% set availableStock = lineItem.payload.isCloseout ? lineItem.quantityInformation.maxPurchase : config('core.cart.maxQuantity') %}
  40.                                 {% sw_include '@Storefront/storefront/component/product/card/price-qm-unit.html.twig' with {
  41.                                     'isCloseout': lineItem.payload.isCloseout,
  42.                                     'stock': availableStock,
  43.                                     'priceUnit': lineItem.price.unitPrice,
  44.                                     'sellingUnit': quantityUnit * lineItem.quantity,
  45.                                     'packUnit': lineItem.quantity,
  46.                                     'quantityInputName': "quantity",
  47.                                     'quantityInputClasses': 'quantity-select',
  48.                                     'translatedUnitName' : lineItem.price.referencePrice.unitName,
  49.                                     'minPurchase': minPurchase,
  50.                                     'purchaseSteps': purchaseSteps
  51.                                 } %}
  52.                             </form>
  53.                         {% endif %}
  54.                     </div>
  55.                 {% endblock %}
  56.                 {% block page_checkout_item_total_price_qm %}
  57.                     <div class="col-12 col-sm-4 col-md-2 cart-item-total-price">
  58.                         <div class="d-flex flex-column align-items-end h-fit">
  59.                             {% block page_checkout_item_unit_price_wrapper %}
  60.                                 {% if not isDiscount %}
  61.                                     {% block page_checkout_item_unit_price_label %}
  62.                                         <div class="cart-item-unit-price-label">
  63.                                             {{ "checkout.cartHeaderUnitPrice"|trans|sw_sanitize }}
  64.                                         </div>
  65.                                     {% endblock %}
  66.                                     {% block page_checkout_item_unit_price_inner %}
  67.                                         {{ lineItem.price.unitPrice|currency }}
  68.                                         {% block page_checkout_item_unit_price_tax_symbol %}
  69.                                             {{ "general.star"|trans|sw_sanitize }}
  70.                                         {% endblock %}
  71.                                     {% endblock %}
  72.                                 {% endif %}
  73.                             {% endblock %}
  74.                         </div>
  75.                         <div class="mt-md-2 text-right">
  76.                             {% block page_checkout_item_total_price_wrapper %}
  77.                                 {% block page_checkout_item_total_price_label %}
  78.                                     <div class="cart-item-total-price-label fts-qm">
  79.                                         {{ "checkout.cartHeaderTotalPrice"|trans|sw_sanitize }}
  80.                                     </div>
  81.                                 {% endblock %}
  82.                                 {% block page_checkout_item_total_price_inner %}
  83.                                 {# Shipping costs discounts always have a price of 0, which might be confusing, therefore we do not show those #}
  84.                                 {% if lineItem.payload.discountScope != 'delivery' %}
  85.                                     <b class="totalPrice">{{ lineItem.price.totalPrice|currency }}</b>
  86.                                     {% block page_checkout_item_total_price_tax_symbol %}
  87.                                         {{ "general.star"|trans|sw_sanitize }}
  88.                                     {% endblock %}
  89.                                 {% endif %}
  90.                             {% endblock %}
  91.                             {% endblock %}
  92.                         </div>
  93.                     </div>
  94.                 {% endblock %}
  95.                 {% block page_checkout_item_remove %}
  96.                     {{ parent() }}
  97.                 {% endblock %}
  98.                 {% block page_checkout_item_children_template %}
  99.                     {{ parent() }}
  100.                 {% endblock %}
  101.             </div>
  102.         </div>
  103.     {% endif %}
  104. {% endblock %}