andyts93 Posted July 11, 2014 Share Posted July 11, 2014 I'm creating a shop with prestashop 1.6.0.8 and advanced warehouse enabled. I create three warehouses and some sample products to test it. The problem is that if I checkout from a cart containing two products of two diferrent warehouses the shipping costs are counted two times. Is there a way to not duplicate shipping if the products comes from different warehouses? Link to comment Share on other sites More sharing options...
tontonshop Posted July 14, 2014 Share Posted July 14, 2014 right now its meant to be that way but the system should definatly let us choose if we want to make the client pay the cost of the second shipment or not Link to comment Share on other sites More sharing options...
andyts93 Posted July 14, 2014 Author Share Posted July 14, 2014 right now its meant to be that way but the system should definatly let us choose if we want to make the client pay the cost of the second shipment or not So it's not possible to count the shipping cost only once for now? Link to comment Share on other sites More sharing options...
Universer Posted September 13, 2015 Share Posted September 13, 2015 Anyone has an update on this ? Regards Link to comment Share on other sites More sharing options...
eugenata Posted June 4, 2016 Share Posted June 4, 2016 For me the same problem with PS 1.6.1.2 and Ps 1.6.1.3. Nobody solved? Link to comment Share on other sites More sharing options...
bbgun91 Posted July 21, 2016 Share Posted July 21, 2016 (edited) For me the same problem with PS 1.6.1.2 and Ps 1.6.1.3. Nobody solved? Hi Eugenata ! I bumped into this same issue recently, and when today, i was working on fixing it i found the code to modify. So if you (if it's not too late) or anyone else find this post, here is where to modify: The code is in the Class Cart.php in the function getDeliveryOptionList(). First, i would advice you to copy this function in your override file of Cart.php to prevent any issue and to keep the original code clean. You need to look for "price_with_tax" and "price_without_tax". Find: $best_price_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_price_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; and change the "+=" by "=" to remove the incrementation, like this: $best_price_carrier[$id_carrier]['price_with_tax'] = $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; // count only 1 shipping fee whatever the number of packages. $best_price_carrier[$id_carrier]['price_without_tax'] = $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; Do the same for the 2 following pieces of code a few lines under by changing "+=" into "=" : $best_grade_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_grade_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; $price_with_tax += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $price_without_tax += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; You will also need to do the same for the function getCarrierCost(). Finally, you will need to modify the class PaymentModule. Look for the following code: foreach ($package_list as $id_address => $packageByAddress) { foreach ($packageByAddress as $id_package => $package) { and insert, just outside the first loop, a flag that we will create to detect in which package we are. $packageCount = 1; Inside the second loop, look for the $order->total_shipping_tax_excl declaration and add a condition like this: $order->total_shipping_tax_excl = ($packageCount === 1 ? (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list) : 0.00); So if it's not the 1st package, then the total_shipping_tax_excl is 0 (float). Do the same for $order->total_shipping_tax_incl. At the end of the second loop, don't forget to increment our new flag, so we know that we are on the next package. $packageCount++; That's it ! I hope this will help ! Please comment if it worked well for you or not! For me it was perfect! Cheers! Edited July 22, 2016 by bbgun91 (see edit history) 1 Link to comment Share on other sites More sharing options...
lochot Posted December 1, 2016 Share Posted December 1, 2016 Hi Eugenata ! I bumped into this same issue recently, and when today, i was working on fixing it i found the code to modify. So if you (if it's not too late) or anyone else find this post, here is where to modify: The code is in the Class Cart.php in the function getDeliveryOptionList(). First, i would advice you to copy this function in your override file of Cart.php to prevent any issue and to keep the original code clean. You need to look for "price_with_tax" and "price_without_tax". Find: $best_price_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_price_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; and change the "+=" by "=" to remove the incrementation, like this: $best_price_carrier[$id_carrier]['price_with_tax'] = $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; // count only 1 shipping fee whatever the number of packages. $best_price_carrier[$id_carrier]['price_without_tax'] = $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; Do the same for the 2 following pieces of code a few lines under by changing "+=" into "=" : $best_grade_carrier[$id_carrier]['price_with_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $best_grade_carrier[$id_carrier]['price_without_tax'] += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; $price_with_tax += $carriers_price[$id_address][$id_package][$id_carrier]['with_tax']; $price_without_tax += $carriers_price[$id_address][$id_package][$id_carrier]['without_tax']; You will also need to do the same for the function getCarrierCost(). Finally, you will need to modify the class PaymentModule. Look for the following code: foreach ($package_list as $id_address => $packageByAddress) { foreach ($packageByAddress as $id_package => $package) { and insert, just outside the first loop, a flag that we will create to detect in which package we are. $packageCount = 1; Inside the second loop, look for the $order->total_shipping_tax_excl declaration and add a condition like this: $order->total_shipping_tax_excl = ($packageCount === 1 ? (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list) : 0.00); So if it's not the 1st package, then the total_shipping_tax_excl is 0 (float). Do the same for $order->total_shipping_tax_incl. At the end of the second loop, don't forget to increment our new flag, so we know that we are on the next package. $packageCount++; That's it ! I hope this will help ! Please comment if it worked well for you or not! For me it was perfect! Cheers! A few months later.... bbgun91 YOU ROCKS !It work for me, i made the two overrides and now, only one shipping cost for my customer Link to comment Share on other sites More sharing options...
eldermaster Posted January 6, 2017 Share Posted January 6, 2017 Hello, I was looking for such long time for a solution regarding this issue. Thank you for the hints. Still I have a problem regarding the total order amount that is registered in backoffice and I really don't know how to solve it. I mean that the solution works ok for the front office until the order is registered. The cart shows the correct price and also in the back office inside the order details the shipping is applied only for one product. But the TOTAL inside the order details and also inside the invoice, even the shipping is 0 for one of the orders, still show sum of the product + shipping price. It should show only the products price. Anyone can help me to fix this ? Thank you, Link to comment Share on other sites More sharing options...
eldermaster Posted January 6, 2017 Share Posted January 6, 2017 (edited) Problem solved! by myself.... issue was around $order->total_paid_tax_excl / $order->total_paid_tax_incl because it looked at BOTH shipping + products Anyway... thx again for starting this awesome workaround that solved a big issue for my project. Edited January 6, 2017 by eldermaster (see edit history) Link to comment Share on other sites More sharing options...
monikiuxe Posted January 29, 2017 Share Posted January 29, 2017 I also have a problem with shipping price. Is there any way to set different shipping cost for different carriers in different warehouse? Link to comment Share on other sites More sharing options...
AlvinWilliams231 Posted February 9, 2017 Share Posted February 9, 2017 Thank you for the solution. It should work. Will try to rectify if it doesn’t. Hope kit gets the job done. Link to comment Share on other sites More sharing options...
oNine Posted May 3, 2017 Share Posted May 3, 2017 Hi everybody, this is a part of the final solution actually.It could work as it is but if you have lot of warehouse and lot of different prices depending on range (weight or cart price), this solution will everytime take the last shipping price. And if you have a free shipping for a certain range, and different prices depending on range, the last price of the list (delivery_option_list) won't be the good one, maybe sometime but not always.The solution has to be develop regarding ranges and prices.Best regards. Link to comment Share on other sites More sharing options...
Recommended Posts