Skip to content

Commit f92176b

Browse files
committed
MAGETWO-39058: Items in Cart block is NOT automatically expanded on the Payment Step
1 parent 3db1f23 commit f92176b

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/summary/cart-items.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
/*global define*/
77
define(
88
[
9+
'ko',
910
'Magento_Checkout/js/model/totals',
10-
'uiComponent'
11+
'uiComponent',
12+
'Magento_Checkout/js/model/step-navigator',
13+
'Magento_Checkout/js/model/quote'
1114
],
12-
function (totals, Component) {
13-
"use strict";
15+
function (ko, totals, Component, stepNavigator, quote) {
16+
'use strict';
1417
return Component.extend({
1518
defaults: {
1619
template: 'Magento_Checkout/summary/cart-items'
@@ -19,6 +22,9 @@ define(
1922
getItems: totals.getItems(),
2023
getItemsQty: function() {
2124
return parseInt(this.totals.items_qty) || 0;
25+
},
26+
isItemsBlockExpanded: function () {
27+
return quote.isVirtual() || stepNavigator.isProcessed('shipping');
2228
}
2329
});
2430
}

app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<div class="block items-in-cart" data-bind="mageInit: {'collapsible':{'openedState': 'active', 'active': 'true'}}">
7+
<!-- ko ifnot: isItemsBlockExpanded() -->
8+
<div class="block items-in-cart" data-bind="mageInit: {'collapsible':{'openedState': 'active'}}">
89
<div class="title" data-role="title">
910
<strong role="heading"><span data-bind="text: getItemsQty()"></span>
1011
<!-- ko text: $t('Items in cart') --><!-- /ko -->
@@ -13,16 +14,41 @@
1314
<div class="content minicart-items" data-role="content">
1415
<div class="minicart-items-wrapper overflowed">
1516
<ol class="minicart-items">
16-
<!-- ko foreach: getItems -->
17+
<!-- ko foreach: getItems -->
1718
<li class="product-item">
1819
<div class="product">
19-
<!-- ko foreach: $parent.elems() -->
20+
<!-- ko foreach: $parent.elems() -->
2021
<!-- ko template: getTemplate() --><!-- /ko -->
21-
<!-- /ko -->
22+
<!-- /ko -->
2223
</div>
2324
</li>
24-
<!-- /ko -->
25+
<!-- /ko -->
2526
</ol>
2627
</div>
2728
</div>
2829
</div>
30+
<!-- /ko -->
31+
<!-- ko if: isItemsBlockExpanded() -->
32+
<div class="block items-in-cart" data-bind="mageInit: {'collapsible':{'openedState': 'active', 'active': true}}">
33+
<div class="title" data-role="title">
34+
<strong role="heading"><span data-bind="text: getItemsQty()"></span>
35+
<!-- ko text: $t('Items in cart') --><!-- /ko -->
36+
</strong>
37+
</div>
38+
<div class="content minicart-items" data-role="content">
39+
<div class="minicart-items-wrapper overflowed">
40+
<ol class="minicart-items">
41+
<!-- ko foreach: getItems -->
42+
<li class="product-item">
43+
<div class="product">
44+
<!-- ko foreach: $parent.elems() -->
45+
<!-- ko template: getTemplate() --><!-- /ko -->
46+
<!-- /ko -->
47+
</div>
48+
</li>
49+
<!-- /ko -->
50+
</ol>
51+
</div>
52+
</div>
53+
</div>
54+
<!-- /ko -->

0 commit comments

Comments
 (0)