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

Adding a product from different channel. #59

Closed
lchrusciel opened this issue Apr 20, 2017 · 1 comment · Fixed by #530
Closed

Adding a product from different channel. #59

lchrusciel opened this issue Apr 20, 2017 · 1 comment · Fixed by #530
Labels

Comments

@lchrusciel
Copy link
Member

Right now it is possible to add a product to the cart even if this product is not available for given channel

@pamil
Copy link
Contributor

pamil commented Aug 31, 2018

The following classes need customisation:

  • PutOptionBasedConfigurableItemToCartHandler
  • PutSimpleItemToCartHandler
  • PutVariantBasedConfigurableItemToCartHandler

lchrusciel added a commit that referenced this issue Sep 22, 2019
This PR was merged into the 1.0-dev branch.

Discussion
----------

Fixes #59 

## What does it do?
Currently you can add any product to any cart. After this pull request the product needs to be available in the cart's channel. So that if a product is in channel A and the cart is picked up in channel B then the product-add endpoint will now throw an error (500).

## Why a 500 and not a 400 with validation errors?
The problem is that the Validation would need to take two properties of the request into consideration: the current cart token, the product code. Which means that it has to be a "Class Constraint" and needs to access properties of the request object. This is currently not possible as the current request objects don't have getter and the properties are private. So there is no way of validating them. Therefore this pull request only adds an assertion that it is true. (validation may follow if it will be possible to do so in the future)

PS: @JakobTolkemit you might be interested.

Commits
-------

8b85fbb Addding validation for product in current channel
ba20b63 Adding getter and using a class constraint for validation
5f1c839 Removing the 500 from add to product
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants