DenisDT Posted March 21, 2010 Share Posted March 21, 2010 Hi all,Has anyone noticed this (PS 1.2.5.0):Let's say I have a carrier that has the following price ranges:€0 -> €30 : shipping = €6€30 -> €50 : shipping = €3€50 -> €75 : shipping = €2€75 -> €100 : shipping = €1+€100: shipping = freeAnd let's say we open an order in Backoffice that is €79.Shipping cost is, according to price ranges €1 (which is correct).Now I remove soms products so the total order is €43 (due to customers wish or end-of-life products or whatever).Shipping cost should be recalculated to €3, but that doesn't happen!My solution (AdminOrders.php tab): Add the following after line 592 (give or take, it's right below the "Display summary order" comment and before the echo): $result = Db::getInstance()->getRow(' SELECT d.`price` FROM `'._DB_PREFIX_.'delivery` d LEFT JOIN `'._DB_PREFIX_.'range_price` r ON d.`id_range_price` = r.`id_range_price` WHERE d.`id_zone` = '.intval("1").' AND '.floatval($order->total_paid).' <= r.`delimiter2` AND d.`id_carrier` = '.intval($carrier->id).' ORDER BY r.`delimiter1` ASC'); $result = floatval($result['price']); Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'orders` SET `total_shipping` = '.$result.' WHERE `id_order` = '.$order->id); $order->total_shipping = $result; This recalculates the shipping cost for the selected order based on actual total price, and displays the correct amounts in the order page.Useful for anyone?D. Link to comment Share on other sites More sharing options...
DenisDT Posted March 24, 2010 Author Share Posted March 24, 2010 Guess not. Link to comment Share on other sites More sharing options...
Krystian Podemski Posted March 24, 2010 Share Posted March 24, 2010 I think You must report this to PrestaTeam. Link to comment Share on other sites More sharing options...
ioane Posted April 27, 2010 Share Posted April 27, 2010 Has anyone noticed this (PS 1.2.5.0): Yes! I have. But is your solution working if the pricing is done according to total weight? Link to comment Share on other sites More sharing options...
DenisDT Posted April 28, 2010 Author Share Posted April 28, 2010 No, i only adapted it to fit the needs of my client in this case.But it can be extended to take weight in account too.Remember, it's still a quick & dirty hack by replacing data in the database upon page loading...I didn't have time for an elegant solution back then.Good luck!D. Link to comment Share on other sites More sharing options...
Burhan BVK Posted April 28, 2010 Share Posted April 28, 2010 This is a bad hack. If you recalculate the shipping costs everytime the page loads you will not only slow down the page but also cause problems with old orders after changing the shipping costs. If you change the shipping costs and go to the order details in the backend, the shipping costs will change even if the order is already processed. You should put this code somewhere after the comment "/* Cancel product from order */". Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now