Skip to content

Commit

Permalink
Check of null result value in swatch-renderer.js
Browse files Browse the repository at this point in the history
There is an error when product has more than one kind of swatches:
Uncaught TypeError: Cannot read property 'oldPrice' of undefined - swatch-renderer.js:843

Steps to reproduce:
1) Set Special Price for some Simple of the Configurable product which has more than one kind of swatches, for example SKU: WJ03
2) Go to PDP (../augusta-pullover-jacket.html)
3) Select some Color and look to the console - there You will be able to see the error. This is because 'result' is null before all of the swatches are selected.
  • Loading branch information
aholovan authored Mar 17, 2017
1 parent 5f7064f commit 269c215
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,13 @@ define([
}
);

if (result.oldPrice.amount !== result.finalPrice.amount) {
if (typeof result != 'undefined' && result.oldPrice.amount !== result.finalPrice.amount) {
$(this.options.slyOldPriceSelector).show();
} else {
$(this.options.slyOldPriceSelector).hide();
}

if (result.tierPrices.length) {
if (typeof result != 'undefined' && result.tierPrices.length) {
if (this.options.tierPriceTemplate) {
tierPriceHtml = mageTemplate(
this.options.tierPriceTemplate,
Expand Down

0 comments on commit 269c215

Please sign in to comment.