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));
     }
 }
     } else {
         $radio_buttons = 0;
         $shipping_modules_array = array();
         for ($i = 0, $n = sizeof($quotes); $i < $n; $i++) {
             if (!isset($quotes[$i]['error'])) {
                 $shipping_modules_methods_array = array();
                 for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j++) {
                     // set the radio button to be checked if it is the method chosen
                     $checked = $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id'] ? true : false;
                     $checked == true || $n == 1 && $n2 == 1 ? $actual_method = true : ($actual_method = false);
                     if ($n > 1 || $n2 > 1) {
                         $several_methods = true;
                         $cost = $currencies->format(xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $quotes[$i]['methods'][$j]['cost'], isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0));
                     } else {
                         $several_methods = false;
                         $cost = $currencies->format(xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax']));
                     }
                     $shipping_modules_methods_array[] = array('radio_field' => xos_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="shipping_' . $radio_buttons . '"'), 'several_methods' => $several_methods, 'hidden_field' => xos_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], 'id="shipping_' . $radio_buttons . '"'), 'cost' => $cost, 'actual_method' => $actual_method, 'title' => $quotes[$i]['methods'][$j]['title'], 'radio_select' => $radio_buttons);
                     $radio_buttons++;
                 }
             }
             $shipping_modules_array[] = array('name' => $quotes[$i]['module'], 'icon' => $quotes[$i]['icon'], 'error' => $quotes[$i]['error'], 'methods' => $shipping_modules_methods_array);
             unset($shipping_modules_methods_array);
         }
     }
     $smarty->assign(array('shipping_modules' => true, 'shipping_modules_array' => $shipping_modules_array));
 }
 $smarty->assign(array('form_begin' => xos_draw_form('checkout_address', xos_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'post', '', true), 'hidden_field' => xos_draw_hidden_field('action', 'process'), 'form_end' => '</form>', 'link_filename_checkout_shipping_address' => MAX_ADDRESS_BOOK_ENTRIES > 1 ? xos_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') : xos_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'address_label' => xos_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, ' ', '<br />'), 'textarea' => xos_draw_textarea_field('comments', '60', '5', $_SESSION['comments'], 'class="form-control" id="checkout_shipping_comments"')));
 $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'checkout_shipping');
 $output_checkout_shipping = $smarty->fetch(SELECTED_TPL . '/checkout_shipping.tpl');
 $smarty->assign('central_contents', $output_checkout_shipping);
Example #3
0
 $products_array = array();
 for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
     $products_tax_rate = xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']);
     $attributes_options_values_price = false;
     if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
         $hidden_field = '';
         $attributes_array = array();
         reset($products[$i]['attributes']);
         while (list($option, $value) = each($products[$i]['attributes'])) {
             $hidden_field = xos_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
             $attributes = xos_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix\n                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                      where pa.products_id = '" . (int) $products[$i]['id'] . "'\n                                       and pa.options_id = '" . (int) $option . "'\n                                       and pa.options_id = popt.products_options_id\n                                       and pa.options_values_id = '" . (int) $value . "'\n                                       and pa.options_values_id = poval.products_options_values_id\n                                       and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                       and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
             $attributes_values = xos_db_fetch_array($attributes);
             $options_values_price = '';
             if ($attributes_values['options_values_price'] != 0) {
                 $attributes_options_values_price = 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);
Example #4
0
 function display_price($products_price, $products_tax, $quantity = 1)
 {
     return $this->format(xos_add_tax($this->currencies[$_SESSION['currency']]['value'] * $products_price, $products_tax) * $quantity);
 }
Example #5
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));
     }
 }
Example #6
0
 function get_products($crrency_value = 1)
 {
     global $customer_group_id;
     if (!is_array($this->contents)) {
         return false;
     }
     $tax_address_query = xos_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) ($this->get_content_type() == 'virtual' ? $_SESSION['billto'] : $_SESSION['sendto']) . "'");
     $tax_address = xos_db_fetch_array($tax_address_query);
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $products_query = xos_db_query("select p.products_id, p.products_delivery_time_id, pd.products_name, pd.products_p_unit, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int) $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'");
         if ($products = xos_db_fetch_array($products_query)) {
             $prid = $products['products_id'];
             $products_tax = xos_get_tax_rate($products['products_tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']);
             $products_prices = xos_get_product_prices($products['products_price']);
             if (isset($products_prices[$customer_group_id][0])) {
                 $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][0]['special'] : ($products_price = $products_prices[$customer_group_id][0]['regular']);
                 $sizeof = count($products_prices[$customer_group_id]);
                 if ($sizeof > 2) {
                     $array_keys = array_keys($products_prices[$customer_group_id]);
                     for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                         $qty = $array_keys[$count];
                         if ($this->contents[$products_id]['qty'] >= $qty) {
                             $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $products_price = $products_prices[$customer_group_id][$qty]['special'] : ($products_price = $products_prices[$customer_group_id][$qty]['regular']);
                         }
                     }
                 }
             } else {
                 $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $products_price = $products_prices[0][0]['special'] : ($products_price = $products_prices[0][0]['regular']);
                 $sizeof = count($products_prices[0]);
                 if ($sizeof > 2) {
                     $array_keys = array_keys($products_prices[0]);
                     for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                         $qty = $array_keys[$count];
                         if ($this->contents[$products_id]['qty'] >= $qty) {
                             $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $products_price = $products_prices[0][$qty]['special'] : ($products_price = $products_prices[0][$qty]['regular']);
                         }
                     }
                 }
             }
             $products_array[] = array('id' => $products_id, 'delivery_time_id' => $products['products_delivery_time_id'], 'name' => $products['products_name'], 'packaging_unit' => $products['products_p_unit'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => xos_add_tax($crrency_value * $products_price, $products_tax), 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => xos_add_tax($crrency_value * $products_price, $products_tax) + $this->attributes_price($products_id, $crrency_value, $products_tax), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '');
         }
     }
     return $products_array;
 }
Example #7
0
 function cart()
 {
     global $currencies;
     $this->content_type = $_SESSION['cart']->get_content_type();
     if ($this->content_type != 'virtual' && $_SESSION['sendto'] == false) {
         $_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
     }
     $customer_address_query = xos_db_query("select c.customers_c_id, c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and c.customers_default_address_id = ab.address_book_id");
     $customer_address = xos_db_fetch_array($customer_address_query);
     if (is_array($_SESSION['sendto']) && !empty($_SESSION['sendto'])) {
         $shipping_address = array('entry_firstname' => $_SESSION['sendto']['firstname'], 'entry_lastname' => $_SESSION['sendto']['lastname'], 'entry_company' => $_SESSION['sendto']['company'], 'entry_street_address' => $_SESSION['sendto']['street_address'], 'entry_suburb' => $_SESSION['sendto']['suburb'], 'entry_postcode' => $_SESSION['sendto']['postcode'], 'entry_city' => $_SESSION['sendto']['city'], 'entry_zone_id' => $_SESSION['sendto']['zone_id'], 'zone_name' => $_SESSION['sendto']['zone_name'], 'entry_country_id' => $_SESSION['sendto']['country_id'], 'countries_id' => $_SESSION['sendto']['country_id'], 'countries_name' => $_SESSION['sendto']['country_name'], 'countries_iso_code_2' => $_SESSION['sendto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['sendto']['country_iso_code_3'], 'address_format_id' => $_SESSION['sendto']['address_format_id'], 'entry_state' => $_SESSION['sendto']['zone_name']);
     } elseif (is_numeric($_SESSION['sendto'])) {
         $shipping_address_query = xos_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) $_SESSION['sendto'] . "'");
         $shipping_address = xos_db_fetch_array($shipping_address_query);
     } else {
         $shipping_address = array('entry_firstname' => null, 'entry_lastname' => null, 'entry_company' => null, 'entry_street_address' => null, 'entry_suburb' => null, 'entry_postcode' => null, 'entry_city' => null, 'entry_zone_id' => null, 'zone_name' => null, 'entry_country_id' => null, 'countries_id' => null, 'countries_name' => null, 'countries_iso_code_2' => null, 'countries_iso_code_3' => null, 'address_format_id' => 0, 'entry_state' => null);
     }
     if (is_array($_SESSION['billto']) && !empty($_SESSION['billto'])) {
         $billing_address = array('entry_firstname' => $_SESSION['billto']['firstname'], 'entry_lastname' => $_SESSION['billto']['lastname'], 'entry_company' => $_SESSION['billto']['company'], 'entry_street_address' => $_SESSION['billto']['street_address'], 'entry_suburb' => $_SESSION['billto']['suburb'], 'entry_postcode' => $_SESSION['billto']['postcode'], 'entry_city' => $_SESSION['billto']['city'], 'entry_zone_id' => $_SESSION['billto']['zone_id'], 'zone_name' => $_SESSION['billto']['zone_name'], 'entry_country_id' => $_SESSION['billto']['country_id'], 'countries_id' => $_SESSION['billto']['country_id'], 'countries_name' => $_SESSION['billto']['country_name'], 'countries_iso_code_2' => $_SESSION['billto']['country_iso_code_2'], 'countries_iso_code_3' => $_SESSION['billto']['country_iso_code_3'], 'address_format_id' => $_SESSION['billto']['address_format_id'], 'entry_state' => $_SESSION['billto']['zone_name']);
     } else {
         $billing_address_query = xos_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int) $_SESSION['customer_id'] . "' and ab.address_book_id = '" . (int) $_SESSION['billto'] . "'");
         $billing_address = xos_db_fetch_array($billing_address_query);
     }
     if ($this->content_type == 'virtual') {
         $tax_address = array('entry_country_id' => $billing_address['entry_country_id'], 'entry_zone_id' => $billing_address['entry_zone_id']);
     } else {
         $tax_address = array('entry_country_id' => $shipping_address['entry_country_id'], 'entry_zone_id' => $shipping_address['entry_zone_id']);
     }
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'currency' => $_SESSION['currency'], 'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => $_SESSION['payment'], 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'shipping_method' => $_SESSION['shipping']['title'], 'shipping_cost' => $_SESSION['shipping']['cost'], 'subtotal' => 0, 'tax' => 0, 'shipping_tax' => 0, 'discount' => 0, 'tax_groups' => array(), 'comments' => $_SESSION['comments']);
     if (isset($GLOBALS[$_SESSION['payment']]) && is_object($GLOBALS[$_SESSION['payment']])) {
         if (isset($GLOBALS[$_SESSION['payment']]->public_title)) {
             $this->info['payment_method'] = $GLOBALS[$_SESSION['payment']]->public_title;
         } else {
             $this->info['payment_method'] = $GLOBALS[$_SESSION['payment']]->title;
         }
         if (isset($GLOBALS[$_SESSION['payment']]->order_status) && is_numeric($GLOBALS[$_SESSION['payment']]->order_status) && $GLOBALS[$_SESSION['payment']]->order_status > 0) {
             $this->info['order_status'] = $GLOBALS[$_SESSION['payment']]->order_status;
         }
     }
     $this->customer = array('c_id' => $customer_address['customers_c_id'], 'firstname' => $customer_address['customers_firstname'], 'lastname' => $customer_address['customers_lastname'], 'company' => $customer_address['entry_company'], 'street_address' => $customer_address['entry_street_address'], 'suburb' => $customer_address['entry_suburb'], 'city' => $customer_address['entry_city'], 'postcode' => $customer_address['entry_postcode'], 'state' => xos_not_null($customer_address['entry_state']) ? $customer_address['entry_state'] : $customer_address['zone_name'], 'zone_id' => $customer_address['entry_zone_id'], 'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']), 'country_id' => $customer_address['countries_id'], 'format_id' => $customer_address['address_format_id'], 'telephone' => $customer_address['customers_telephone'], 'email_address' => $customer_address['customers_email_address']);
     $this->delivery = array('firstname' => $shipping_address['entry_firstname'], 'lastname' => $shipping_address['entry_lastname'], 'company' => $shipping_address['entry_company'], 'street_address' => $shipping_address['entry_street_address'], 'suburb' => $shipping_address['entry_suburb'], 'city' => $shipping_address['entry_city'], 'postcode' => $shipping_address['entry_postcode'], 'state' => xos_not_null($shipping_address['entry_state']) ? $shipping_address['entry_state'] : $shipping_address['zone_name'], 'zone_id' => $shipping_address['entry_zone_id'], 'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']), 'country_id' => $shipping_address['entry_country_id'], 'format_id' => $shipping_address['address_format_id']);
     $this->billing = array('firstname' => $billing_address['entry_firstname'], 'lastname' => $billing_address['entry_lastname'], 'company' => $billing_address['entry_company'], 'street_address' => $billing_address['entry_street_address'], 'suburb' => $billing_address['entry_suburb'], 'city' => $billing_address['entry_city'], 'postcode' => $billing_address['entry_postcode'], 'state' => xos_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], 'zone_id' => $billing_address['entry_zone_id'], 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products($currencies->currencies[$_SESSION['currency']]['value']);
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'model' => $products[$i]['model'], 'name' => $products[$i]['name'], 'packaging_unit' => $products[$i]['packaging_unit'], 'delivery_time_id' => $products[$i]['delivery_time_id'], 'tax' => xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'tax_description' => xos_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['final_price'], 'price_formated' => $currencies->format($products[$i]['price']), 'final_price_formated' => $currencies->format($products[$i]['final_price']), 'total_price_formated' => $currencies->format($products[$i]['quantity'] * $products[$i]['final_price']), 'weight' => $products[$i]['weight'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             reset($products[$i]['attributes']);
             while (list($option, $value) = each($products[$i]['attributes'])) {
                 $attributes_price = '';
                 $attributes_query = xos_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int) $products[$i]['id'] . "' and pa.options_id = '" . (int) $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int) $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int) $_SESSION['languages_id'] . "' and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
                 $attributes = xos_db_fetch_array($attributes_query);
                 $attributes_price = xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $attributes['options_values_price'], xos_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']));
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attributes['products_options_values_name'], 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes_price, 'price_formated' => $currencies->format($attributes_price));
                 $subindex++;
             }
         }
         // $shown_price = $this->products[$index]['final_price'] * $this->products[$index]['qty'];
         $shown_price = round($this->products[$index]['final_price'] * $this->products[$index]['qty'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
             $this->info['tax'] += $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - round($shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)), $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             }
         } else {
             $this->info['tax'] += round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = round($products_tax / 100 * $shown_price, $currencies->currencies[$_SESSION['currency']]['decimal_places']);
             }
         }
         $index++;
     }
     if ($_SESSION['sppc_customer_group_discount'] > 0) {
         $this->info['subtotal'] -= $this->info['discount'] = round($this->info['subtotal'] / 100 * $_SESSION['sppc_customer_group_discount'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
         $this->info['discount'] = 0 - $this->info['discount'];
         reset($this->info['tax_groups']);
         while (list($key, $value) = each($this->info['tax_groups'])) {
             if ($value > 0) {
                 $discount_tax = round($value / 100 * $_SESSION['sppc_customer_group_discount'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
                 $this->info['tax_groups']["{$key}"] -= $discount_tax;
                 $this->info['tax'] -= $discount_tax;
             }
         }
     }
     if ($_SESSION['sppc_customer_group_show_tax'] == '1') {
         $this->info['total'] = $this->info['subtotal'] + round($this->info['currency_value'] * $this->info['shipping_cost'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + round($this->info['currency_value'] * $this->info['shipping_cost'], $currencies->currencies[$_SESSION['currency']]['decimal_places']);
     }
 }