6

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?

1
  • Have you got solution for this ? Commented Dec 6, 2016 at 17:51

1 Answer 1

2

I believe the reloadOldPrice needs to be checked if it's loading data via different protocol of the site, ex instead of https it requests via http so that it's blocked by the browser as mixed content..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.