I’m having this issue in the Javascript file of the one page checkout of my website ilgirastore.com, it happens when the customer is logged not for non registered checkouts, probably I hope is a conflict with some extension, after I reload the page when I’m here https://ilgirastore.com/checkout/onepage/ and I click the second time to the proceed button, the problem doesn’t fire again and I can continue in the checkout. Any suggestions? The function that fires the exception is this:
_disableEnableAll: function(element, isDisabled) {
var descendants = element.descendants();
for (var k in descendants) {
descendants[k].disabled = isDisabled;
}
element.disabled = isDisabled;
}
The file is here: http://ilgirastore.com/skin/frontend/default/shopper/js/opcheckout.js I’m using Magento CE 1.7.0.2 You are free to test with fake orders just write test or random stuff.
The problem may be here for (var k in descendants)
because foreach in JavaScript doesn't work as it's expected, it may go through any of the properties of the object, its prototype, other objects inside, etc., you can't be really sure of what it's getting.
Try this
_disableEnableAll: function(element, isDisabled) {
var descendants = element.descendants();
var keys = Object.keys(descendants);
for (var k = 0; k < keys.length; k += 1) {
descendants[keys[k]].disabled = isDisabled;
}
element.disabled = isDisabled;
}
Also descendants may be an array, not an object, in that case try this one
_disableEnableAll: function(element, isDisabled) {
var descendants = element.descendants();
for (var k = 0; k < descendants.length; k += 1) {
descendants[k].disabled = isDisabled;
}
element.disabled = isDisabled;
}