Skip to content

Commit

Permalink
MAGETWO-85297: 8410: Custom Checkout Step and Shipping Step are Highl…
Browse files Browse the repository at this point in the history
…ighted and Combined upon Checkout page load #975

 - Merge Pull Request magento-engcom/magento2ce#975 from RomaKis/magento2:8410
 - Merged commits:
   1. fd5f40a
   2. c12dc31
   3. 04ff661
   4. fccecf3
   5. f728923
   6. a0b5460
   7. 98e7951
  • Loading branch information
omiroshnichenko committed Dec 11, 2017
2 parents d865ef1 + 98e7951 commit c1eb806
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ define([
* @param {*} sortOrder
*/
registerStep: function (code, alias, title, isVisible, navigate, sortOrder) {
var hash;
var hash, active;

if ($.inArray(code, this.validCodes) !== -1) {
throw new DOMException('Step code [' + code + '] already registered in step navigator');
Expand All @@ -87,6 +87,12 @@ define([
navigate: navigate,
sortOrder: sortOrder
});
active = this.getActiveItemIndex();
steps.each(function (elem, index) {
if (active !== index) {
elem.isVisible(false);
}
});
this.stepCodes.push(code);
hash = window.location.hash.replace('#', '');

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

steps.sort(this.sortItems).forEach(function (element, index) {
steps.sort(this.sortItems).some(function (element, index) {
if (element.isVisible()) {
activeIndex = index;

return true;
}

return false;
});

return activeIndex;
Expand Down

0 comments on commit c1eb806

Please sign in to comment.