Skip to content
Snippets Groups Projects
Commit 5e0bb4ad authored by Oleksii Korshenko's avatar Oleksii Korshenko Committed by GitHub
Browse files

MAGETWO-85297: 8410: Custom Checkout Step and Shipping Step are Highlighted...

MAGETWO-85297: 8410: Custom Checkout Step and Shipping Step are Highlighted and Combined upon Checkout page load #975
parents 558c8e84 c1eb8062
Branches
No related merge requests found
...@@ -66,7 +66,7 @@ define([ ...@@ -66,7 +66,7 @@ define([
* @param {*} sortOrder * @param {*} sortOrder
*/ */
registerStep: function (code, alias, title, isVisible, navigate, sortOrder) { registerStep: function (code, alias, title, isVisible, navigate, sortOrder) {
var hash; var hash, active;
if ($.inArray(code, this.validCodes) !== -1) { if ($.inArray(code, this.validCodes) !== -1) {
throw new DOMException('Step code [' + code + '] already registered in step navigator'); throw new DOMException('Step code [' + code + '] already registered in step navigator');
...@@ -87,6 +87,12 @@ define([ ...@@ -87,6 +87,12 @@ define([
navigate: navigate, navigate: navigate,
sortOrder: sortOrder sortOrder: sortOrder
}); });
active = this.getActiveItemIndex();
steps.each(function (elem, index) {
if (active !== index) {
elem.isVisible(false);
}
});
this.stepCodes.push(code); this.stepCodes.push(code);
hash = window.location.hash.replace('#', ''); hash = window.location.hash.replace('#', '');
...@@ -111,10 +117,14 @@ define([ ...@@ -111,10 +117,14 @@ define([
getActiveItemIndex: function () { getActiveItemIndex: function () {
var activeIndex = 0; var activeIndex = 0;
steps.sort(this.sortItems).forEach(function (element, index) { steps.sort(this.sortItems).some(function (element, index) {
if (element.isVisible()) { if (element.isVisible()) {
activeIndex = index; activeIndex = index;
return true;
} }
return false;
}); });
return activeIndex; return activeIndex;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment