-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix swatch-renderer.js 843:866 #8105
Conversation
Hello, There is an error in console when product has more than one swatch: Uncaught TypeError: Cannot read property 'oldPrice' of undefined - swatch-renderer.js:843 Step to reproduce: 1) Install Sample Data 2) Go to PDP where product has more than one swatch, for example ../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. Some fixes have been added. Please, test. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one logic question and one style change request.
} else { | ||
$(this.options.slyOldPriceSelector).hide(); | ||
} | ||
if (typeof(result) != "undefined") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though the typeof
operator can be used with parentheses, it is not recommended, because it can confuse linters and reviewers. This should be typeof result
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it make sence.
$(this.options.tierPriceBlockSelector).html(tierPriceHtml).show(); | ||
} | ||
} else { | ||
$(this.options.tierPriceBlockSelector).hide(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If result.tierPrices.length != 0
and !this.options.tierPriceTemplate
, then this.options.tierPriceBlockSelector
will be neither shown nor hidden. Is this the desired behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll pull new code, investigte it and fix if needed.
@aholovan thanks for contribution! Can you please update PR per the comments? |
I've created new pull request #8923. |
…sues_29Jan22 Hammer release regression issues 29 jan22
Hello,
There is an error in console when product has more than one kind of swatches:
Uncaught TypeError: Cannot read property 'oldPrice' of undefined - swatch-renderer.js:843
Step to reproduce:
Some fixes have been added. Please, test.
Thanks.