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

Disallow showing bad cart to FO user #15533

Merged
merged 1 commit into from Sep 26, 2019

Conversation

@matks
Copy link
Contributor

commented Sep 13, 2019

Questions Answers
Branch? develop
Description? When "add a product to order" is used from the BO (on order page), a fake Cart is generated, probably because of #14131. This PR avoids the FO user to be mistakenly showed this cart when "Re-display cart at login" option is enabled. It's a port of 1.6 PR #8315
Type? bug fix
Category? FO
BC breaks? no
Deprecations? no
Fixed ticket? Fixes #15521
How to test? See ticket

This change is Reviewable

@matks matks requested a review from PrestaShop/prestashop-core-developers as a code owner Sep 13, 2019
@matks

This comment has been minimized.

Copy link
Contributor Author

commented Sep 13, 2019

I am not a fan of this solution. It uses that BO-generated carts have id_guest set to 0 to filter them and exclude them. But the real issue is that fake carts are generated BO-side to perform the "add product to order" action. The real issue is then #14131

However:

  • this PR avoids bad consequences on FO
  • it seems the fake cart cannot even be deleted by FO user, so it's worse than I thought 😱

That's why I think it's worth it to merge this PR although it hides the issue, it does not solve it.

@@ -3999,6 +3999,7 @@ public static function lastNoneOrderedCart($id_customer)
WHERE NOT EXISTS (SELECT 1 FROM ' . _DB_PREFIX_ . 'orders o WHERE o.`id_cart` = c.`id_cart`
AND o.`id_customer` = ' . (int) $id_customer . ')
AND c.`id_customer` = ' . (int) $id_customer . '
AND c.`id_guest` <> 0

This comment has been minimized.

Copy link
@PierreRambaud

PierreRambaud Sep 14, 2019

Contributor

Can we don't mix between != and <>. We often use !=

This comment has been minimized.

Copy link
@matks

matks Sep 19, 2019

Author Contributor

Applied and commit ammended

@matks matks force-pushed the matks:upport-pr-8315 branch from fa48d35 to e258cf5 Sep 19, 2019
@sarahdib sarahdib added this to the 1.7.7.0 milestone Sep 23, 2019
@sarahdib sarahdib added QA ✔️ and removed waiting for QA labels Sep 23, 2019
@PierreRambaud PierreRambaud merged commit a0e8255 into PrestaShop:develop Sep 26, 2019
2 checks passed
2 checks passed
PrettyCI Code formatting
Details
Travis CI - Pull Request Build Passed
Details
@PierreRambaud

This comment has been minimized.

Copy link
Contributor

commented Sep 26, 2019

Thanks @matks

@matks matks deleted the matks:upport-pr-8315 branch Sep 26, 2019
@marionf marionf added this to Done in PrestaShop 1.7.7 Sep 26, 2019
@marionf marionf removed this from Done in PrestaShop 1.7.7 Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.