Your second problem is due to the fact there is no tax applied but module try to calculate it anyway. Suppressing this line won't work if you want to apply some tax on the surcharge, which is probably the case if you already applied some tax everywhere else.
You can modify code as follow:
PHP Code:
if ($charge_it) {
$tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
// calculate from flat fee or percentage
if (substr(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT, -1) == '%') {
$shipping_surcharge = ($order->info['subtotal'] * ((float)MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT/100));
} else {
$shipping_surcharge = MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_AMOUNT;
}
$order->info['total'] += $shipping_surcharge;
if ($tax > 0) {
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_SHIPPINGSURCHARGE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
$order->info['tax'] += zen_calculate_tax($shipping_surcharge, $tax);
$order->info['tax_groups'][$tax_description] += zen_calculate_tax($shipping_surcharge, $tax);
$order->info['total'] += zen_calculate_tax($shipping_surcharge, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$shipping_surcharge += zen_calculate_tax($shipping_surcharge, $tax);
}
}
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($shipping_surcharge, true, $order->info['currency'], $order->info['currency_value']),
'value' => $shipping_surcharge);
}
Bookmarks