Skip to content

Commit 5e0bb4a

Browse files
author
Oleksii Korshenko
authored
MAGETWO-85297: 8410: Custom Checkout Step and Shipping Step are Highlighted and Combined upon Checkout page load #975
2 parents 558c8e8 + c1eb806 commit 5e0bb4a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ define([
6666
* @param {*} sortOrder
6767
*/
6868
registerStep: function (code, alias, title, isVisible, navigate, sortOrder) {
69-
var hash;
69+
var hash, active;
7070

7171
if ($.inArray(code, this.validCodes) !== -1) {
7272
throw new DOMException('Step code [' + code + '] already registered in step navigator');
@@ -87,6 +87,12 @@ define([
8787
navigate: navigate,
8888
sortOrder: sortOrder
8989
});
90+
active = this.getActiveItemIndex();
91+
steps.each(function (elem, index) {
92+
if (active !== index) {
93+
elem.isVisible(false);
94+
}
95+
});
9096
this.stepCodes.push(code);
9197
hash = window.location.hash.replace('#', '');
9298

@@ -111,10 +117,14 @@ define([
111117
getActiveItemIndex: function () {
112118
var activeIndex = 0;
113119

114-
steps.sort(this.sortItems).forEach(function (element, index) {
120+
steps.sort(this.sortItems).some(function (element, index) {
115121
if (element.isVisible()) {
116122
activeIndex = index;
123+
124+
return true;
117125
}
126+
127+
return false;
118128
});
119129

120130
return activeIndex;

0 commit comments

Comments
 (0)