Skip to content

Wrong initialization sequence in mage.priceBox widget (price-box.js) #6117

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

Closed
yariksheptykin opened this issue Aug 11, 2016 · 7 comments
Closed
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@yariksheptykin
Copy link

During initialization of priceBox the following code is executed:

this._setDefaultsFromPriceConfig();
this._setDefaultsFromDataSet();

However _setDefaultsFromPriceConfig relies on this.options.productId. This value is set in setDefaultsFromDataSet here.

Current sequence of function calls leaves this.options.productId always empty in this._setDefaultsFromPriceConfig().

I stumbled upon this issue while trying to add a custom price type and configuring priceBox to render it. With the current sequence of calls priceBox seem to ignore the configuration of the price types.

Preconditions

No pre-conditions. Just debug the function using browser developer tools.

Steps to reproduce

  1. Create a product which has a price.
  2. Navigate to the product details page
  3. Using your JS debugger set the breakpoint on https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/view/base/web/js/price-box.js#L206

Expected result

  1. The line should be executed.

Actual result

  1. This line never gets called.
@veloraven
Copy link
Contributor

@yariksheptykin thank you for your report.
Please, provide the used Magento version.

@yariksheptykin
Copy link
Author

2.1.0

@yariksheptykin
Copy link
Author

Changing:

this._setDefaultsFromPriceConfig();
this._setDefaultsFromDataSet();

to

this._setDefaultsFromDataSet();
this._setDefaultsFromPriceConfig();

Fixes the problem.

@andimov andimov self-assigned this Aug 18, 2016
@andimov andimov added bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed Progress: needs update labels Aug 18, 2016
@andimov
Copy link
Contributor

andimov commented Aug 18, 2016

@yariksheptykin
Thank you for reporting!
I've created an internal ticket MAGETWO-57136 for this issue and linked it to this one.

@yariksheptykin
Copy link
Author

Awesome! You want me to fix and do a PR?

@andimov andimov removed their assignment Sep 2, 2016
mmansoor-magento pushed a commit that referenced this issue Sep 7, 2016
mmansoor-magento pushed a commit that referenced this issue Sep 7, 2016
….priceBox widget (price-box.js) #6117 FOR 2.2

- code style fix
mmansoor-magento pushed a commit that referenced this issue Sep 7, 2016
mmansoor-magento pushed a commit that referenced this issue Sep 7, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
okorshenko pushed a commit that referenced this issue Dec 14, 2016
Fixed issues:
MAGETWO-57136: [GitHub] Wrong initialization sequence in mage.priceBox widget (price-box.js) #6117
MAGETWO-57062: [Backport] - Issues with minicart in multiwebsite - for 2.1
MAGETWO-55184: [GitHub #5526]Selected category is not added to Cart Price Rule condition due to JS error
MAGETWO-57168: CLONE - [GitHub]JavaScript Error on Checkout Page after Changing Country in Estimate Shipping and Tax Block
MAGETWO-57843: [Backport] - [Github # 6294] Coupon code override cart rules with no coupon code - for 2.1
MAGETWO-57512: [Backport] - Giftcard Purchase - Order Status - Processing - for 2.1
@KrystynaKabannyk
Copy link

@yariksheptykin, Closing this issue as it has been fixed under MAGETWO-57136 for 2.1.3.

@yariksheptykin
Copy link
Author

Awesome. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Tax Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

4 participants