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)); } }
$order_attributes_array = array(); for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) { $options_values_price = ''; if ($order->products[$i]['attributes'][$j]['price'] != 0) { $attributes_options_values_price = true; $options_values_price = $order->products[$i]['attributes'][$j]['price_formated']; } $order_attributes_array[] = array('option_name' => $order->products[$i]['attributes'][$j]['option'], 'option_value_name' => $order->products[$i]['attributes'][$j]['value'], 'option_price' => $options_values_price, 'option_price_prefix' => $order->products[$i]['attributes'][$j]['prefix']); } } $order_products_array[] = array('qty' => $order->products[$i]['qty'], 'model' => $order->products[$i]['model'], 'name' => $order->products[$i]['name'], 'packaging_unit' => $order->products[$i]['packaging_unit'], 'tax' => xos_display_tax_value($order->products[$i]['tax']), 'price' => $order->products[$i]['price_formated'], 'final_single_price' => $order->products[$i]['final_price_formated'], 'final_price' => $order->products[$i]['total_price_formated'], 'products_attributes_option_price' => $attributes_options_values_price, 'product_attributes' => $order_attributes_array); unset($order_attributes_array); } $order_totals_array = array(); for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) { $order_totals_array[] = array('totals_title' => $order->totals[$i]['title'], 'totals_text' => $order->totals[$i]['text'], 'totals_tax' => $order->totals[$i]['class'] == 'ot_shipping' || $order->totals[$i]['class'] == 'ot_loworderfee' || $order->totals[$i]['class'] == 'ot_cod_fee' ? xos_display_tax_value($order->totals[$i]['tax']) : -1); } $statuses_query = xos_db_query("select os.orders_status_name, osh.date_added, osh.comments from " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh where osh.orders_id = '" . (int) $_GET['order_id'] . "' and osh.orders_status_id = os.orders_status_id and os.language_id = '" . (int) $_SESSION['languages_id'] . "' and os.public_flag = '1' order by osh.date_added, osh.orders_status_history_id"); $statuses_array = array(); while ($statuses = xos_db_fetch_array($statuses_query)) { $statuses_array[] = array('order_date_added' => xos_date_short($statuses['date_added']), 'order_status_name' => $statuses['orders_status_name'], 'order_comments' => empty($statuses['comments']) ? ' ' : nl2br(xos_output_string_protected($statuses['comments']))); } $back = sizeof($_SESSION['navigation']->path) - 2; if (!empty($_SESSION['navigation']->path[$back])) { $get_params_array = $_SESSION['navigation']->path[$back]['get']; $get_params_array['rmp'] = '0'; $back_link = xos_href_link($_SESSION['navigation']->path[$back]['page'], xos_array_to_query_string($get_params_array, array('action', xos_session_name())), $_SESSION['navigation']->path[$back]['mode']); } else { $back_link = 'javascript:history.go(-1)'; } $smarty->assign(array('order_id' => $_GET['order_id'], 'orders_status' => $order->info['orders_status'], 'date_purchased' => xos_date_long($order->info['date_purchased']), 'order_total' => $order->info['total'], 'order_products' => $order_products_array, 'billing_address' => xos_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br />'), 'payment_method' => $order->info['payment_method'], 'order_totals' => $order_totals_array, 'statuses' => $statuses_array, 'link_back' => $back_link));
$sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $order->products[$i]['attributes'][$j]['price'], 'options_values_price_text' => $order->products[$i]['attributes'][$j]['price'] != 0 ? $order->products[$i]['attributes'][$j]['price_formated'] : '', 'price_prefix' => $attributes_values['price_prefix']); xos_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if (DOWNLOAD_ENABLED == 'true' && isset($attributes_values['products_attributes_filename']) && xos_not_null($attributes_values['products_attributes_filename'])) { $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount']); xos_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } $options_values_price = ''; if ($attributes_values['options_values_price'] != 0) { $attributes_options_values_price = true; $options_values_price = $order->products[$i]['attributes'][$j]['price_formated']; } $order_attributes_array[] = array('option_name' => $attributes_values['products_options_name'], 'option_value_name' => $attributes_values['products_options_values_name'], 'option_price' => $options_values_price, 'option_price_prefix' => $attributes_values['price_prefix']); } } //------insert customer choosen option eof ---- $tax_rate = xos_display_tax_value($order->products[$i]['tax']); $order_products_array[] = array('qty' => $order->products[$i]['qty'], 'model' => $order->products[$i]['model'], 'name' => $order->products[$i]['name'], 'packaging_unit' => $order->products[$i]['packaging_unit'], 'tax_value' => $tax_rate, 'price' => $order->products[$i]['price_formated'], 'final_single_price' => $order->products[$i]['final_price_formated'], 'final_price' => $order->products[$i]['total_price_formated'], 'products_attributes_option_price' => $attributes_options_values_price, 'product_attributes' => $order_attributes_array); if (isset($tax_rate)) { $tax_rates[$tax_rate] = '1'; } unset($order_attributes_array); } $order_totals_array = array(); for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { $order_totals_array[] = array('totals_title' => $order_totals[$i]['title'], 'totals_text' => $order_totals[$i]['text'], 'totals_tax' => $order_totals[$i]['tax']); if ($order_totals[$i]['tax'] > -1) { $tax_rates[$order_totals[$i]['tax']] = '1'; } } // lets start with the email confirmation if (SEND_EMAILS == 'true') {
$options_values_price = $currencies->format(xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $attributes_values['options_values_price'], $products_tax_rate)); } $attributes_array[] = array('products_options_name' => $attributes_values['products_options_name'], 'options_values_id' => $value, 'products_options_values_name' => $attributes_values['products_options_values_name'], 'options_values_price' => $options_values_price, 'hidden_field' => $hidden_field, 'price_prefix' => $attributes_values['price_prefix']); } } if (STOCK_CHECK == 'true') { $stock_check = xos_check_stock($products[$i]['id'], $products[$i]['quantity']); if (xos_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= $stock_check; } } $tax_rate = xos_display_tax_value($products_tax_rate); $product_image = xos_get_product_images($products[$i]['image']); $popup_content_id = xos_get_delivery_times_values($products[$i]['delivery_time_id'], 'popup_content_id'); $products_array[] = array('checkbox_cart_delete' => xos_draw_checkbox_field('cart_delete[]', $products[$i]['id'], false, 'id="cart_delete_' . ($i + 1) . '"'), 'link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . urlencode($products[$i]['id'])), 'link_remove_product' => xos_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&rmp=0&p=' . urlencode($products[$i]['id'])), 'products_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($product_image['name']), $products[$i]['name']), 'products_name' => $products[$i]['name'], 'products_packaging_unit' => $products[$i]['packaging_unit'], 'products_delivery_time' => xos_get_delivery_times_values($products[$i]['delivery_time_id']), 'link_filename_popup_content_products_delivery_time' => $popup_content_id > 0 ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=' . $popup_content_id . '&p=' . $products[$i]['id'], $request_type) : '', 'products_model' => $products[$i]['model'], 'stock_check' => $stock_check, 'input_and_hidden_fields_quantity' => xos_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'id="cart_quantity_' . ($i + 1) . '" class="form-control cart-input-quantity" size="2" maxlength="5"') . xos_draw_hidden_field('p[]', $products[$i]['id']), 'products_tax' => xos_display_tax_value($products_tax_rate), 'products_price' => $currencies->format($products[$i]['price']), 'products_final_single_price' => $currencies->format($products[$i]['final_price']), 'products_final_price' => $currencies->format($products[$i]['quantity'] * $products[$i]['final_price']), 'products_attributes_option_price' => $attributes_options_values_price, 'products_attributes' => $attributes_array); if (isset($tax_rate)) { $tax_rates[$tax_rate] = '1'; } unset($attributes_array); } include DIR_WS_CLASSES . 'payment.php'; $payment_modules = new payment(); $initialize_checkout_methods = $payment_modules->checkout_initialization_method(); $alternative_checkout_methods_array = array(); if (!empty($initialize_checkout_methods)) { reset($initialize_checkout_methods); while (list(, $value) = each($initialize_checkout_methods)) { $alternative_checkout_methods_array[] = array('value' => $value); } }
function xos_get_products_tax_description($class_id, $tax_rate) { if ($_SESSION['sppc_customer_group_tax_exempt'] == '1') { return 'SMARTY_TAX_WITHOUT_VAT'; } elseif (!$tax_rate > 0) { return 'SMARTY_TAX_NO_VAT'; } elseif (FULL_TAX_INFO == 'true') { if (!isset($_SESSION['customer_id'])) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $_SESSION['customer_country_id']; $zone_id = $_SESSION['customer_zone_id']; } $tax_query = xos_db_query("select tax_description from " . TABLE_TAX_RATES_DESCRIPTION . " trd, " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where trd.tax_rates_id = tr.tax_rates_id and (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int) $country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int) $zone_id . "') and tr.tax_class_id = '" . (int) $class_id . "' and trd.language_id = '" . (int) $_SESSION['languages_id'] . "' order by tr.tax_priority"); if (xos_db_num_rows($tax_query)) { $tax_description = ''; while ($tax = xos_db_fetch_array($tax_query)) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr($tax_description, 0, -3); if ($_SESSION['sppc_customer_group_show_tax'] == '1') { $products_tax_description = TEXT_TAX_INC_VAT . ' [' . $tax_description . '] (' . xos_display_tax_value($tax_rate) . '%)'; } else { $products_tax_description = TEXT_TAX_PLUS_VAT . ' [' . $tax_description . '] (' . xos_display_tax_value($tax_rate) . '%)'; } return $products_tax_description; } else { return TEXT_UNKNOWN_TAX_RATE; } } elseif ($_SESSION['sppc_customer_group_show_tax'] == '1') { return 'SMARTY_TAX_INC_VAT (' . xos_display_tax_value($tax_rate) . '%)'; } else { return 'SMARTY_TAX_PLUS_VAT (' . xos_display_tax_value($tax_rate) . '%)'; } }
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)); } }
require DIR_WS_INCLUDES . 'header.php'; require DIR_WS_INCLUDES . 'column_left.php'; require DIR_WS_INCLUDES . 'footer.php'; $rates_query_raw = "select r.tax_rates_id, z.geo_zone_id, z.geo_zone_name, tc.tax_class_title, tc.tax_class_id, r.tax_priority, r.tax_rate, r.date_added, r.last_modified from " . TABLE_TAX_CLASS . " tc, " . TABLE_TAX_RATES . " r left join " . TABLE_GEO_ZONES . " z on r.tax_zone_id = z.geo_zone_id where r.tax_class_id = tc.tax_class_id"; $rates_split = new splitPageResults($_GET['page'], MAX_DISPLAY_RESULTS, $rates_query_raw, $rates_query_numrows); $rates_query = xos_db_query($rates_query_raw); $rates_array = array(); while ($rates = xos_db_fetch_array($rates_query)) { if ((!isset($_GET['tID']) || isset($_GET['tID']) && $_GET['tID'] == $rates['tax_rates_id']) && !isset($trInfo) && substr($action, 0, 3) != 'new') { $trInfo = new objectInfo($rates); } $selected = false; if (isset($trInfo) && is_object($trInfo) && $rates['tax_rates_id'] == $trInfo->tax_rates_id) { $selected = true; $link_filename_tax_rates = xos_href_link(FILENAME_TAX_RATES, 'page=' . $_GET['page'] . '&tID=' . $trInfo->tax_rates_id . '&action=edit'); } else { $link_filename_tax_rates = xos_href_link(FILENAME_TAX_RATES, 'page=' . $_GET['page'] . '&tID=' . $rates['tax_rates_id']); } $rates_array[] = array('selected' => $selected, 'link_filename_tax_rates' => $link_filename_tax_rates, 'tax_priority' => $rates['tax_priority'], 'tax_class_title' => $rates['tax_class_title'], 'geo_zone_name' => $rates['geo_zone_name'], 'tax_rate' => xos_display_tax_value($rates['tax_rate'])); } if (empty($action)) { $smarty->assign('link_filename_tax_rates_action_new', xos_href_link(FILENAME_TAX_RATES, 'page=' . $_GET['page'] . '&tID=' . $trInfo->tax_rates_id . '&action=new')); } $smarty->assign(array('BODY_TAG_PARAMS' => 'onload="SetFocus();"', 'rates' => $rates_array, 'nav_bar_number' => $rates_split->display_count($rates_query_numrows, MAX_DISPLAY_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_TAX_RATES), 'nav_bar_result' => $rates_split->display_links($rates_query_numrows, MAX_DISPLAY_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']))); require DIR_WS_BOXES . 'infobox_tax_rates.php'; $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'tax_rates'); $output_tax_rates = $smarty->fetch(ADMIN_TPL . '/tax_rates.tpl'); $smarty->assign('central_contents', $output_tax_rates); $smarty->display(ADMIN_TPL . '/frame.tpl'); require DIR_WS_INCLUDES . 'application_bottom.php'; }
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)); } }