Only charge 1 amount of shipping

Hi everyone,

I have probably asked this before, but I have yet to figure out any ideas to resolve the situation.



Basically i’m trying to figure out how to only charge 1 amount of postage. If a customer orders 3 items then it will only charge the postage of the item with the highest postage cost.



e.g. a ball has a P&P cost of £2.99, a bike has a P&P cost of £24.99, and a pencil has a P&P cost of £1. In this case the postage would be £24.99



Does anyone know how I could achieve this. At the moment it would charge £28.98, which is not ideal.



Thanks

Hi everyone,

Sorry to bump this up but I’m getting a bit desperate. I’ve searched all over the web to find out ways I can modify the code to achieve this, but nothing is helping.



I just can’t understand how this type of idea cannot be implemented. Surely it’s a standard thing to do?.



Thanks

[quote name=‘jbenitos’]Hi everyone,

I have probably asked this before, but I have yet to figure out any ideas to resolve the situation.



Basically i’m trying to figure out how to only charge 1 amount of postage. If a customer orders 3 items then it will only charge the postage of the item with the highest postage cost.



e.g. a ball has a P&P cost of £2.99, a bike has a P&P cost of £24.99, and a pencil has a P&P cost of £1. In this case the postage would be £24.99



Does anyone know how I could achieve this. At the moment it would charge £28.98, which is not ideal.



Thanks[/QUOTE]



The shipping cost depends on the product weight. The products weight is a sum all products in the cart. The system calculates the shipping cost based on the products weight. If you want to change it you need to replace the following part of code:



function fn_get_products_weight($cart, $cart_products, $type = 'S')
{
$weight = 0;

if (is_array($cart_products)) {
foreach ($cart_products as $k => $v) {
if ($type == 'S') {
if (($v['is_edp'] == 'Y' && $v['edp_shipping'] != 'Y') || $v['free_shipping'] == 'Y' || fn_exclude_from_shipping_calculate($cart['products'][$k])) {
continue;
}
} elseif ($type == 'C') {
if (isset($v['exclude_from_calculate'])) {
continue;
}
}

if (isset($v['weight'])) {
$weight += ($v['weight'] * $v['amount']);
}
}
}

return !empty($weight) ? sprintf("%.2f", $weight) : '0.01';
}




with this one:



function fn_get_products_weight($cart, $cart_products, $type = 'S')
{
$weight = 0;

if (is_array($cart_products)) {
foreach ($cart_products as $k => $v) {
if ($type == 'S') {
if (($v['is_edp'] == 'Y' && $v['edp_shipping'] != 'Y') || $v['free_shipping'] == 'Y' || fn_exclude_from_shipping_calculate($cart['products'][$k])) {
continue;
}
} elseif ($type == 'C') {
if (isset($v['exclude_from_calculate'])) {
continue;
}
}

if (isset($v['weight'])) {
$weightpro = ($v['weight'] * $v['amount']);
if ($weightpro >= $weight) {
$weight = $weightpro;
}
}
}
}

return !empty($weight) ? sprintf("%.2f", $weight) : '0.01';
}




in the “fn.cart.php” file, located in the “core” directory.



In this case the system will use the maximum weight of the products and calculate

the shipping cost based on it.