/
quantity.html.twig
107 lines (98 loc) · 6.26 KB
/
quantity.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{% block component_line_item_quantity %}
{% if redirectTo is not defined %}
{% set redirectTo = 'frontend.checkout.cart.page' %}
{% endif %}
{% if formAction is not defined %}
{% set formAction = path('frontend.checkout.line-item.change-quantity', { id: lineItem.id }) %}
{% endif %}
{% if showQuantitySelect is not defined %}
{% set showQuantitySelect = true %}
{% endif %}
{# @var quantityInformation \Shopware\Core\Checkout\Cart\LineItem\QuantityInformation #}
{% set quantityInformation = lineItem.quantityInformation %}
{% if quantityInformation.maxPurchase %}
{% set maxQuantity = quantityInformation.maxPurchase %}
{% else %}
{% set maxQuantity = config('core.cart.maxQuantity') %}
{% endif %}
{% set DOWNLOAD_STATE = constant('Shopware\\Core\\Content\\Product\\State::IS_DOWNLOAD') %}
{% set isDigital = lineItem.states is defined and DOWNLOAD_STATE in lineItem.states and (DOWNLOAD_STATE not in lineItem.states or quantityInformation.maxPurchase === 1) %}
{% block component_line_item_quantity_inner %}
<div class="row line-item-quantity-row">
{% block component_line_item_quantity_label %}
<div class="line-item-quantity-label">
{{ 'checkout.cartHeaderQuantity'|trans|sw_sanitize }}
</div>
{% endblock %}
{% block component_line_item_quantity_select_wrapper %}
<div class="line-item-quantity-select-wrapper">
{% if showQuantitySelect and lineItem.quantityInformation and lineItem.stackable and nestingLevel < 1 %}
{% block component_line_item_quantity_select_form %}
{% set autoSubmitOptions = {
delayChangeEvent: 800,
} %}
<form action="{{ formAction }}"
class="line-item-quantity-container {% if isDigital %}disabled{% endif %}"
method="post"
{% if displayMode == 'default' %}
data-form-auto-submit="true"
data-form-auto-submit-options="{{ autoSubmitOptions|json_encode }}"
{% endif %}
>
{% block component_line_item_quantity_redirect %}
<input type="hidden"
name="redirectTo"
value="{{ redirectTo }}">
<input type="hidden"
name="redirectParameters"
value="{{ redirectParameters }}">
{% endblock %}
{# @deprecated tag:v6.7.0 - Unused variable selectQuantityThreshold will be removed without replacement #}
{% set selectQuantityThreshold = 100 %}
{% block component_line_item_quantity_select %}
{% block component_line_item_quantity_select_input %}
<div class="input-group line-item-quantity-group quantity-selector-group" data-quantity-selector="true">
<button
{% if isDigital %}disabled="disabled"{% endif %}
type="button"
class="btn btn-outline-light btn-minus js-btn-minus"
aria-label="{{ 'component.product.quantitySelect.decrease'|trans|striptags }}"
>
{% sw_icon 'minus' style {size: 'xs'} %}
</button>
<input
{% if isDigital %}disabled="disabled"{% endif %}
type="number"
name="quantity"
class="form-control js-quantity-selector quantity-selector-group-input quantity-input-{{ lineItem.id }} {% if displayMode === 'offcanvas' %} js-offcanvas-cart-change-quantity-number{% endif %}"
min="{{ quantityInformation.minPurchase }}"
max="{{ maxQuantity }}"
step="{{ quantityInformation.purchaseSteps }}"
value="{{ lineItem.quantity }}"
aria-label="{{ 'component.product.quantitySelect.label'|trans|striptags }}"
/>
<button
{% if isDigital %}disabled="disabled"{% endif %}
type="button"
class="btn btn-outline-light btn-plus js-btn-plus"
aria-label="{{ 'component.product.quantitySelect.increase'|trans|striptags }}"
>
{% sw_icon 'plus' style {size: 'xs'} %}
</button>
</div>
{% endblock %}
{% endblock %}
</form>
{% endblock %}
{% else %}
{% block component_line_item_quantity_display %}
<div class="d-flex justify-content-sm-center justify-content-end">
{{ lineItem.quantity }}
</div>
{% endblock %}
{% endif %}
</div>
{% endblock %}
</div>
{% endblock %}
{% endblock %}