
Originally Posted by
diptimoy
Herehow to processing configuration looks


Originally Posted by
Spanky
PHP Code:
function process() {
global $order, $currencies;
if (MODULE_ORDER_TOTAL_EXTRAORDERFEE_ORDER_FEE == 'true') {
$pass = true;
if (MODULE_ORDER_TOTAL_EXTRAORDERFEE_ZONE > 0) {
// bof: check zone and add extra fee
global $db;
$pass = false;
$check_flag = false;
// based on Delivery zone $order->delivery to use Payment zone change to $order->billing in two places
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_ORDER_TOTAL_EXTRAORDERFEE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == false) {
$pass = false;
} else {
$pass = true;
}
// eof: check zone and add extra fee
}
if ($pass == true) {
//echo 'TEST EXTRA CHARGE PASS!';
$tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_EXTRAORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_EXTRAORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
// calculate from flat fee or percentage
if (substr(MODULE_ORDER_TOTAL_EXTRAORDERFEE_FEE, -1) == '%') {
//$extra_order_fee = (($order->info['subtotal']+$order->info['shipping_cost'])* (MODULE_ORDER_TOTAL_EXTRAORDERFEE_FEE/100));
$extra_order_fee = ($order->info['subtotal'] * (MODULE_ORDER_TOTAL_EXTRAORDERFEE_FEE/100));
} else {
$extra_order_fee = MODULE_ORDER_TOTAL_EXTRAORDERFEE_FEE;
}
$order->info['tax'] += zen_calculate_tax($extra_order_fee, $tax);
$order->info['tax_groups']["$tax_description"] += zen_calculate_tax($extra_order_fee, $tax);
$order->info['total'] += $extra_order_fee + zen_calculate_tax($extra_order_fee, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$extra_order_fee += zen_calculate_tax($extra_order_fee, $tax);
}
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($extra_order_fee, true, $order->info['currency'], $order->info['currency_value']),
'value' => $extra_order_fee);
} else {
//echo 'TEST EXTRA CHARGE NO PASS!';
}
}
}
Bookmarks