File tree 2 files changed +13
-13
lines changed
app/code/Magento/Sales/view/frontend 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 26
26
<ol id="cart-sidebar-reorder" class="product-items product-items-names"
27
27
data-bind="foreach: lastOrderedItems().items">
28
28
<li class="product-item">
29
- <div class="field item choice no-display" data-bind="css: {'no-display': !is_saleable} ">
29
+ <div class="field item choice">
30
30
<label class="label" data-bind="attr: {'for': 'reorder-item-' + id}">
31
31
<span><?= /* @escapeNotVerified */ __ ('Add to Cart ' ) ?> </span>
32
32
</label>
33
33
<div class="control">
34
34
<input type="checkbox" name="order_items[]"
35
- data-bind="attr: {id: 'reorder-item-' + id, value: id}"
36
- title="<?= /* @escapeNotVerified */ __ ('Add to Cart ' ) ?> "
35
+ data-bind="attr: {
36
+ id: 'reorder-item-' + id,
37
+ value: id,
38
+ title: is_saleable ? '<?= /* @escapeNotVerified */ __ ('Add to Cart ' ) ?> ' : '<?= /* @escapeNotVerified */ __ ('Product is not salable. ' ) ?> '
39
+ },
40
+ disable: !is_saleable"
37
41
class="checkbox" data-validate='{"validate-one-checkbox-required-by-name": true}'/>
38
42
</div>
39
43
</div>
46
50
</ol>
47
51
<div id="cart-sidebar-reorder-advice-container"></div>
48
52
<div class="actions-toolbar">
49
- <div class="primary no-display "
50
- data-bind="css: {'no-display': ! lastOrderedItems() .isShowAddToCart} ">
53
+ <div class="primary"
54
+ data-bind="visible: lastOrderedItems.isShowAddToCart">
51
55
<button type="submit" title="<?= /* @escapeNotVerified */ __ ('Add to Cart ' ) ?> " class="action tocart primary">
52
56
<span><?= /* @escapeNotVerified */ __ ('Add to Cart ' ) ?> </span>
53
57
</button>
Original file line number Diff line number Diff line change @@ -12,18 +12,14 @@ define([
12
12
return Component . extend ( {
13
13
/** @inheritdoc */
14
14
initialize : function ( ) {
15
- var isShowAddToCart = false ,
16
- item ;
15
+ var isShowAddToCart ;
17
16
18
17
this . _super ( ) ;
19
18
this . lastOrderedItems = customerData . get ( 'last-ordered-items' ) ;
20
19
21
- for ( item in this . lastOrderedItems . items ) {
22
- if ( item [ 'is_saleable' ] ) {
23
- isShowAddToCart = true ;
24
- break ;
25
- }
26
- }
20
+ isShowAddToCart = _ . some ( this . lastOrderedItems ( ) . items , {
21
+ 'is_saleable' : true
22
+ } ) ;
27
23
28
24
this . lastOrderedItems . isShowAddToCart = isShowAddToCart ;
29
25
}
You can’t perform that action at this time.
0 commit comments