On any category or product detail page that has a configurable product on it, I detect the following errors show up in the these files:
- /js/varien/configurable.js : unreachable code after return statement, line 291
- /js/varien/product.js : unreachable code after return statement, line 485
- /js/calendar/calendar.js : unreachable code after return statement, line 138
In product.js the block of code in question is:
reloadPrice: function(){
var price = 0;
var oldPrice = 0;
for(var i=this.settings.length-1;i>=0;i--){
var selected = this.settings[i].options[this.settings[i].selectedIndex];
if(selected.config){
price += parseFloat(selected.config.price);
oldPrice += parseFloat(selected.config.oldPrice);
}
}
optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
optionsPrice.reload();
return price;
if($('product-price-'+this.config.productId)){
$('product-price-'+this.config.productId).innerHTML = price;
}
this.reloadOldPrice();
},
configurable.js is exactly the same as this, and calendar.js has a similar block of code with a return in the middle.
Now to me, it just seems a bit odd that there is a return in the middle of the function, instead of at the end or with a conditional statement wrapped around it. I'm considering moving the return
to the end of the function block, or wrapping it in a conditional statement like if (price > 0) return price;
I know they are core files so I shouldn't be tinkering, but any advice/suggestions?