This issue has been migrated from the Forge. Read the original ticket here.
By now the Discount is not use in the calculation of the free shipping price value
configure your carrier for free shipping from 150€
Add a discount cart rule
Cart total to get free shipping is 150€. If the customer buy a 160€ item and use a -10% discount, customer gonna pay 144€ and have the free shipping, while it shouldn't
This comment has been migrated from the Forge. Read the original comment here.
Hi Matteo,
I did not manage to reproduce the issue with the last version PS:1.7.4.2
I attached a video recordÂ
Aug 2 2018 8_28 AM.webm
Thanks to check and feedback.
Best regards,
Khouloud
Hello in your video the product discount had insert with a product price rule and the coupon has used to offer a free shipping....
in my case i have create a simple cart rule to offer 10% discount for all products calculated without tax or shipping cost.
My shipping policy is equal a free shipping for orders from 150€
Hi @Thinkup,
I manage to reproduce the issue with the last version PS:1.7.4.2.
We will see how tow fi it.
Best regards,
Khouloud
Hi all, any news about this issue? I have the same problem but with 1.7.4.1.
Hi @melmelimel,
Sorry not yet.
There are some major issues to solve before this one.
So, it will probably not solved right now.
But PrestaShop is an open source project, so it can be solved before if someone submits a pull request to solve it.
Best regards, Khouloud
That's really annoying... How can we submit this as a pull request? Do you think that in a few days it can be solved or can it take months or years ?
Khouloud, it seems that Idnovate has a solution... https://addons.prestashop.com/fr/frais-de-port/26428-shipping-cost-with-without-cart-rules-discounts.html
Hi @melmelimel,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
Best regards, Khouloud
This is a serious problem. It's impossible to manage carrier by price + discounts this way.
After debugging a bit i found out that Cart::getOrderTotal() with Cart::BOTH_WITHOUT_SHIPPING doesn't load cart rules.
But if I add
Cart::BOTH_WITHOUT_SHIPPING
in
if (in_array($type, [Cart::BOTH, Cart::ONLY_DISCOUNTS])) {
and moving in the switch after
case Cart::BOTH_WITHOUT_SHIPPING:
together with
case Cart::BOTH
I get an Interal Server Error when loading cart.
It must be something with the Core/Cart/Calculator processCalculation() function. But I can't find out what exactly.
@matrixino It seems there is a module that corrects that problem... I will try it tonight.
I let you know... Unfortunately I cannot wait till something comes out one day... or not!
Yes, I know. But this is inacceptable. They are pratically saying "we know it's a bug and you have to pay for a fix, because it's not important to us" even if this is actually a critical bug in the cart process.
@matrixino Unfortunately even the module doesn't work... and the developer cannot fix the issue....
I'm becoming completely CRAZY ! How can we make the things move ???
The problem seems to be in the CORE of Prestashop.
As I said the problem is in the Core Cart Calculator class.
Hi,
This issue is added to our bug roadmap.
There are some major issues to solve before this one.
But PrestaShop is an open source project, so it can be solved before if someone submits a pull request to solve it.
Best regards, Khouloud
we lost the shipping cost for every orders for this issue... I also think it's a serious problem.
@Thinkup @matrixino Could someone submit a pull request?
@melmelimel I don't have a fix yet, I didn't dig deeper because I only use weight shipping. It was a customer problem.
@matrixino Hope someone can solve the problem...
Any news??
Hi @Thinkup,
Sorry not yet.
Thanks for your understanding!
It happens to me. Some news?
@matrixino, sorry not yet.
It happens to me. Some news?
@rafaelcalero , hello i have solved with https://addons.prestashop.com/it/spese-spedizione/7490-freelivery-consegna-gratuita.html
....
Any solution??
Or still no
@ahmedabdo1995, sorry not yet.
It is added to our bug roadmap.
Thanks!
Any assist to try solve it by myself ??
I need it to be done today
So any suggestions may help
Any assist to try solve it by myself ??
I need it to be done today
So any suggestions may help
Forget it by today, no one is going to fix it for you.
Just stop using product price to calculate carrier price.
As a workaround, use your product price as weight, and use the weight.
You could also buy some of the modules that solves it.
Ok then. Which modules can solve it
Ty for reply
You could also buy some of the modules that solves it.
No point in buying a module if you can do it with the weight (and not for a dev who can't fix a simple bug). Just use the price as weight. You are not going to use it for anything else anyway.
@matrixino, It is just one more option, there may be cases in which the real weight is necessary.
@Thinkup recommended a plugin up. I have not confirmed that it works.
@ahmedabdo1995 Also, you can try to see if the weight method works what the partner proposes.
@matrixino Weight is not a good solution for me
@rafaelcalero i will check that module
@matrixino @rafaelcalero hey guys, i just solved this problem by myself :)
@ahmedabdo1995 tell us :)
Hi @ahmedabdo1995,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
@rafaelcalero
at classes/Cart.php
search for this
// Get shipping cost using correct method
and add this before
$getCartRuless = $this->getCartRules();
$the_discount = $getCartRuless[0]['value_real'];
$the_total_price = floatval($order_total) - floatval($the_discount);
this code get the discount amount then remove it from order total
output is $the_total_price
variable
then you need to change $order_total to $the_total_price at the next if statement below
inside this function getDeliveryPriceByPrice()
@ahmedabdo1995
I changed code as you said
And get this exception
Make sure there is no override for this function
Overrides/classes/Cart.php
And i think you miss comma , after $the_total_price at red box num 2
Check for the comma first
hello like i wrote some days ago i have solved with https://addons.prestashop.com/it/spese-spedizione/7490-freelivery-consegna-gratuita.html
Make sure there is no override for this function
Overrides/classes/Cart.phpAnd i think you miss comma , after $the_total_price at red box num 2
Check for the comma first
@ahmedabdo1995 comma is right here, just hided behind the red box :)
And I don't have any override
Pleas mark the line of the error appeared then
To check it
@ahmedabdo1995
Remove this line
And replace it with the next code
will fix this
if(isset($getCartRuless[0])){
the_discount = $getCartRuless[0]['value_real'];
}else{
$the_discount = 0;
}
sry i missed $ before first ( the_discount )
Add it
Here is an alternate solution on Prestashop 1.7.4.3.
Starting from ahmedabdo1995's solution:
Open classes/Cart.php
find the following (should be around line 3430):
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
$shipping_cost = $this->getPackageShippingCostFromModule($carrier, $shipping_cost, $products);
Cache::store($cache_id, $shipping_cost);
return $shipping_cost;
}
replace with:
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
$scdCartRules = $this->getCartRules();
$scdCartRulesDiscount = $scdCartRules[0]['value_real'];
$orderTotalwithoutDiscounts = floatval($orderTotalwithDiscounts) - floatval($scdCartRulesDiscount);
if ($orderTotalwithoutDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
$shipping_cost = $this->getPackageShippingCostFromModule($carrier, $shipping_cost, $products);
Cache::store($cache_id, $shipping_cost);
return $shipping_cost;
}
Hope this helps you guys!
Thanks for diving into this @choclove90
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
Any news about this bug? ahmedabdo1995 your patch works but makes problem with discount codes with specific products :(
Maybe it was fixed by #12965?
Yes, it's fixed on develop branch
Most helpful comment
Here is an alternate solution on Prestashop 1.7.4.3.
Starting from ahmedabdo1995's solution:
Open classes/Cart.php
find the following (should be around line 3430):
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
$shipping_cost = $this->getPackageShippingCostFromModule($carrier, $shipping_cost, $products);
Cache::store($cache_id, $shipping_cost);
return $shipping_cost;
}
replace with:
$orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
$scdCartRules = $this->getCartRules();
$scdCartRulesDiscount = $scdCartRules[0]['value_real'];
$orderTotalwithoutDiscounts = floatval($orderTotalwithDiscounts) - floatval($scdCartRulesDiscount);
if ($orderTotalwithoutDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
$shipping_cost = $this->getPackageShippingCostFromModule($carrier, $shipping_cost, $products);
Cache::store($cache_id, $shipping_cost);
return $shipping_cost;
}
Hope this helps you guys!