PDA

View Full Version : Shipping table as percent of price above $xx.xx



Anonymous
07-06-2004, 10:31 AM
Is there a simple way to have the shipping be calculated as a percentage of the total price of items in the cart after it goes above a certain threshold amount. So the shipping table woud be 15:3.50,25:5.75,50:8.50,75:9.50,100:10.50,199:12:0 0,10000:6%

Thanks,
Brian

bjrafferty
07-09-2004, 02:17 PM
I think this does the trick in shipping.php :

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if ($order_total <= $table_cost[$i]) {
$prcnt_char = stristr($table_cost[$i+1], ‘%’);
$prcnt = substr($table_cost[$i+1], 0, 1);
if ($prcnt_char == ‘FALSE’) { /* percent calculation only used if '%' found */
$shipping = $table_cost[$i+1];
break;}
else
{$shipping = $order_total * ($prcnt / 100);
break;}
}
}

bjrafferty
07-10-2004, 01:06 PM
Actually the file is \catalog\includes\modules\shipping\table.php