Prestashop: The total is not well calculated with free gift

Created on 4 Dec 2019  路  9Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
After fixing this issue: https://github.com/PrestaShop/PrestaShop/issues/11722 in the develop branch.
2 uses cases are not ok in the develop branch as reported here: https://github.com/PrestaShop/PrestaShop/issues/11722#issuecomment-561220896
Issue 1:
Create the following rules:

  • Rule 1
    Amount discount:
    image

  • Rule 2
    image

  • Rule 3
    Free gift
    image

Cart:
image

Issue 2:

  • Change the first rule:
    image
  • Discount is higher than the amount
    image

In the PS1.7.6.2, the total is well calculated

Additional information
PrestaShop version: develop
PHP version: 7.1

Bug Cart rules Discounts FO Fixed Major Regression Shopping carts FO develop

All 9 comments

I think you need to revert my PR... :-(

If we take the price of the gift with FinalUnitPrice, it works with whatever cartrule amount, but doesnt work for more than 1 gift rule.

If, after the PR we get it with InitialUnitPrice, it works properly, BUT gift rules must go first. Which we unfortunatelly cannot enforce in the code, because user can select both discount and gift in one single cart rule...

With the indicated cart rules configuration above and in branch develop, the issues are not reproducible:

1st issue:
Screenshot from 2020-01-01 17-41-56

2nd issue:
Screenshot from 2020-01-01 18-01-25

Thanks to everyone

Another issue.

Create 2 Free shipping rules. Total is correct but discount amount doesn't.

image

I confirm the issue mentioned by @idnovate concerning multiple free shippings.

image

Questions:

  • Should the total discounts be -10 in the scenario instead of -20?
  • Do you have in develop -0.00$ instead of free shipping ?

Thanks in advance.

  • Should the total discounts be -10 in the scenario instead of -20?

YES

  • Do you have in develop -0.00$ instead of free shipping ?

The screenshot was not in last PS version which fixed this issue ;)

Hi @arouiadib, @idnovate,

About this issue: https://github.com/PrestaShop/PrestaShop/issues/16673#issuecomment-570175986
With PS1.7.0.0(develop branch) => Issue is fixed:
image
image

Thanks!

Ok @idnovate , makes sense. Thank you.

@khouloudbelguith , could you please make a test when there is no carrier with free shipping? Just make sure the carriers have the status "free shipping" disabled.

Because I feel that, @idnovate and me, are performing tests when there are no free shipping carriers, or at least with products configured without free shipping.

Again thank you very much for your time.

@arouiadib, thanks for these clarifications.

Create 2 Free shipping rules. Total is correct but discount amount doesn't.
image

Yes, you are right to reproduce the issue we should have no carrier with free shipping with develop branch.
https://drive.google.com/file/d/15_C65TxgG5dMlV9SCfbnn3gBoInbXXJT/view
Ping @atomiix, this issue is fixed with this PR: https://github.com/PrestaShop/PrestaShop/pull/16724?

Thanks!

Hi @khouloudbelguith ,

After merging @atomiix PR: #16724 with develop in localhost, I found that it doesn't include the solution to the latter problem mentioned by @idnovate (which is maybe not the aim of that PR).

Anyways, what if we close this issue and create a separate one for multiple free shipping rules? I think it will make things clearer because this current issue is fixed with or without #16724 (and already closed here #11722).

Thank you very much for your time.
Regards,

Was this page helpful?
0 / 5 - 0 ratings