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 conflict between two cart rules and a single product cart #8361

Merged
merged 1 commit into from Sep 22, 2017

Conversation

Projects
None yet
4 participants
@eternoendless
Member

eternoendless commented Sep 21, 2017

Fixing this case: two cart rules, one with a free product and other with a percentage discount. The problem is when there is no stock of the free product, the code to load the second cart rule didn't checked if the product was in the cart. If detected that the gift rule was loaded, it substracted one unit from the total quantity cart products. And if the cart had only one product, it generated a "Cart empty" error. Now it checks if the cart contains the cart rule free product.

This is a clone of #8180
Something went wrong when rebasing it onto 1.7.2.x, so I recreated it here. Full credits go to @Xaconi

Questions Answers
Branch? develop
Description? The proposed solution resolves the specific case that combines two cart rules. One, to add a free product automatically. And the second one, to make a percentage discount. I've found a problem when the free product has no stock, and the cart has only one product. The FO gets the "Cart is empty" error. Now, the system checks if the free product is in the cart.
Type? bug fix
Category? CO
BC breaks? no
Deprecations? no
How to test? Generate two cart rules. one with a free product, and other with a percentage discount with code. The free product has to be a zero stock product. Then, add a product to customer's cart (it loads the free product cart rule, but it no adds to the cart beacuse don't have stock). Finally, try to add the second rule with the code on the order page. It generates the "Cart is empty error". The fix resolves this case
BO: Fix conflict between two cart rules and a single product cart
Fixing case: two cart rules, one with a free product and other with a percentage discount. The problem is when there is no stock of the free product, the code to load the second cart rule didn't checked if the product was in the cart. If detected that the gift rule was loaded, it substracted one unit from the total quantity cart products. And if the cart had only one product, it generated a "Cart empty" error. Now it checks if the cart contains the cart rule free product.
@tomlev

tomlev approved these changes Sep 21, 2017

@eternoendless

This comment has been minimized.

Show comment
Hide comment
@eternoendless
Member

eternoendless commented Sep 22, 2017

Thank you @Xaconi

@eternoendless eternoendless merged commit 678349d into PrestaShop:1.7.2.x Sep 22, 2017

2 checks passed

codacy/pr Good work! A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@eternoendless eternoendless deleted the eternoendless:xaconi-develop branch Sep 22, 2017

@prestonBot prestonBot referenced this pull request Sep 23, 2017

Closed

1.7.2.x #8363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment