vendor/shopware/storefront/Resources/views/storefront/component/checkout/offcanvas-item.html.twig line 238

Open in your IDE?
  1. {# @deprecated tag:v6.5.0 - Template `offcanvas-item.html.twig` is deprecated. Use `storefront/component/line-item/line-item.html.twig` instead. #}
  2. {% block component_offcanvas_cart_item_inner %}
  3.     {% set PRODUCT_LINE_ITEM_TYPE = constant('Shopware\\Core\\Checkout\\Cart\\LineItem\\LineItem::PRODUCT_LINE_ITEM_TYPE') %}
  4.     {% set DISCOUNT_LINE_ITEM_TYPE = constant('Shopware\\Core\\Checkout\\Cart\\LineItem\\LineItem::DISCOUNT_LINE_ITEM') %}
  5.     {% set price = lineItem.price %}
  6.     {% set isDiscount = (not lineItem.good and price.totalPrice <= 0) || lineItem.type == DISCOUNT_LINE_ITEM_TYPE %}
  7.     {% set isNested = lineItem.children.count > 0 %}
  8.     {% set label = lineItem.label|trans|sw_sanitize %}
  9.     {% set label = label !== '' ? label : lineItem.label %}
  10.     {% set referencedId = lineItem.referencedId %}
  11.     {% set type = lineItem.type %}
  12.     {% set quantity = lineItem.quantity %}
  13.     {% set id = lineItem.id %}
  14.     {% set childrenTemplate = '@Storefront/storefront/component/checkout/offcanvas-item-children.html.twig' %}
  15.     {# @deprecated tag:v6.5.0 - var will be removed with no replacement #}
  16.     {% set cartItemClasses = '' %}
  17.     {% block component_offcanvas_cart_item_container %}
  18.         <div class="cart-item cart-item-{{ type }}{% if isDiscount %} is-discount{% endif %}{{ cartItemClasses }} js-cart-item">
  19.             <div class="row cart-item-row">
  20.                 {% block component_offcanvas_product_image %}
  21.                     <div class="col-auto">
  22.                         {% block component_offcanvas_product_image_inner %}
  23.                             <div class="cart-item-img">
  24.                                 {% if isDiscount %}
  25.                                     <div class="cart-item-discount-icon">
  26.                                         {% sw_icon 'marketing' style {
  27.                                             'color': 'success'
  28.                                         } %}
  29.                                     </div>
  30.                                 {% elseif isNested %}
  31.                                     <div class="cart-item-nested-icon">
  32.                                         {% sw_icon 'bag-product' style {
  33.                                             'color': 'light'
  34.                                         } %}
  35.                                     </div>
  36.                                 {% else %}
  37.                                     <a href="{{ seoUrl('frontend.detail.page', {'productId': referencedId}) }}"
  38.                                        class="cart-item-img-link"
  39.                                        title="{{ label }}">
  40.                                         {% if lineItem.cover.url %}
  41.                                             {% sw_thumbnails 'cart-item-img-thumbnails' with {
  42.                                                 media: lineItem.cover,
  43.                                                 sizes: {
  44.                                                     'default': '100px'
  45.                                                 },
  46.                                                 attributes: {
  47.                                                     'class': 'img-fluid cart-item-img-source',
  48.                                                     'alt': label,
  49.                                                     'title': label
  50.                                                 }
  51.                                             } %}
  52.                                         {% else %}
  53.                                             {% sw_icon 'placeholder' style {
  54.                                                 'size': 'fluid'
  55.                                             } %}
  56.                                         {% endif %}
  57.                                     </a>
  58.                                 {% endif %}
  59.                             </div>
  60.                         {% endblock %}
  61.                     </div>
  62.                 {% endblock %}
  63.                 {% block component_offcanvas_product_details %}
  64.                     <div class="col-7 cart-item-details">
  65.                         {% block component_offcanvas_product_details_inner %}
  66.                             <div class="cart-item-details-container">
  67.                                 {% block component_offcanvas_product_label %}
  68.                                     <div class="cart-item-details">
  69.                                         {% if type == PRODUCT_LINE_ITEM_TYPE %}
  70.                                             <a href="{{ seoUrl('frontend.detail.page', {'productId': referencedId}) }}"
  71.                                                class="cart-item-label"
  72.                                                title="{{ label }}">
  73.                                                 {{ quantity }}{{ "checkout.quantityTimes"|trans|sw_sanitize }} {{ label|u.truncate(60, '...', false)|raw }}
  74.                                             </a>
  75.                                         {% else %}
  76.                                             <div class="cart-item-label">
  77.                                                 {{ label|u.truncate(60, '...', false)|raw }}
  78.                                             </div>
  79.                                         {% endif  %}
  80.                                     </div>
  81.                                 {% endblock %}
  82.                                 {% block cart_item_variant_characteristics %}
  83.                                     <div class="cart-item-characteristics">
  84.                                         {% for option in lineItem.payload.options %}
  85.                                             {{ option.group }}:
  86.                                             <span class="cart-item-characteristics-option">{{ option.option }}</span>
  87.                                             {% if lineItem.payload.options|last != option %}
  88.                                                 {{ " | " }}
  89.                                             {% endif %}
  90.                                         {% endfor %}
  91.                                     </div>
  92.                                 {% endblock %}
  93.                                 {% block component_offcanvas_product_details_features %}
  94.                                     {% if lineItem.type == PRODUCT_LINE_ITEM_TYPE and lineItem.payload.features is not null %}
  95.                                         {% sw_include '@Storefront/storefront/component/product/feature/list.html.twig' with {
  96.                                             'features': lineItem.payload.features
  97.                                         } %}
  98.                                     {% endif %}
  99.                                 {% endblock %}
  100.                                 {% block component_offcanvas_product_quantity_price %}
  101.                                     <div class="cart-quantity-price">
  102.                                         {% block component_offcanvas_product_quantity %}
  103.                                             <div class="cart-item-quantity">
  104.                                                 {% block component_offcanvas_product_quantity_form %}
  105.                                                     {% set showQuantitySelect = (not lineItem.states is defined or 'is-download' not in lineItem.states or ('is-download' in lineItem.states and lineItem.quantityInformation.maxPurchase !== 1)) %}
  106.                                                     {% if lineItem.quantityInformation and lineItem.stackable and showQuantitySelect %}
  107.                                                         <form action="{{ path('frontend.checkout.line-item.change-quantity', {'id': id}) }}"
  108.                                                               class="cart-item-quantity-container"
  109.                                                               method="post">
  110.                                                             {# @deprecated tag:v6.5.0 - Block component_offcanvas_product_quantity_form_csrf will be removed. #}
  111.                                                             {% block component_offcanvas_product_quantity_form_csrf %}
  112.                                                                 {{ sw_csrf('frontend.checkout.line-item.change-quantity') }}
  113.                                                             {% endblock %}
  114.                                                             {% block component_offcanvas_product_quantity_form_redirect %}
  115.                                                                 <input type="hidden"
  116.                                                                        name="redirectTo"
  117.                                                                        value="frontend.cart.offcanvas"/>
  118.                                                             {% endblock %}
  119.                                                             {% set quantityInformation = lineItem.quantityInformation %}
  120.                                                             {% if quantityInformation.maxPurchase %}
  121.                                                                 {% set maxQuantity = quantityInformation.maxPurchase %}
  122.                                                             {% else %}
  123.                                                                 {% set maxQuantity = config('core.cart.maxQuantity') %}
  124.                                                             {% endif %}
  125.                                                             {% set selectQuantityThreshold = 100 %}
  126.                                                             {% block component_offcanvas_product_buy_quantity %}
  127.                                                                 {% if (maxQuantity - quantityInformation.minPurchase) / quantityInformation.purchaseSteps > selectQuantityThreshold %}
  128.                                                                     {% block component_offcanvas_product_buy_quantity_input %}
  129.                                                                         <input
  130.                                                                             type="number"
  131.                                                                             name="quantity"
  132.                                                                             class="form-control js-offcanvas-cart-change-quantity-number"
  133.                                                                             min="{{ quantityInformation.minPurchase }}"
  134.                                                                             max="{{ maxQuantity }}"
  135.                                                                             step="{{ quantityInformation.purchaseSteps }}"
  136.                                                                             value="{{ quantity }}"
  137.                                                                         />
  138.                                                                     {% endblock %}
  139.                                                                 {% else %}
  140.                                                                     {% block component_offcanvas_product_buy_quantity_select %}
  141.                                                                         <select name="quantity" class="{{ formSelectClass }} quantity-select-{{ id }} js-offcanvas-cart-change-quantity">
  142.                                                                             {% for quantityItem in range(quantityInformation.minPurchase, maxQuantity, quantityInformation.purchaseSteps) %}
  143.                                                                                 <option value="{{ quantityItem }}"
  144.                                                                                     {% if quantityItem == quantity %} selected="selected"{% endif %}>
  145.                                                                                     {{ quantityItem }}
  146.                                                                                 </option>
  147.                                                                             {% endfor %}
  148.                                                                         </select>
  149.                                                                     {% endblock %}
  150.                                                                 {% endif %}
  151.                                                             {% endblock %}
  152.                                                         </form>
  153.                                                     {% endif %}
  154.                                                 {% endblock %}
  155.                                             </div>
  156.                                         {% endblock %}
  157.                                         {% block component_offcanvas_product_total_price %}
  158.                                             <div class="cart-item-price">
  159.                                                 {# Shipping costs discounts always have a price of 0, which might be confusing, therefore we do not show those #}
  160.                                                 {% if lineItem.payload.discountScope != 'delivery' %}
  161.                                                     {{ price.totalPrice|currency }}{{ "general.star"|trans|sw_sanitize }}
  162.                                                 {% endif %}
  163.                                                 {% set referencePrice = price.referencePrice %}
  164.                                                 {% if referencePrice is not null %}
  165.                                                     <small class="cart-item-reference-price">
  166.                                                         ({{ referencePrice.price|currency }}{{ "general.star"|trans|sw_sanitize }} / {{ referencePrice.referenceUnit }}&nbsp;{{ referencePrice.unitName }})
  167.                                                     </small>
  168.                                                 {% endif %}
  169.                                             </div>
  170.                                         {% endblock %}
  171.                                     </div>
  172.                                 {% endblock %}
  173.                             </div>
  174.                         {% endblock %}
  175.                     </div>
  176.                 {% endblock %}
  177.                 {% block component_offcanvas_product_remove %}
  178.                     <div class="cart-item-remove">
  179.                         {% block component_offcanvas_product_remove_form %}
  180.                             {% if lineItem.removable %}
  181.                                 <form action="{{ path('frontend.checkout.line-item.delete', {'id': id}) }}"
  182.                                       class="cart-item-remove js-offcanvas-cart-remove-product"
  183.                                       method="post">
  184.                                     {# @deprecated tag:v6.5.0 - Block component_offcanvas_product_remove_form_csrf will be removed. #}
  185.                                     {% block component_offcanvas_product_remove_form_csrf %}
  186.                                         {{ sw_csrf('frontend.checkout.line-item.delete') }}
  187.                                     {% endblock %}
  188.                                     {% block component_offcanvas_product_remove_redirect %}
  189.                                         <input type="hidden"
  190.                                                name="redirectTo"
  191.                                                value="frontend.cart.offcanvas"/>
  192.                                     {% endblock %}
  193.                                     {% block component_offcanvas_product_remove_submit %}
  194.                                         <button type="submit"
  195.                                                 title="{{ "checkout.removeLineItem"|trans|striptags }}"
  196.                                                 data-product-id="{{ lineItem.id }}"
  197.                                                 class="btn btn-light cart-item-remove-button">
  198.                                             {% sw_icon 'x' style { 'size': 'sm' } %}
  199.                                         </button>
  200.                                     {% endblock %}
  201.                                 </form>
  202.                             {% endif %}
  203.                         {% endblock %}
  204.                     </div>
  205.                 {% endblock %}
  206.                 {% block component_offcanvas_children %}
  207.                     {% if isNested %}
  208.                         {# @deprecated tag:v6.5.0 - block will be removed, use `component_offcanvas_item_children` in `@Storefront/storefront/component/checkout/offcanvas-item-children.html.twig` instead #}
  209.                         {% block component_offcanvas_cart_item_children %}
  210.                             {% sw_include childrenTemplate %}
  211.                         {% endblock %}
  212.                     {% endif %}
  213.                 {% endblock %}
  214.             </div>
  215.         </div>
  216.     {% endblock %}
  217.     {# @deprecated tag:v6.5.0 - block will be removed #}
  218.     {% block component_offcanvas_cart_item_child %}{% endblock %}
  219. {% endblock %}