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

Check minimal quantity #10279

Merged
merged 4 commits into from Sep 7, 2018

Conversation

Projects
None yet
7 participants
@sadlyblue
Contributor

sadlyblue commented Sep 4, 2018

Solve #10162. After the product is added to the cart, it will return an error if the customer tries to decrease the product quantity below the minimal_quantity (for the product or combination).

Questions Answers
Branch? develop
Description? issue #10162 from github
Type? bug fix
Category? FO
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #10162.
How to test? As indicated in the issue, Have a product (or combination) with minimal_quantity > 1. Add to cart the minimal_quantity. With this fix, when you try to remove below the minimal_quantity it will display/return an error message.

This change is Reviewable

Check minimal quantity
Solve #10162. After the product is added to the cart, it will return an error if the customer tries to decrease the product quantity below the minimal_quantity (for the product or combination).
Show outdated Hide outdated controllers/front/CartController.php Outdated
Show outdated Hide outdated controllers/front/CartController.php Outdated

@jolelievre jolelievre self-requested a review Sep 6, 2018

sadlyblue and others added some commits Sep 6, 2018

Array_push changed
array_push to $this->{$ErrorKey}[]
@matks

This comment has been minimized.

Show comment
Hide comment
@matks

matks Sep 7, 2018

Contributor

@sadlyblue I applied php-cs-fixer for you ;) now waiting for travis build, it should be green ...

Contributor

matks commented Sep 7, 2018

@sadlyblue I applied php-cs-fixer for you ;) now waiting for travis build, it should be green ...

@matks matks added the waiting for QA label Sep 7, 2018

@marionf marionf self-assigned this Sep 7, 2018

@marionf

This comment has been minimized.

Show comment
Hide comment
@marionf

marionf Sep 7, 2018

Contributor

Hello @sadlyblue

If I set the minimum quantity to 4 and try to decrease in cart the quantity, I have the error message and can't order but the quantity is still on 4, it should be on 3 with the order button disabled
Then if I increase I have 5 but I should have 4

https://drive.google.com/open?id=1ZueXDVq8BBup8DnA6B92tcjVNBDGlIvT

Also, if the product has combinations, it should be good to have the combination displayed in the error message

Contributor

marionf commented Sep 7, 2018

Hello @sadlyblue

If I set the minimum quantity to 4 and try to decrease in cart the quantity, I have the error message and can't order but the quantity is still on 4, it should be on 3 with the order button disabled
Then if I increase I have 5 but I should have 4

https://drive.google.com/open?id=1ZueXDVq8BBup8DnA6B92tcjVNBDGlIvT

Also, if the product has combinations, it should be good to have the combination displayed in the error message

@marionf marionf removed their assignment Sep 7, 2018

@sadlyblue

This comment has been minimized.

Show comment
Hide comment
@sadlyblue

sadlyblue Sep 7, 2018

Contributor

Hi @marionf ,
You are right, since it returns an error, it doesn't unlock the checkout button.
Will have a look at it.
Is it supposed to not let the order finish and show the amount less than the minimum, or not let the amount be less than the minimum amount?
I would vote for not letting the amount be less than the minimum amout, only needing to "activate" the checkout button. To have the same behaviour as in the product page (doesn't let adding to cart less than the minimum amount.

Contributor

sadlyblue commented Sep 7, 2018

Hi @marionf ,
You are right, since it returns an error, it doesn't unlock the checkout button.
Will have a look at it.
Is it supposed to not let the order finish and show the amount less than the minimum, or not let the amount be less than the minimum amount?
I would vote for not letting the amount be less than the minimum amout, only needing to "activate" the checkout button. To have the same behaviour as in the product page (doesn't let adding to cart less than the minimum amount.

Fix checkout button unavailable
Changing $this->{$ErrorKey} to $this->errors returns the same error, but the checkout button is enabled (as per @marionf comment and bug reported).
I believe it should not decrease the product quantity, since in the product page we con only add the minimum amount or can't add at all.
@marionf

This comment has been minimized.

Show comment
Hide comment
@marionf

marionf Sep 7, 2018

Contributor

Seems better like this :)
Thank you @sadlyblue

Contributor

marionf commented Sep 7, 2018

Seems better like this :)
Thank you @sadlyblue

@PierreRambaud PierreRambaud merged commit 256b5e9 into PrestaShop:develop Sep 7, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@PierreRambaud

This comment has been minimized.

Show comment
Hide comment
@PierreRambaud

PierreRambaud Sep 7, 2018

Contributor

Thanks @sadlyblue

Contributor

PierreRambaud commented Sep 7, 2018

Thanks @sadlyblue

@matks matks added this to the 1.7.5.0 milestone Sep 10, 2018

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