This is the whole function process:
Code:
function process() {
global $order, $currencies, $db;
$order_total = $this->get_order_total();
$od_amount = $this->calculate_deductions($order_total['total']);
$this->deduction = $od_amount['total'];
if ($od_amount['total'] > 0) {
reset($order->info['tax_groups']);
$tax = 0;
while (list($key, $value) = each($order->info['tax_groups'])) {
if ($od_amount['tax_groups'][$key]) {
$order->info['tax_groups'][$key] -= $od_amount['tax_groups'][$key];
$tax += $od_amount['tax_groups'][$key];
}
}
if ($od_amount['type'] == 'S') $order->info['shipping_cost'] = 0;
$order->info['total'] = $order->info['total'] - $od_amount['total'];
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$od_amount['total'] += $tax;
}
if ($this->calculate_tax == "Standard") $order->info['total'] -= $tax;
if ($order->info['total'] < 0) $order->info['total'] = 0;
$order->info['tax'] = $order->info['tax'] - $tax;
$group_query = $db->Execute("select customers_group_pricing from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");
$group_discount = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . "
where group_id = '" . (int)$group_query->fields['customers_group_pricing'] . "'");
$this->output[] = array('title' => $this->title . ':' . ' ' . $group_discount->fields['group_name'],
'text' => '-' . $currencies->format($od_amount['total'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $od_amount['total']);
}
}