Exemplo n.º 1
0
 function query($order_id)
 {
     global $shipping;
     $order_query = vam_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
     $order = vam_db_fetch_array($order_query);
     $totals_query = vam_db_query("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
     while ($totals = vam_db_fetch_array($totals_query)) {
         $this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class'], 'value' => $totals['value'], 'sort_order' => $totals['sort_order'], 'orders_total_id' => $totals['orders_total_id']);
     }
     $this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'payment_class' => $order['payment_class'], 'shipping_class' => $order['shipping_class'], 'status' => $order['customers_status'], 'status_name' => $order['customers_status_name'], 'status_image' => $order['customers_status_image'], 'status_discount' => $order['customers_status_discount'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'cc_cvv' => $order['cc_cvv'], 'comments' => $order['comments'], 'language' => $order['language'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified'], 'shipping_method' => $shipping['title'], 'shipping_cost' => $shipping['cost'], 'shipping_id' => $order['shipping_module'], 'subtotal' => 0, 'tax' => 0, 'tax_groups' => array());
     $this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], 'csID' => $order['customers_cid'], 'vat_id' => $order['customers_vat_id'], 'shop_id' => $order['shop_id'], 'ID' => $order['customers_id'], 'cIP' => $order['customers_ip'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'country_id' => oe_get_country_id($order['customers_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['customers_country']), $order['customers_state']), 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address'], 'orig_reference' => $order['orig_reference'], 'login_reference' => $order['login_reference']);
     $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'country_id' => oe_get_country_id($order['delivery_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['delivery_country']), $order['delivery_state']), 'format_id' => $order['delivery_address_format_id']);
     $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'country_id' => oe_get_country_id($order['billing_country']), 'zone_id' => oe_get_zone_id(oe_get_country_id($order['billing_country']), $order['billing_state']), 'format_id' => $order['billing_address_format_id']);
     $index = 0;
     $orders_products_query = vam_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' order by orders_products_id");
     while ($orders_products = vam_db_fetch_array($orders_products_query)) {
         $orders_products_tax_query = vam_db_query("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = " . $orders_products['products_id'] . "");
         $orders_products_tax = vam_db_fetch_array($orders_products_tax_query);
         $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'tax_description' => vam_get_tax_description($orders_products_tax['products_tax_class_id'], $this->delivery["country_id"], $this->delivery["zone_id"]), 'price' => $orders_products['products_price'], 'final_price' => $orders_products['products_price'] * $orders_products['products_quantity'], 'products_id' => $orders_products['products_id'], 'orders_products_id' => $orders_products['orders_products_id']);
         $subindex = 0;
         $attributes_query = vam_db_query("select products_options, products_options_values, options_values_price, price_prefix, orders_products_attributes_id from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
         if (vam_db_num_rows($attributes_query)) {
             while ($attributes = vam_db_fetch_array($attributes_query)) {
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
                 $subindex++;
             }
         }
         $shown_price = vam_add_tax($this->products[$index]['price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         $products_tax_description = $this->products[$index]['tax_description'];
         if (DISPLAY_PRICE_WITH_TAX == 'true') {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             }
         } else {
             $this->info['tax'] += $products_tax / 100 * $shown_price;
             if (isset($this->info['tax_groups']["{$products_tax_description}"])) {
                 $this->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
             } else {
                 $this->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
             }
         }
         $index++;
     }
     if (DISPLAY_PRICE_WITH_TAX == 'true') {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
Exemplo n.º 2
0
 function process()
 {
     global $order, $vamPrice;
     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 && $order->info['total'] - $order->info['shipping_cost'] >= $vamPrice->Format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, false, 0, true)) {
             $order->info['shipping_method'] = $this->title;
             $order->info['total'] -= $order->info['shipping_cost'];
             $order->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (vam_not_null($order->info['shipping_method'])) {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             // price with tax
             $shipping_tax = vam_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $shipping_tax_description = vam_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax = $vamPrice->Format(vam_add_tax($order->info['shipping_cost'], $shipping_tax), false, 0, false) - $order->info['shipping_cost'];
             $tax = $vamPrice->Format($tax, false, 0, true);
             $order->info['shipping_cost'] = vam_add_tax($order->info['shipping_cost'], $shipping_tax);
             $order->info['tax'] += $tax;
             $order->info['tax_groups'][TAX_ADD_TAX . "{$shipping_tax_description}"] += $tax;
             $order->info['total'] += $tax;
         } else {
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $shipping_tax = vam_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                 $shipping_tax_description = vam_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
                 $tax = $vamPrice->Format(vam_add_tax($order->info['shipping_cost'], $shipping_tax), false, 0, false) - $order->info['shipping_cost'];
                 $tax = $vamPrice->Format($tax, false, 0, true);
                 $order->info['tax'] = $order->info['tax'] += $tax;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] = $order->info['tax_groups'][TAX_NO_TAX . "{$shipping_tax_description}"] += $tax;
             }
         }
         $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $vamPrice->Format($order->info['shipping_cost'], true, 0, true), 'value' => $vamPrice->Format($order->info['shipping_cost'], false, 0, true));
     }
 }
Exemplo n.º 3
0
 function process()
 {
     global $order, $vamPrice;
     //include needed functions
     require_once DIR_FS_INC . 'vam_calculate_tax.inc.php';
     if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') {
         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'] - $order->info['shipping_cost'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) {
             $tax = vam_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $tax_description = vam_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $order->info['tax'] += vam_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$tax_description}"] += vam_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + vam_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $low_order_fee = vam_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
                 $order->info['tax'] += vam_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['tax_groups'][TAX_NO_TAX . "{$tax_description}"] += vam_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
                 $order->info['subtotal'] += $low_order_fee;
                 $order->info['total'] += $low_order_fee;
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] != 1) {
                 $low_order_fee = MODULE_ORDER_TOTAL_LOWORDERFEE_FEE;
                 $order->info['subtotal'] += $low_order_fee;
                 $order->info['total'] += $low_order_fee;
             }
             $this->output[] = array('title' => $this->title . ':', 'text' => $vamPrice->Format($low_order_fee, true), 'value' => $low_order_fee);
         }
     }
 }
Exemplo n.º 4
0
 function process_button()
 {
     global $currencies, $currency, $order;
     $process_button_string = vam_draw_hidden_field('sid', MODULE_PAYMENT_PM2CHECKOUT_LOGIN) . vam_draw_hidden_field('total', number_format($order->info['total'], 2)) . vam_draw_hidden_field('cart_order_id', date('YmdHis')) . vam_draw_hidden_field('fixed', 'Y') . vam_draw_hidden_field('card_holder_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']) . vam_draw_hidden_field('street_address', $order->billing['street_address']) . vam_draw_hidden_field('city', $order->billing['city']) . vam_draw_hidden_field('state', $order->billing['state']) . vam_draw_hidden_field('zip', $order->billing['postcode']) . vam_draw_hidden_field('country', $order->billing['country']['title']) . vam_draw_hidden_field('email', $order->customer['email_address']) . vam_draw_hidden_field('phone', $order->customer['telephone']) . vam_draw_hidden_field('ship_street_address', $order->delivery['street_address']) . vam_draw_hidden_field('ship_city', $order->delivery['city']) . vam_draw_hidden_field('ship_state', $order->delivery['state']) . vam_draw_hidden_field('ship_zip', $order->delivery['postcode']) . vam_draw_hidden_field('ship_country', $order->delivery['country']['title']);
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         $process_button_string .= vam_draw_hidden_field('c_prod_' . ($i + 1), (int) $order->products[$i]['id'] . ',' . (int) $order->products[$i]['qty']) . vam_draw_hidden_field('c_name_' . ($i + 1), $order->products[$i]['name']) . vam_draw_hidden_field('c_description_' . ($i + 1), $order->products[$i]['name']) . vam_draw_hidden_field('c_price_' . ($i + 1), number_format(vam_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), $currencies->currencies[$currency]['decimal_places']));
     }
     $process_button_string .= vam_draw_hidden_field('id_type', '1');
     if (MODULE_PAYMENT_PM2CHECKOUT_TESTMODE == 'Test') {
         $process_button_string .= vam_draw_hidden_field('demo', 'Y');
     }
     $process_button_string .= vam_draw_hidden_field('return_url', vam_href_link(FILENAME_SHOPPING_CART));
     $lang_query = vam_db_query("select code from " . TABLE_LANGUAGES . " where languages_id = '" . (int) $_SESSION['languages_id'] . "'");
     $lang = vam_db_fetch_array($lang_query);
     switch (strtolower($lang['code'])) {
         case 'es':
             $process_button_string .= vam_draw_hidden_field('lang', 'sp');
             break;
     }
     $process_button_string .= vam_draw_hidden_field('cart_brand_name', 'oscommerce') . vam_draw_hidden_field('cart_version_name', PROJECT_VERSION);
     return $process_button_string;
 }
Exemplo n.º 5
0
 function selection()
 {
     global $vamPrice, $order;
     if (MODULE_ORDER_TOTAL_COD_FEE_STATUS == 'true') {
         $cod_country = false;
         //process installed shipping modules
         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'] == 'zones_zones') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
         }
         if ($_SESSION['shipping']['id'] == 'ap_ap') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_AP);
         }
         if ($_SESSION['shipping']['id'] == 'dp_dp') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_ECO') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_PRI') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chp_URG') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
         }
         if ($_SESSION['shipping']['id'] == 'chronopost_chronopost') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_ECX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_DOX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_SDX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_MDX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'dhl_WPX') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
         }
         if ($_SESSION['shipping']['id'] == 'ups_ups') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPS);
         }
         if ($_SESSION['shipping']['id'] == 'upse_upse') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPSE);
         }
         if ($_SESSION['shipping']['id'] == 'free_free') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
         }
         if ($_SESSION['shipping']['id'] == 'freeamount_freeamount') {
             $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_FREEAMOUNT_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;
                 break;
             } else {
             }
             $i++;
         }
     } else {
         //COD selected, but no shipping module which offers COD
     }
     if ($cod_country) {
         $cod_tax = vam_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         $cod_tax_description = vam_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $cod_cost_value = vam_add_tax($cod_cost, $cod_tax);
             $cod_cost = $vamPrice->Format($cod_cost_value, true);
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $cod_cost_value = $cod_cost;
             $cod_cost = $vamPrice->Format($cod_cost, true);
         }
         if (!$cod_cost_value) {
             $cod_cost_value = $cod_cost;
             $cod_cost = $vamPrice->Format($cod_cost, true);
         }
         $this->cost = '+ ' . $cod_cost;
     }
     return array('id' => $this->code, 'module' => $this->title, 'description' => $this->info, 'module_cost' => $this->cost);
 }
Exemplo n.º 6
0
 function display_price($products_price, $products_tax, $quantity = 1)
 {
     return $this->format(vam_add_tax($products_price, $products_tax) * $quantity);
 }
function vam_get_products_price_export($products_id, $price_special, $quantity, $group_id = 0, $add_tax = 1, $currency, $calculate_currencies = true)
{
    // load price data into array for further use!
    $product_price_query = vam_db_query("SELECT   products_price,\n                                            products_discount_allowed,\n                                            products_tax_class_id\n                                            FROM " . TABLE_PRODUCTS . "\n                                            WHERE\n                                            products_id = '" . $products_id . "'");
    $product_price = vam_db_fetch_array($product_price_query);
    $price_data = array();
    $price_data = array('PRODUCTS_PRICE' => $product_price['products_price'], 'PRODUCTS_DISCOUNT_ALLOWED' => $product_price['products_discount_allowed'], 'PRODUCT_TAX_CLASS_ID' => $product_price['products_tax_class_id']);
    // get tax rate for tax class
    $products_tax = vam_get_tax_rate_export($price_data['PRODUCT_TAX_CLASS_ID']);
    // check if user is allowed to see tax rates
    if ($add_tax == '0') {
        $products_tax = '';
    }
    // end $_SESSION['customers_status']['customers_status_show_price_tax'] =='0'
    // check if special price is aviable for product (no product discount on special prices!)
    if ($special_price = vam_get_products_special_price($products_id)) {
        $special_price = vam_add_tax($special_price, $products_tax);
        $price_data['PRODUCTS_PRICE'] = vam_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
        $price_string = vam_format_special_price_export($special_price, $price_data['PRODUCTS_PRICE'], $price_special, $calculate_currencies = true, $quantity, $products_tax, $add_tax, $currency);
    } else {
        // if ($special_price=vam_get_products_special_price($products_id))
        // Check if there is another price for customers_group (if not, take norm price and calculte discounts (NOTE: no discount on group PRICES(only OT DISCOUNT!)!
        $group_price_query = vam_db_query("SELECT personal_offer\n                                             FROM " . TABLE_PERSONAL_OFFERS . $group_id . "\n                                             WHERE products_id='" . $products_id . "'");
        $group_price_data = vam_db_fetch_array($group_price_query);
        // if we found a price, everything is ok if not, we will use normal price
        if ($group_price_data['personal_offer'] != '' and $group_price_data['personal_offer'] != '0.0000') {
            $price_string = $group_price_data['personal_offer'];
            // check if customer is allowed to get graduated prices
            //         if ($_SESSION['customers_status']['customers_status_graduated_prices']=='1'){
            // check if there are graduated prices in db
            // get quantity for products
            // modifikations for new graduated prices
            $qty = vam_get_qty($products_id);
            if (!vam_get_qty($products_id)) {
                $qty = $quantity;
            }
            $graduated_price_query = vam_db_query("SELECT max(quantity)\n                                                          FROM " . TABLE_PERSONAL_OFFERS . $group_id . "\n                                                          WHERE products_id='" . $products_id . "'\n                                                          AND quantity<='" . $qty . "'");
            $graduated_price_data = vam_db_fetch_array($graduated_price_query);
            // get singleprice
            $graduated_price_query = vam_db_query("SELECT personal_offer\n                                                          FROM " . TABLE_PERSONAL_OFFERS . $group_id . "\n                                                          WHERE products_id='" . $products_id . "'\n                                                            AND quantity='" . $graduated_price_data['max(quantity)'] . "'");
            $graduated_price_data = vam_db_fetch_array($graduated_price_query);
            $price_string = $graduated_price_data['personal_offer'];
            //     } // end $_SESSION['customers_status']['customers_status_graduated_prices']=='1'
            $price_string = vam_add_tax($price_string, $products_tax);
            //*$quantity;
        } else {
            // if     ($group_price_data['personal_offer']!='' and $group_price_data['personal_offer']!='0.0000')
            $price_string = vam_add_tax($price_data['PRODUCTS_PRICE'], $products_tax);
            //*$quantity;
            // check if product allows discount
        }
        // format price & calculate currency
        $price_string = $price_string * $quantity;
        // currency calculations
        $currencies_query = vam_db_query("SELECT *\n          FROM " . TABLE_CURRENCIES . " WHERE\n          code = '" . $currency . "'");
        $currencies_value = vam_db_fetch_array($currencies_query);
        $currencies_data = array();
        $currencies_data = array('SYMBOL_LEFT' => $currencies_value['symbol_left'], 'SYMBOL_RIGHT' => $currencies_value['symbol_right'], 'DECIMAL_PLACES' => $currencies_value['decimal_places'], 'VALUE' => $currencies_value['value']);
        if ($calculate_currencies == 'true') {
            $price_string = $price_string * $currencies_data['VALUE'];
        }
        $price_string = vam_precision($price_string, $currencies_data['DECIMAL_PLACES']);
        if ($price_special == '1') {
            $currencies_query = vam_db_query("SELECT *\n                                            FROM " . TABLE_CURRENCIES . " WHERE\n                                            code = '" . $currency . "'");
            $currencies_value = vam_db_fetch_array($currencies_query);
            $price_string = number_format($price_string, $currencies_data['DECIMAL_PLACES'], $currencies_value['decimal_point'], $currencies_value['thousands_point']);
            if ($show_currencies == 1) {
                $price_string = $currencies_data['SYMBOL_LEFT'] . ' ' . $price_string . ' ' . $currencies_data['SYMBOL_RIGHT'];
            }
        }
    }
    //}
    return $price_string;
    //    return $price_data['PRODUCTS_PRICE'];
}
Exemplo n.º 8
0
 function calculate()
 {
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // products price
         $product_query = vam_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . vam_get_prid($products_id) . "'");
         if ($product = vam_db_fetch_array($product_query)) {
             $prid = $product['products_id'];
             $products_tax = vam_get_tax_rate($product['products_tax_class_id']);
             $products_price = $product['products_price'];
             $products_weight = $product['products_weight'];
             $specials_query = vam_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
             if (vam_db_num_rows($specials_query)) {
                 $specials = vam_db_fetch_array($specials_query);
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total += vam_add_tax($products_price, $products_tax) * $qty;
             $this->weight += $qty * $products_weight;
         }
         // attributes price
         if ($this->contents[$products_id]['attributes']) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $attribute_price_query = vam_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'");
                 $attribute_price = vam_db_fetch_array($attribute_price_query);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $qty * vam_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $qty * vam_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
                    }
                    if ($n > 1 || $n2 > 1) {
                        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0) {
                            $quotes[$i]['tax'] = '';
                        }
                        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0) {
                            $quotes[$i]['tax'] = 0;
                        }
                        $quotes[$i]['methods'][$j]['price'] = $vamPrice->Format(vam_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax']), true, 0, true);
                        $quotes[$i]['methods'][$j]['radio_field'] = vam_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="' . $quotes[$i]['methods'][$j]['id'] . '"');
                        $quotes[$i]['methods'][$j]['id'] = $quotes[$i]['methods'][$j]['id'];
                    } else {
                        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0) {
                            $quotes[$i]['tax'] = 0;
                        }
                        $quotes[$i]['methods'][$j]['price'] = $vamPrice->Format(vam_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax']), true, 0, true) . vam_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']);
                    }
                    $radio_buttons++;
                }
            }
        }
        $module->assign('module_content', $quotes);
    }
    $module->caching = 0;
    $shipping_block = $module->fetch(CURRENT_TEMPLATE . '/module/checkout_shipping_block.html');
}
$vamTemplate->assign('SHIPPING_BLOCK', $shipping_block);
/* END SHIPPING_BLOCK */
/* PAYMENT_BLOCK */
// load all enabled payment modules
require DIR_WS_CLASSES . 'order_total.php';
Exemplo n.º 10
0
<?php 
        $r = 0;
        for ($i = 0, $n = sizeof($shipping_quotes); $i < $n; $i++) {
            for ($j = 0, $n2 = sizeof($shipping_quotes[$i]['methods']); $j < $n2; $j++) {
                $r++;
                if (!isset($shipping_quotes[$i]['tax'])) {
                    $shipping_quotes[$i]['tax'] = 0;
                }
                $rowClass = $r / 2 == floor($r / 2) ? 'dataRowOver' : 'dataRow';
                echo '                  <tr class="' . $rowClass . '" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this, \'' . $rowClass . '\')" onClick="selectRowEffect(this, ' . $r . '); setShipping(' . $r . ');">' . '                    <td class="dataTableContent" valign="top" align="left">
			 <script language="JavaScript" type="text/javascript">
                   <!--
                    document.write("<input type=\\"radio\\" name=\\"shipping\\" id=\\"shipping_radio_' . $r . '\\" value=\\"' . $shipping_quotes[$i]['id'] . '_' . $shipping_quotes[$i]['methods'][$j]['id'] . '\\">");
	               //-->
                  </script>
			 <input type="hidden" id="update_shipping[' . $r . '][title]" name="update_shipping[' . $r . '][title]" value="' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):">' . "\n" . '      <input type="hidden" id="update_shipping[' . $r . '][value]" name="update_shipping[' . $r . '][value]" value="' . vam_add_tax($shipping_quotes[$i]['methods'][$j]['cost'], $shipping_quotes[$i]['tax']) . '">' . "\n" . '      <input type="hidden" id="update_shipping[' . $r . '][id]" name="update_shipping[' . $r . '][id]" value="' . $shipping_quotes[$i]['id'] . '_' . $shipping_quotes[$i]['methods'][$j]['id'] . '">' . "\n" . '      <td class="dataTableContent" valign="top">' . $shipping_quotes[$i]['module'] . ' (' . $shipping_quotes[$i]['methods'][$j]['title'] . '):</td>' . "\n" . '      <td class="dataTableContent" align="right">' . $currencies->format(vam_add_tax($shipping_quotes[$i]['methods'][$j]['cost'], $shipping_quotes[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</td>' . "\n" . '                  </tr>';
            }
        }
        ?>
                  <tr class="dataTableHeadingRow">
                    <td class="dataTableHeadingContent" colspan="3"><?php 
        echo sprintf(TEXT_PACKAGE_WEIGHT_COUNT, $shipping_num_boxes . ' x ' . $shipping_weight, $total_count);
        ?>
</td>
                  </tr>
                </table>

<?php 
    } else {
        echo AJAX_NO_QUOTES;
    }
Exemplo n.º 11
0
 function process()
 {
     global $order, $vamPrice, $ps_cost, $ps_country, $shipping;
     $customer_id = $_SESSION['customer_id'];
     if (MODULE_ORDER_TOTAL_PS_FEE_STATUS == 'true') {
         //Will become true, if ps can be processed.
         $ps_country = false;
         //check if payment method is ps. If yes, check if ps is possible.
         $count_query = vam_db_query("select count(*) as count from " . TABLE_CUSTOMERS_BASKET . " cb, " . TABLE_PRODUCTS . " p  where cb.customers_id = '" . $customer_id . "' and cb.products_id = p.products_id and p.products_fsk18 = '1'");
         $num = vam_db_fetch_array($count_query);
         $age = $num['count'];
         if ($age > '0') {
             //process installed shipping modules
             if ($_SESSION['shipping']['id'] == 'flat_flat') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_FLAT);
             }
             if ($_SESSION['shipping']['id'] == 'item_item') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_ITEM);
             }
             if ($_SESSION['shipping']['id'] == 'table_table') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_TABLE);
             }
             if ($_SESSION['shipping']['id'] == 'zones_zones') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_ZONES);
             }
             if ($_SESSION['shipping']['id'] == 'ap_ap') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_AP);
             }
             if ($_SESSION['shipping']['id'] == 'dp_dp') {
                 $ps_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_PS_FEE_DP);
             }
             for ($i = 0; $i < count($ps_zones); $i++) {
                 if ($ps_zones[$i] == $order->billing['country']['iso_code_2']) {
                     $ps_cost = $ps_zones[$i + 1];
                     $ps_country = true;
                     //print('match' . $ps_zones[$i] . ': ' . $ps_cost);
                     break;
                 } elseif ($ps_zones[$i] == '00') {
                     $ps_cost = $ps_zones[$i + 1];
                     $ps_country = true;
                     //print('match' . $i . ': ' . $ps_cost);
                     break;
                 } else {
                     //print('no match');
                 }
                 $i++;
             }
         } else {
             //PS selected, but no shipping module which offers PS
         }
         if ($ps_country) {
             $ps_tax = vam_get_tax_rate(MODULE_ORDER_TOTAL_PS_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $ps_tax_description = vam_get_tax_description(MODULE_ORDER_TOTAL_PS_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $order->info['tax'] += vam_add_tax($ps_cost, $ps_tax) - $ps_cost;
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$ps_tax_description}"] += vam_add_tax($ps_cost, $ps_tax) - $ps_cost;
                 $order->info['total'] += $ps_cost + (vam_add_tax($ps_cost, $ps_tax) - $ps_cost);
                 $ps_cost_value = vam_add_tax($ps_cost, $ps_tax);
                 $ps_cost = $vamPrice->Format($ps_cost_value, true);
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $order->info['tax'] += vam_add_tax($ps_cost, $ps_tax) - $ps_cost;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$ps_tax_description}"] += vam_add_tax($ps_cost, $ps_tax) - $ps_cost;
                 $ps_cost_value = $ps_cost;
                 $ps_cost = $vamPrice->Format($ps_cost, true);
                 $order->info['subtotal'] += $ps_cost_value;
                 $order->info['total'] += $ps_cost_value;
             }
             if (!$ps_cost_value) {
                 $ps_cost_value = $ps_cost;
                 $ps_cost = $vamPrice->Format($ps_cost, true);
                 $order->info['total'] += $ps_cost_value;
             }
             $this->output[] = array('title' => $this->title . ':', 'text' => $ps_cost, 'value' => $ps_cost_value);
         } else {
             //Following pse should be improved if we can't get the shipping modules disabled, who don't allow PS
             // as well as countries who do not have ps
             //          $this->output[] = array('title' => $this->title . ':',
             //                                  'text' => 'No PS for this module.',
             //                                  'value' => '');
         }
     }
 }
$product_info_query = vam_db_query("select * FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $_GET['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'");
$product_info = vam_db_fetch_array($product_info_query);
$products_price = $vamPrice->GetPrice($product_info['products_id'], $format = true, 1, $product_info['products_tax_class_id'], $product_info['products_price'], 1);
$products_attributes_query = vam_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int) $_GET['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'");
$products_attributes = vam_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
    $products_options_name_query = vam_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int) $_GET['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int) $_SESSION['languages_id'] . "' order by popt.products_options_name");
    while ($products_options_name = vam_db_fetch_array($products_options_name_query)) {
        $selected = 0;
        $products_options_query = vam_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix,pa.attributes_stock, pa.attributes_model from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int) $_GET['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int) $_SESSION['languages_id'] . "'");
        while ($products_options = vam_db_fetch_array($products_options_query)) {
            $module_content[] = array('GROUP' => $products_options_name['products_options_name'], 'NAME' => $products_options['products_options_values_name']);
            if ($products_options['options_values_price'] != '0') {
                if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                    $tax_rate = $vamPrice->TAX[$product_info['products_tax_class_id']];
                    $products_options['options_values_price'] = vam_add_tax($products_options['options_values_price'], $vamPrice->TAX[$product_info['products_tax_class_id']]);
                }
                if ($_SESSION['customers_status']['customers_status_show_price'] == 1) {
                    $module_content[sizeof($module_content) - 1]['NAME'] .= ' (' . $products_options['price_prefix'] . $vamPrice->Format($products_options['options_values_price'], true, 0, true) . ')';
                }
            }
        }
    }
}
// assign language to template for caching
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->assign('charset', $_SESSION['language_charset']);
$vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$extra_fields_query = vamDBquery("\n                      SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value\n                      FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " pef\n             LEFT JOIN  " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " ptf\n            ON ptf.products_extra_fields_id=pef.products_extra_fields_id\n            WHERE ptf.products_id=" . (int) $_GET['products_id'] . " and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='" . $_SESSION['languages_id'] . "')\n            ORDER BY products_extra_fields_order");
while ($extra_fields = vam_db_fetch_array($extra_fields_query, true)) {
    if (!$extra_fields['status']) {
Exemplo n.º 13
0
 function process()
 {
     global $order, $vamPrice, $cod_cost, $cod_country, $shipping;
     if (MODULE_ORDER_TOTAL_COD_FEE_STATUS == 'true') {
         //Will become true, if cod can be processed.
         $cod_country = false;
         //check if payment method is cod. If yes, check if cod is possible.
         if ($_SESSION['payment'] == 'cod') {
             //process installed shipping modules
             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'] == 'zones_zones') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
             }
             if ($_SESSION['shipping']['id'] == 'ap_ap') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_AP);
             }
             if ($_SESSION['shipping']['id'] == 'dp_dp') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DP);
             }
             // module chp
             if ($_SESSION['shipping']['id'] == 'chp_ECO') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_PRI') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_URG') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             // module chronopost
             if ($_SESSION['shipping']['id'] == 'chronopost_chronopost') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST);
             }
             // module DHL
             if ($_SESSION['shipping']['id'] == 'dhl_ECX') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             }
             if ($_SESSION['shipping']['id'] == 'dhl_DOX') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             }
             if ($_SESSION['shipping']['id'] == 'dhl_SDX') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             }
             if ($_SESSION['shipping']['id'] == 'dhl_MDX') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             }
             if ($_SESSION['shipping']['id'] == 'dhl_WPX') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             }
             // UPS
             if ($_SESSION['shipping']['id'] == 'ups_ups') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPS);
             }
             if ($_SESSION['shipping']['id'] == 'upse_upse') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPSE);
             }
             // Free Shipping
             if ($_SESSION['shipping']['id'] == 'free_free') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
             }
             if ($_SESSION['shipping']['id'] == 'freeamount_freeamount') {
                 $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_FREEAMOUNT_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;
                     break;
                 } else {
                 }
                 $i++;
             }
         } else {
             //COD selected, but no shipping module which offers COD
         }
         if ($cod_country) {
             $cod_tax = vam_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             $cod_tax_description = vam_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                 $order->info['tax'] += vam_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['tax_groups'][TAX_ADD_TAX . "{$cod_tax_description}"] += vam_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['total'] += $cod_cost + (vam_add_tax($cod_cost, $cod_tax) - $cod_cost);
                 $cod_cost_value = vam_add_tax($cod_cost, $cod_tax);
                 $cod_cost = $vamPrice->Format($cod_cost_value, true);
             }
             if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                 $order->info['tax'] += vam_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $order->info['tax_groups'][TAX_NO_TAX . "{$cod_tax_description}"] += vam_add_tax($cod_cost, $cod_tax) - $cod_cost;
                 $cod_cost_value = $cod_cost;
                 $cod_cost = $vamPrice->Format($cod_cost, true);
                 $order->info['subtotal'] += $cod_cost_value;
                 $order->info['total'] += $cod_cost_value;
             }
             if (!$cod_cost_value) {
                 $cod_cost_value = $cod_cost;
                 $cod_cost = $vamPrice->Format($cod_cost, true);
                 $order->info['total'] += $cod_cost_value;
             }
             $this->output[] = array('title' => $this->title . ':', 'text' => $cod_cost, 'value' => $cod_cost_value);
         } else {
             //Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
             // as well as countries who do not have cod
             //          $this->output[] = array('title' => $this->title . ':',
             //                                  'text' => 'No COD for this module.',
             //                                  'value' => '');
         }
     }
 }
Exemplo n.º 14
0
   <?php 
}
//end if ($action == 'insert_shipping') {
//13. new order email
if ($action == 'new_order_email') {
    $order = new manualOrder($_GET['oID']);
    $vamPrice = new vamPrice($order->info['currency'], $order->info['status'], $order->customer['ID']);
    for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
        //loop all the products in the order
        $products_ordered_attributes = '';
        if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > 0) {
            for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                $products_ordered_attributes .= "\n\t" . $order->products[$i]['attributes'][$j]['option'] . ' ' . $order->products[$i]['attributes'][$j]['value'];
            }
        }
        $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . $products_model . ' = ' . $currencies->format(vam_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . $products_ordered_attributes . "\n";
    }
    $oID = $_GET['oID'];
    $vamTemplate->assign('address_label_customer', vam_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'));
    $vamTemplate->assign('address_label_shipping', vam_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'));
    if ($_SESSION['credit_covers'] != '1') {
        $vamTemplate->assign('address_label_payment', vam_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'));
    }
    $vamTemplate->assign('csID', $order->customer['csID']);
    $it = 0;
    $semextrfields = vamDBquery("select * from " . TABLE_EXTRA_FIELDS . " where fields_required_email = '1'");
    while ($dataexfes = vam_db_fetch_array($semextrfields, true)) {
        $cusextrfields = vamDBquery("select * from " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id = '" . (int) $order->customer['ID'] . "' and fields_id = '" . $dataexfes['fields_id'] . "'");
        $rescusextrfields = vam_db_fetch_array($cusextrfields, true);
        $extrfieldsinf = vamDBquery("select fields_name from " . TABLE_EXTRA_FIELDS_INFO . " where fields_id = '" . $dataexfes['fields_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'");
        $extrfieldsres = vam_db_fetch_array($extrfieldsinf, true);