Hello to all,
I'm having some trouble with this shipping module. Here's how I want to setup shipping costs, based on the total amount of the order:
- order < 70 EUR : 10 EUR shipping costs
- 70 EUR < order < 500 EUR : 5% of total order shipping costs
- order > 500 EUR : free shipping
I have succesfully modified the contents of the /includes/modules/shipping/table.php file. The code was (starting from line 105):
PHP Code:
$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]) {
$shipping = $table_cost[$i+1];
break;
}
}
And now the code is:
PHP Code:
$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]) {
$pos = strpos($table_cost[$i+1], '%');
if($pos === false) {
$shipping = $table_cost[$i+1];
}
else {
$shipping_cost_temp = split("%", $table_cost[$i+1]);
$shipping = $order_total * $shipping_cost_temp[0] / 100;
break;
}
}
}
The problem is that every value I input in the table is taken as a percentage of the total order. For instance, if the table is:
Code:
70.00:10.00,499.99:5%
For orders under 70 EUR I don't get 10 EUR of shipping costs, but 10% of the total order. I'm no PHP expert but as far as I see, the code above should already check if the value has the percentage sign (%) in it. So the value should be taken as a percentage of the total order only if it has the % in it.
Any clue or suggestion? This is really frustrating me... Thanks a lot, any help is extremely appreciated!