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

Product SKU should be always cast to string #3606

Closed
2 of 5 tasks
GabiDivante opened this issue Sep 24, 2019 · 3 comments
Closed
2 of 5 tasks

Product SKU should be always cast to string #3606

GabiDivante opened this issue Sep 24, 2019 · 3 comments
Assignees
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can P2: Important Priority mark - still high ;)
Milestone

Comments

@GabiDivante
Copy link
Collaborator

What is the motivation for adding / enhancing this feature?

Sometimes the client SKU is in the form of an integer. On the VSF side, we keep them as a string. With synchronization enabled, this results in duplicate products (for vsf, this product is not in the cart). For security reasons, it seems necessary to cast both values ​​on a string, i.e. instead of the selected condition in here:
https://github.com/DivanteLtd/vue-storefront/blob/master/core/modules/cart/store/actions.ts#L624
add this:
const serverItem = serverItems.find((itm) => { return itm.sku.toString() === clientItem.sku.toString() || itm.sku.indexOf(clientItem.sku + '-') === 0 /* bundle products */ })

Casting string to string will give a string, casting int to string also will give a stirng, and then === will work.
(author: sszczepanski)

Can you complete this feature request by yourself?

  • YES
  • NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • This is a normal feature request. This should be available on https://test.storefrontcloud.io and then after tests this can be added to next Vue Storefront version. In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • (Pick this option only if you're sure) This is an important improvement request for current Release Candidate version on https://next.storefrontcloud.io and should be placed in next RC version. In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • (Pick this option only if you're sure) This is a critical improvement request for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version. In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.
@GabiDivante GabiDivante added the feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can label Sep 24, 2019
@pkarw pkarw added the P2: Important Priority mark - still high ;) label Sep 24, 2019
@pkarw pkarw added this to the 1.11.0-rc.1 milestone Sep 24, 2019
@andrzejewsky
Copy link
Contributor

@GabiDivante is there any possibility to have sku as integer? I thought there is always a string as sku is in format like xx-xx-xx are you sure about that? can you show some examples or how to reproduce error when it breaks the synchronisation?

@pkarw
Copy link
Collaborator

pkarw commented Sep 26, 2019

@andrzejewsky it could be whatever. it should be cased to string to be sure

@andrzejewsky
Copy link
Contributor

@pkarw ok I see, thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can P2: Important Priority mark - still high ;)
Projects
None yet
Development

No branches or pull requests

3 participants