I've copied the code for the modifier I'm using below. The costs are displayed correctly at the checkout before being redirected to paypal, but are not sent with the total to paypal. Any help is very welcome.
<?php
/**
* @package ecommerce
*/
/**
* DeliverychargeModifier is based on the default shipping calculation scheme.
* It lets you set shipping costs by quantity
*/
class DeliveryChargeModifier extends OrderModifier {
protected static $is_chargable = true;
static $default_charge = 0.7;
/*static $charges_by_quantity = array( 1 => 0.7, 4 => 1.5, 7 => 3);*/
static $charges_by_quantity = array( 1 => 1.48, 2 => 1.78, 3 => 5.90, 4 => 7.90, 5 => 9.75, 8 => 11.25, 9 => 16.0);
static function set_charges($charge) {
self::$default_charge = $charge;
}
function LiveAmount() {
$o = ShoppingCart::current_order();
$orderItems = $o->Items();
// Calculate the total quantity of the order
if($orderItems){
foreach($orderItems as $orderItem){
$totalQuantity += $orderItem->quantity;
}
}
//calculate packaging cost
foreach(self::$charges_by_quantity as $quan => $price){
if ($totalQuantity >= $quan){
$totalCost = $price;// * $totalQuantity;
}
}
return $totalCost;
}
// Display Functions
function TableTitle() {
return "Postage and packaging";
}
function CartTitle() {return 'Postage and packaging: ';}
}
?>