Ejemplo n.º 1
0
 function process()
 {
     global $order, $currencies;
     switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
         case 'national':
             if ($order->delivery['country_id'] == STORE_COUNTRY) {
                 $pass = true;
             }
             break;
         case 'international':
             if ($order->delivery['country_id'] != STORE_COUNTRY) {
                 $pass = true;
             }
             break;
         case 'both':
             $pass = true;
             break;
         default:
             $pass = false;
             break;
     }
     if ($pass == true && ($order->info['total'] - ($_SESSION['sppc_customer_group_show_tax'] == '1' ? 0 : $order->info['shipping_tax']) - $order->info['shipping_cost']) / $order->info['currency_value'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
         $tax = xos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_description = xos_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_value = round($order->info['currency_value'] * xos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $order->info['tax'] += $tax_value;
         $order->info['tax_groups']["{$tax_description}"] += $tax_value;
         $order->info['total'] += round($order->info['currency_value'] * MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $currencies->currencies[$_SESSION['currency']]['decimal_places']) + $tax_value;
         $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(xos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), $order->info['currency_value']), 'value' => round(xos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax) * $order->info['currency_value'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 'tax' => xos_display_tax_value($tax));
     }
 }
Ejemplo n.º 2
0
 function process()
 {
     global $order, $currencies;
     $cod_country = false;
     if ($_SESSION['payment'] == 'cod') {
         if ($_SESSION['shipping']['id'] == 'flat_flat') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
         }
         if ($_SESSION['shipping']['id'] == 'item_item') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
         }
         if ($_SESSION['shipping']['id'] == 'table_table') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
         }
         if ($_SESSION['shipping']['id'] == 'usps_usps') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_USPS);
         }
         if ($_SESSION['shipping']['id'] == 'zones_zones') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
         }
         if ($_SESSION['shipping']['id'] == 'free_free') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
         }
         for ($i = 0; $i < count($cod_zones); $i++) {
             if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
                 break;
             } elseif ($cod_zones[$i] == '00') {
                 $cod_cost = $cod_zones[$i + 1];
                 $cod_country = true;
             }
             $i++;
         }
     }
     if ($cod_country) {
         $tax = xos_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_description = xos_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $tax_value = round($order->info['currency_value'] * xos_calculate_tax($cod_cost, $tax), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $order->info['tax'] += $tax_value;
         $order->info['tax_groups']["{$tax_description}"] += $tax_value;
         $order->info['total'] += round($order->info['currency_value'] * $cod_cost, $currencies->currencies[$_SESSION['currency']]['decimal_places']) + $tax_value;
         $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(xos_add_tax($cod_cost, $tax), $order->info['currency_value']), 'value' => round(xos_add_tax($cod_cost, $tax) * $order->info['currency_value'], $currencies->currencies[$_SESSION['currency']]['decimal_places']), 'tax' => xos_display_tax_value($tax));
     }
 }
Ejemplo n.º 3
0
 function process()
 {
     global $order, $currencies;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($order->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($order->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $_SESSION['cart']->get_content_type() != 'virtual' && $order->info['subtotal'] >= $currencies->currencies[$_SESSION['currency']]['value'] * MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $order->info['shipping_method'] = FREE_SHIPPING_TITLE;
             //          $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (xos_not_null($order->info['shipping_method'])) {
         $order->info['shipping_cost'] = $order->info['currency_value'] * $order->info['shipping_cost'];
         //        if ($GLOBALS[$module]->tax_class > 0) {
         $shipping_tax = xos_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax_description = xos_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $shipping_tax_value = xos_calculate_tax($order->info['shipping_cost'], $shipping_tax);
         $order->info['tax'] += $order->info['shipping_tax'] = $shipping_tax_value;
         $order->info['tax_groups']["{$shipping_tax_description}"] += $shipping_tax_value;
         $order->info['total'] += $shipping_tax_value;
         if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
             $order->info['shipping_cost'] += $shipping_tax_value;
         }
         //        }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost']), 'value' => $order->info['shipping_cost'], 'tax' => $order->info['shipping_method'] == FREE_SHIPPING_TITLE || strpos($order->info['shipping_method'], MODULE_SHIPPING_STORE_PICKUP_TEXT_TITLE) !== false && $order->info['shipping_cost'] == 0 ? -1 : xos_display_tax_value($shipping_tax));
     }
 }
Ejemplo n.º 4
0
function xos_add_tax($price, $tax)
{
    global $currencies;
    if ($tax > 0 && $_SESSION['sppc_customer_group_show_tax'] == '1') {
        return round($price, $currencies->currencies[$_SESSION['currency']]['decimal_places']) + xos_calculate_tax($price, $tax);
    } else {
        return round($price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
    }
}