$presenter = new CartPresenter();
$presented_cart = $presenter->present($this->context->cart, $shouldSeparateGifts = true);
or change 'cart' => $this->cart_presenter->present($this->context->cart),
to 'cart' => $this->cart_presenter->present($this->context->cart, true),
in classes/controller/FrontController and go to cart.
Totals should be:
Subtotal: 140 CZK
Discounts: 20 CZK
Total: 120 CZK
Totals are:
Subtotal: 180 CZK
Discounts: 40 CZK
Total: 140 CZK
1. Wrong subtotal - /src/Core/Cart/CartRow - Subtotal is calculated by $rowData['cart_quantity']
instead of $rowData['quantity']
. Cart_quantity holds total quantity of this product in cart (2), quantity holds the current row amount (1).
2. Wrong discount total - /src/Core/Cart/CartRuleCalculator - Error near if ((int) $cartRule->gift_product) {
. The gift gets discounted twice. Why? Because it checks, if the row equals the product in the cart rule. But this condition will be met twice, in both passes, once for the actual gift and once for the normally added product.
I tried to fix it by this PR https://github.com/PrestaShop/PrestaShop/pull/17825, but it broke some tests and I don't have the skills to resolve the issue, nor know if my solution is correct.
Thanks for opening this issue! We will help you to keep its state consistent
Hello,
It seems that your issue is fixed. I close this issue feel free to open a new one if you reproduce this again.
Thank you!
@sarahdib You did not reproduce it.
Ping @matks @eternoendless
Why closing it so fast ?
@jf-viguier it's part of the normal procedure we use to avoid having too many non reproductible issues open.
That said, looks like there was a mistake when trying to reproduce, we're investigating.
Don't forget $shouldSeparateGifts to true
Why closing it so fast ?
When a bug is reported, the QA team attempts to reproduce it. Here it could not be reproduced.
This does not mean the conversation ends there
"The issue is closed" does not mean "this topic is closed" 馃槃 . Conversation and exploration can continue.
It's simply the only way to keep a backlog manageable. "Open issues" are "things we can act on". Things a developer can pick up and start working on. We cannot act on something we cant reproduce.
There is a lot of issues that are opened but actually do not refer to a bug inside prestashop software. It can come from server configuration, 3rd party theme, 3rd party module, overrides, custom code ... so if we cannot reproduce an issue on a standard environment, unless proved otherwise, we consider it does not come from prestashop software (and we then cannot act on it).
But once again: it does not mean topic is closed. It's just an issue status, that we use to search, filter, classify issues while manageing the backlog.
@Hlavtox sorry I check with a member of the core team :)
I managed to reproduce this issue on 1.7.7, using the same values as @Hlavtox :
@sarahdib the same issue exists on 1.7.6, it's not a 1.7.7 regression.
Most helpful comment
When a bug is reported, the QA team attempts to reproduce it. Here it could not be reproduced.
This does not mean the conversation ends there
"The issue is closed" does not mean "this topic is closed" 馃槃 . Conversation and exploration can continue.
It's simply the only way to keep a backlog manageable. "Open issues" are "things we can act on". Things a developer can pick up and start working on. We cannot act on something we cant reproduce.
There is a lot of issues that are opened but actually do not refer to a bug inside prestashop software. It can come from server configuration, 3rd party theme, 3rd party module, overrides, custom code ... so if we cannot reproduce an issue on a standard environment, unless proved otherwise, we consider it does not come from prestashop software (and we then cannot act on it).
But once again: it does not mean topic is closed. It's just an issue status, that we use to search, filter, classify issues while manageing the backlog.