Fixing Magento's One Page Checkout progress bug

I found a new (another one!) bug in the way Magento refreshes the onepage checkout progress review when you click on the sections (when you go from step 4 to step 2 for example).

The bug: when you click on any section in the one page checkout DOM, Checkout.prototype._onSectionClick gets called. The ‘.section’ element is properly selected when you click its second level descendants but not when you click the gray area.

The solution can be applied line 50 of skin/frontend/base/default/js/opcheckout.js - of course, please use Magento’s override mechanism to apply this fix.

/**
 * Section header click handler
 *
 * @param event
 */
_onSectionClick: function(event) {
  var section = $(Event.element(event).up('.section')); // instead of $(Event).element(event).up().up();
  if (section.hasClassName('allow')) {
     Event.stop(event);
     this.gotoSection(section.readAttribute('id').replace('opc-', ''), false);
       return false;
     }
  }
}

Gabriel Féron

Yet-to-be successful software developer, crazy Android lover and open-source enthusiast