Hervé Torche Posted September 23, 2015 Share Posted September 23, 2015 (edited) Something really strange happen on a website in development : The shipping price rules is calculated and added to the total shipping price. I've 1 carrier which is set up to take the total price ranges. Between 0 and 100 CHF (swiss francs) it costs 10 CHF and between 100 and 1000 it costs 25 CHF. If I've 2 products of 50 CHF each in my basket, it calculates 10 CHF for each, so the total shipping costs are 20 CHF. But it should be only 10 !! The website is the following : http://new.pimus.ch Does somebody have an idea ? Thanks a lot in advance. Edit : Apparently, the calculation is done in Cart.php on lines 2249 and followings, but I don't understand why... : foreach ($delivery_option_list as $id_address => $delivery_option) foreach ($delivery_option as $key => $value) { $total_price_with_tax = 0; $total_price_without_tax = 0; $position = 0; foreach ($value['carrier_list'] as $id_carrier => $data) { $total_price_with_tax += $data['price_with_tax']; $total_price_without_tax += $data['price_without_tax']; $total_price_without_tax_with_rules = (in_array($id_carrier, $free_carriers_rules)) ? 0 : $total_price_without_tax; if (!isset($carrier_collection[$id_carrier])) $carrier_collection[$id_carrier] = new Carrier($id_carrier); $delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['instance'] = $carrier_collection[$id_carrier]; if (file_exists(_PS_SHIP_IMG_DIR_.$id_carrier.'.jpg')) $delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = _THEME_SHIP_DIR_.$id_carrier.'.jpg'; else $delivery_option_list[$id_address][$key]['carrier_list'][$id_carrier]['logo'] = false; $position += $carrier_collection[$id_carrier]->position; } $delivery_option_list[$id_address][$key]['total_price_with_tax'] = $total_price_with_tax; $delivery_option_list[$id_address][$key]['total_price_without_tax'] = $total_price_without_tax; $delivery_option_list[$id_address][$key]['is_free'] = !$total_price_without_tax_with_rules ? true : false; $delivery_option_list[$id_address][$key]['position'] = $position / count($value['carrier_list']); } Edited September 23, 2015 by Hervé Torche (see edit history) 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