Skip to content
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

[Bug] NaN Undefined on Store with Very Large Integers #4900

Closed
jeffcorpuz opened this issue Jan 7, 2019 · 6 comments
Closed

[Bug] NaN Undefined on Store with Very Large Integers #4900

jeffcorpuz opened this issue Jan 7, 2019 · 6 comments
Assignees
Labels
bug For issues that describe a defect or regression in the released software

Comments

@jeffcorpuz
Copy link
Contributor

jeffcorpuz commented Jan 7, 2019

Issue Description

When declaring a product's price more than 3 significant figures (1 x 10 ^ 3), NaN Undefined results up on the Store.

Where as when in the product's detailed page, the real price will be shown.

Note: Does not matter if the Compare At Price is very large

Examples :
screen shot 2019-01-07 at 3 54 08 pm

screen shot 2019-01-07 at 3 55 22 pm

screen shot 2019-01-07 at 3 50 57 pm

screen shot 2019-01-07 at 3 51 50 pm

Steps to Reproduce

Please provide starting context, i.e. logged in as a user, configure a particular payment method.

  1. Create/Edit existing product's "Price" to have more than 3 significant figures, i.e. 1000, 10000 etc.
  2. Go to storefront page, to see visual NaN

Versions

2.0.0-release-rc.8

@spencern
Copy link
Contributor

spencern commented Jan 8, 2019

@jeffcorpuz nice find. Is this a regression introduced in rc.8?

@spencern spencern added the bug For issues that describe a defect or regression in the released software label Jan 8, 2019
@jeffcorpuz
Copy link
Contributor Author

jeffcorpuz commented Jan 8, 2019

@spencern going through tags checkouts, seems it is introduced between rc.5(f9fd923) and rc.6(b49fbf0).

@spencern
Copy link
Contributor

spencern commented Jan 9, 2019

@kieckhafer can you take a look at this?

@kieckhafer
Copy link
Member

kieckhafer commented Jan 9, 2019

Looks like this is only for logged in Admin users, non-admin / logged out users see the correct number
reaction

vs

reaction

@kieckhafer
Copy link
Member

kieckhafer commented Jan 9, 2019

So it looks like this breaks for us inside of accounting.formatMoney: https://github.com/reactioncommerce/reaction/blob/feat-kieckhafer-surcharges/client/modules/i18n/currency.js#L159

And it seems that it has something to do with the us using String as the type for saving price range, and the comma (,) that we save in the database when the price is over $1000. (We save as 1,000). When I manually remove the comma(s) from the database, it works fine.

However, it still displays fine in the side bar, even with the commas inside the database - although they are coming from the Catalog collection, where as the errored version is coming from the Products collection:

reaction

The solution is probably to try and save the strings without a comma in them - although still trying to figure out why the Products and Catalog collection seems to behave differently.

@kieckhafer
Copy link
Member

Closed via #4910 and #4916

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software
Projects
None yet
Development

No branches or pull requests

3 participants