예제 #1
0
    function process() {
      global $oOrder, $oCurrencies;

      if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == '1') {
        switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) {
          case 'national':
            if ($oOrder->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
          case 'international':
            if ($oOrder->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
          case 'both':
            $pass = true; break;
          default:
            $pass = false; break;
        }

        if ( ($pass == true) && ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {
          $tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
          // $tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
          $tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);

          $oOrder->info['tax'] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
          $oOrder->info['tax_groups']["$tax_description"] += oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);
          $oOrder->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + oos_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax);

          $this->output[] = array('title' => $this->title . ':',
                                  'text' => $oCurrencies->format(oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']),
                                  'value' => oos_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax));
        }
      }
    }
예제 #2
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
     if (MODULE_SHIPPING_TABLE_MODE == 'price') {
         $oOrder_total = $_SESSION['cart']->show_total();
     } else {
         $oOrder_total = $shipping_weight;
     }
     $table_cost = split("[:,]", MODULE_SHIPPING_TABLE_COST);
     $size = count($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($oOrder_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_table_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_table_text_way'], 'cost' => $shipping + MODULE_SHIPPING_TABLE_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #3
0
 function quote($method = '')
 {
     global $aLang, $oOrder;
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_hermes_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_hermes_text_way'], 'cost' => MODULE_SHIPPING_HERMES_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #4
0
 function quote($method = '')
 {
     global $aLang, $oOrder;
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_certified_mail_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_certified_mail_text_way'], 'cost' => MODULE_SHIPPING_CERTIFIED_MAIL_COST)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #5
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $total_count;
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_item_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_item_text_way'], 'cost' => MODULE_SHIPPING_ITEM_COST * $total_count + MODULE_SHIPPING_ITEM_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #6
0
 function process()
 {
     global $oOrder, $oCurrencies;
     if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == '1') {
         switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
             case 'national':
                 if ($oOrder->delivery['country_id'] == STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'international':
                 if ($oOrder->delivery['country_id'] != STORE_COUNTRY) {
                     $pass = true;
                 }
                 break;
             case 'both':
                 $pass = true;
                 break;
             default:
                 $pass = false;
                 break;
         }
         if ($pass == true && $oOrder->info['total'] - $oOrder->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $oOrder->info['shipping_method'] = $this->title;
             $oOrder->info['total'] -= $oOrder->info['shipping_cost'];
             $oOrder->info['shipping_cost'] = 0;
         }
     }
     $module = substr($_SESSION['shipping']['id'], 0, strpos($_SESSION['shipping']['id'], '_'));
     if (oos_is_not_null($oOrder->info['shipping_method'])) {
         if ($GLOBALS[$module]->tax_class > 0) {
             $shipping_tax = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
             $shipping_tax_description = oos_get_tax_rate($GLOBALS[$module]->tax_class, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
             $tax = oos_calculate_tax($oOrder->info['shipping_cost'], $shipping_tax);
             if ($_SESSION['member']->group['show_price_tax'] == 1) {
                 $oOrder->info['shipping_cost'] += $tax;
             }
             $oOrder->info['tax'] += $tax;
             $oOrder->info['tax_groups']["{$shipping_tax_description}"] += $tax;
             $oOrder->info['total'] += $tax;
         }
         $this->output[] = array('title' => $oOrder->info['shipping_method'] . ':', 'text' => $oCurrencies->format($oOrder->info['shipping_cost'], true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => $oOrder->info['shipping_cost']);
     }
 }
예제 #7
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight;
     $weight_cost = preg_split("/[:,]/", MODULE_SHIPPING_WEIGHT_COST);
     if ($shipping_weight > $weight_cost[count($weight_cost) - 2]) {
         $shipping = ($shipping_weight - $weight_cost[count($weight_cost) - 2]) * MODULE_SHIPPING_WEIGHT_STEP + $weight_cost[count($weight_cost) - 1];
     }
     for ($i = 0; $i < count($weight_cost); $i += 2) {
         if ($shipping_weight <= $weight_cost[$i]) {
             $shipping = $weight_cost[$i + 1];
             break;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_weight_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $aLang['module_shipping_weight_text_way'], 'cost' => $shipping + MODULE_SHIPPING_WEIGHT_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #8
0
                default:
                    $options .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td class="main">' . "\n";
                    $selected = 0;
                    $products_options_array = array();
                    $products_attributestable = $oostable['products_attributes'];
                    $products_options_valuestable = $oostable['products_options_values'];
                    $products_options_sql = "SELECT pov.products_options_values_id, pov.products_options_values_name,\n                                                  pa.options_values_price, pa.price_prefix, pa.options_sort_order\n                                           FROM {$products_attributestable} pa,\n                                                {$products_options_valuestable} pov\n                                           WHERE pa.products_id = '" . intval($nProductsId) . "'\n                                             AND pa.options_id = '" . $products_options_name['products_options_id'] . "'\n                                             AND pa.options_values_id = pov.products_options_values_id\n                                             AND pov.products_options_values_languages_id = '" . intval($nLanguageID) . "'\n                                          " . $options_sort_by;
                    $products_options_result = $dbconn->Execute($products_options_sql);
                    while ($products_options = $products_options_result->fields) {
                        $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
                        if ($products_options['options_values_price'] > '0') {
                            if ($_SESSION['member']->group['show_price'] == 1) {
                                if ($info_product_discount != 0) {
                                    $products_options_array[count($products_options_array) - 1]['text'] .= ' (' . $products_options['price_prefix'] . $oCurrencies->display_price($products_options['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ' -' . number_format($info_product_discount, 2) . '% )&nbsp';
                                } else {
                                    $products_options_array[count($products_options_array) - 1]['text'] .= ' (' . $products_options['price_prefix'] . $oCurrencies->display_price($products_options['options_values_price'], oos_get_tax_rate($product_info['products_tax_class_id'])) . ')&nbsp';
                                }
                            }
                        }
                        // Move that ADOdb pointer!
                        $products_options_result->MoveNext();
                    }
                    $options .= oos_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $_SESSION['cart']->contents[$sProductsId]['attributes'][$products_options_name['products_options_id']]);
                    $options .= '</td></tr>';
            }
            // Move that ADOdb pointer!
            $products_options_name_result->MoveNext();
        }
        $options .= '</table>';
    }
}
예제 #9
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
     $dest_country = $oOrder->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($j = 1; $j <= $this->num_fedexeu; $j++) {
         $countries_table = constant('MODULE_SHIPPING_FEDEXEU_COUNTRIES_' . $j);
         $country_zones = split("[,]", $countries_table);
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $j;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $fedexeu_cost_pak = @constant('MODULE_SHIPPING_FEDEXEU_COST_PAK_' . $j);
         $fedexeu_cost_box = @constant('MODULE_SHIPPING_FEDEXEU_COST_BOX_' . $j);
         $methods = array();
         if ($fedexeu_cost_pak != '') {
             $fedexeu_table_pak = split("[:,]", $fedexeu_cost_pak);
             for ($i = 0; $i < count($fedexeu_table_pak); $i += 2) {
                 if ($shipping_weight <= $fedexeu_table_pak[$i]) {
                     $shipping_pak = $fedexeu_table_pak[$i + 1];
                     break;
                 }
             }
             if ($shipping_pak == -1) {
                 $shipping_cost = 0;
                 $shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
             } else {
                 $shipping_cost_1 = $shipping_pak + MODULE_SHIPPING_FEDEXEU_HANDLING;
             }
             if ($shipping_pak != 0) {
                 $methods[] = array('id' => 'PAK', 'title' => 'FedEx Pak', 'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_1) * $shipping_num_boxes);
             }
         }
         if ($fedexeu_cost_box != '') {
             $fedexeu_table_box = split("[:,]", $fedexeu_cost_box);
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_box = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 40) {
                 $shipping_box = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' . $j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
             } elseif ($shipping_weight > 40 and $shipping_weight <= 70) {
                 $shipping_box = number_format(($shipping_weight - 40) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_70_' . $j) + 20 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_20_' . $j) + 40 * constant('MODULE_SHIPPING_FEDEXEU_SOOS_BOX_40_' . $j) + $fedexeu_table_box[count($fedexeu_table_box) - 1];
             } else {
                 for ($i = 0; $i < count($fedexeu_table_box); $i += 2) {
                     if ($shipping_weight <= $fedexeu_table_box[$i]) {
                         $shipping_box = $fedexeu_table_box[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_box == -1) {
                 $shipping_cost = 0;
                 $shipping_method = $aLang['module_shipping_fedexeu_undefined_rate'];
             } else {
                 $shipping_cost_2 = $shipping_box + MODULE_SHIPPING_FEDEXEU_HANDLING;
             }
             if ($shipping_box != 0) {
                 $methods[] = array('id' => 'BOX', 'title' => 'FedEx Box', 'cost' => (MODULE_SHIPPING_FEDEXEU_HANDLING + $shipping_cost_2) * $shipping_num_boxes);
             }
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_fedexeu_text_units'] . ')');
     $this->quotes['methods'] = $methods;
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (oos_is_not_null($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = $aLang['module_shipping_fedexeu_invalid_zone'];
     }
     if (oos_is_not_null($method) && isset($this->types[$method])) {
         for ($i = 0; $i < count($methods); $i++) {
             if ($method == $methods[$i]['id']) {
                 $methodsc = array();
                 $methodsc[] = array('id' => $methods[$i]['id'], 'title' => $methods[$i]['title'], 'cost' => $methods[$i]['cost']);
                 break;
             }
         }
         $this->quotes['methods'] = $methodsc;
     }
     return $this->quotes;
 }
예제 #10
0
 function get_order_total()
 {
     global $oOrder;
     $order_total = $oOrder->info['total'];
     // Check if gift voucher is in cart and adjust total
     $products = $_SESSION['cart']->get_products();
     for ($i = 0; $i < count($products); $i++) {
         $t_prid = oos_get_product_id($products[$i]['id']);
         // Get database information
         $dbconn =& oosDBGetConn();
         $oostable =& oosDBGetTables();
         $productstable = $oostable['products'];
         $query = "SELECT products_price, products_tax_class_id, products_model\n                FROM {$productstable}\n                WHERE products_id = '" . intval($t_prid) . "'";
         $gv_result = $dbconn->GetRow($query);
         if (ereg('^GIFT', addslashes($gv_result['products_model']))) {
             $qty = $_SESSION['cart']->get_quantity($t_prid);
             $products_tax = oos_get_tax_rate($gv_result['products_tax_class_id']);
             if ($this->include_tax == '0') {
                 $gv_amount = $gv_result['products_price'] * $qty;
             } else {
                 $gv_amount = ($gv_result['products_price'] + oos_calculate_tax($gv_result['products_price'], $products_tax)) * $qty;
             }
             $order_total = $order_total - $gv_amount;
         }
     }
     if ($this->include_tax == '0') {
         $order_total = $order_total - $oOrder->info['tax'];
     }
     if ($this->include_shipping == '0') {
         $order_total = $order_total - $oOrder->info['shipping_cost'];
     }
     return $order_total;
 }
예제 #11
0
        if (!empty($featured_special_price)) {
            $featured_product_special_price = $oCurrencies->display_price($featured_special_price, oos_get_tax_rate($featured['products_tax_class_id']));
        } else {
            $featured_max_product_discount = min($featured['products_discount_allowed'],$_SESSION['member']->group['discount']);
            if ($featured_max_product_discount != 0 ) {
                $featured_special_price = $featured['products_price']*(100-$featured_max_product_discount)/100;
                $featured_product_discount_price = $oCurrencies->display_price($featured_special_price, oos_get_tax_rate($featured['products_tax_class_id']));
            }
        }

        if ($featured['products_base_price'] != 1) {
            $featured_base_product_price = $oCurrencies->display_price($featured['products_price'] * $featured['products_base_price'], oos_get_tax_rate($featured['products_tax_class_id']));

            if ($featured_special_price != '') {
                $featured_base_product_special_price = $oCurrencies->display_price($featured_special_price * $featured['products_base_price'], oos_get_tax_rate($featured['products_tax_class_id']));
            }
        }

        $aFeatured[] = array('products_id' => $featured['products_id'],
                             'products_image' => $featured['products_image'],
                             'products_name' => $featured['products_name'],
                             'products_description' => oos_remove_tags($featured['products_description']),
                             'products_base_price' => $featured['products_base_price'],
                             'products_base_unit' => $featured['products_base_unit'],
                             'products_units' => $featured_units,
                             'featured_product_price' => $featured_product_price,
                             'featured_product_special_price' => $featured_product_special_price,
                             'featured_max_product_discount' => $featured_max_product_discount,
                             'featured_product_discount_price' => $featured_product_discount_price,
                             'featured_base_product_price' => $featured_base_product_price,
예제 #12
0
            $pl_product_special_price = $oCurrencies->display_price($pl_special_price, oos_get_tax_rate($listing['products_tax_class_id']));
        } else {
            $pl_max_product_discount =  min($listing['products_discount_allowed'],$_SESSION['member']->group['discount']);

            if ($pl_max_product_discount != 0 ) {
                $pl_special_price = $listing['products_price']*(100-$pl_max_product_discount)/100;
                $pl_product_special_price = $oCurrencies->display_price($pl_special_price, oos_get_tax_rate($listing['products_tax_class_id']));
            }
        }


        if ($listing['products_base_price'] != 1) {
            $pl_base_product_price = $oCurrencies->display_price($listing['products_price'] * $listing['products_base_price'], oos_get_tax_rate($listing['products_tax_class_id']));

            if ($pl_special_price != '') {
                $pl_base_product_special_price = $oCurrencies->display_price($pl_special_price * $listing['products_base_price'], oos_get_tax_rate($listing['products_tax_class_id']));
            }
        }

        if (!empty($listing['specials_new_products_price'])) {
            $sProductListPrice = '&nbsp;<s>' . $pl_product_price . $sUnits . '</s><br />';
            if ($listing['products_base_price'] != 1)  $lc_text .= '<s><span class="base_price">' . $listing['products_base_unit'] . ' = ' . $pl_base_product_price . '</span></s><br />';

            $sProductListPrice .= '&nbsp;<span class="special_price">' . $pl_product_special_price . $sUnits . '</span>';
            if ($listing['products_base_price'] != 1)  $lc_text .= '<br /><span class="special_base_price">' . $listing['products_base_unit'] . ' = ' . $pl_base_product_special_price . '</span></s><br />';
        } else {
            if ($pl_max_product_discount != 0 ) {
                $sProductListPrice = '&nbsp;<s>' . $pl_product_price . $sUnits . '</s>&nbsp;-' . number_format($pl_max_product_discount, 2) . '%<br />';
                $sProductListPrice .= '&nbsp;<span class="discount_price">' . $pl_product_special_price . $sUnits . '</span>';
                if ($listing['products_base_price'] != 1)  $lc_text .= '<br /><span class="special_base_price">' . $listing['products_base_unit'] . ' = ' . $pl_base_product_special_price . '</span></s><br />';
예제 #13
0
 function quote($method = '')
 {
     global $oOrder, $aLang, $shipping_weight, $shipping_num_boxes;
     if (!empty($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types))) {
         $this->_setService($method);
     }
     $this->_setMachinable('0');
     $this->_setContainer('None');
     $this->_setSize('REGULAR');
     // usps doesnt accept zero weight
     $shipping_weight = $shipping_weight < 0.1 ? 0.1 : $shipping_weight;
     $shipping_pounds = floor($shipping_weight);
     $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));
     $this->_setWeight($shipping_pounds, $shipping_ounces);
     $uspsQuote = $this->_getQuote();
     if (is_array($uspsQuote)) {
         if (isset($uspsQuote['error'])) {
             $this->quotes = array('module' => $this->title, 'error' => $uspsQuote['error']);
         } else {
             $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');
             $methods = array();
             $size = count($uspsQuote);
             for ($i = 0; $i < $size; $i++) {
                 list($type, $cost) = each($uspsQuote[$i]);
                 $methods[] = array('id' => $type, 'title' => isset($this->types[$type]) ? $this->types[$type] : $type, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
             }
             $this->quotes['methods'] = $methods;
             if ($this->tax_class > 0) {
                 $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
             }
         }
     } else {
         $this->quotes = array('module' => $this->title, 'error' => $aLang['module_shipping_usps_text_error']);
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #14
0
         extract($row, EXTR_PREFIX_ALL, "opt");
         $AddedOptionsPrice += $opt_options_values_price;
         $option_value_details[$option_id][$option_value_id] = array("options_values_price" => $opt_options_values_price);
         $option_names[$option_id] = $opt_products_options_name;
         $option_values_names[$option_value_id] = $opt_products_options_values_name;
     }
 }
 // Get Product Info
 $InfoQuery = "select p.products_model,p.products_price,pd.products_name,p.products_tax_class_id from " . $oostable['products'] . " p left join " . $oostable['products_description'] . " pd on pd.products_id=p.products_id WHERE p.products_id='{$add_product_products_id}'";
 $result = $dbconn->Execute($InfoQuery);
 $row = $result->fields;
 extract($row, EXTR_PREFIX_ALL, "p");
 // Following functions are defined at the bottom of this file
 $CountryID = oos_get_country_id($order->delivery["country"]);
 $ZoneID = oos_get_zone_id($CountryID, $order->delivery["state"]);
 $ProductsTax = oos_get_tax_rate($p_products_tax_class_id, $CountryID, $ZoneID);
 $Query = "insert into " . $oostable['orders_products'] . " set\n        orders_id = {$oID},\n        products_id = {$add_product_products_id},\n        products_model = '{$p_products_model}',\n        products_name = '" . str_replace("'", "&#39;", $p_products_name) . "',\n        products_price = '{$p_products_price}',\n        final_price = '" . ($p_products_price + $AddedOptionsPrice) . "',\n        products_tax = '{$ProductsTax}',\n        products_quantity = {$add_product_quantity};";
 $dbconn->Execute($Query);
 $new_product_id = $dbconn->Insert_ID();
 //UPDATE_INVENTORY_QUANTITY_START
 $dbconn->Execute("UPDATE " . $oostable['products'] . " SET products_quantity = products_quantity - " . $add_product_quantity . ", products_ordered = products_ordered + " . $add_product_quantity . " WHERE products_id = '" . $add_product_products_id . "'");
 //UPDATE_INVENTORY_QUANTITY_END
 if (isset($add_product_options)) {
     foreach ($add_product_options as $option_id => $option_value_id) {
         $Query = "insert into " . $oostable['orders_products_attributes'] . " set\n            orders_id = {$oID},\n            orders_products_id = {$new_product_id},\n            products_options = '" . $option_names[$option_id] . "',\n            products_options_values = '" . $option_values_names[$option_value_id] . "',\n            options_values_price = '" . $option_value_details[$option_id][$option_value_id]["options_values_price"] . "',\n            price_prefix = '+';";
         $dbconn->Execute($Query);
     }
 }
 // Calculate Tax and Sub-Totals
 $order = new order($oID);
 $RunningSubTotal = 0;
예제 #15
0
     $reviews_total = $reviews->fields['total'];
     $oSmarty->assign('reviews_total', $reviews_total);
 }
 $discounts_price = '0';
 if (oos_empty($info_special_price) && ($product_info['products_discount4_qty'] > 0 || $product_info['products_discount3_qty'] > 0 || $product_info['products_discount2_qty'] > 0 || $product_info['products_discount1_qty'] > 0)) {
     if ($_SESSION['member']->group['show_price'] == 1 && $_SESSION['member']->group['qty_discounts'] == 1) {
         $discounts_price = '1';
         require 'includes/modules/discounts_price.php';
         if ($product_info['products_discount4'] > 0) {
             $price_discount = $oCurrencies->display_price($product_info['products_discount4'], oos_get_tax_rate($product_info['products_tax_class_id']));
         } elseif ($product_info['products_discount3'] > 0) {
             $price_discount = $oCurrencies->display_price($product_info['products_discount3'], oos_get_tax_rate($product_info['products_tax_class_id']));
         } elseif ($product_info['products_discount2'] > 0) {
             $price_discount = $oCurrencies->display_price($product_info['products_discount2'], oos_get_tax_rate($product_info['products_tax_class_id']));
         } elseif ($product_info['products_discount1'] > 0) {
             $price_discount = $oCurrencies->display_price($product_info['products_discount1'], oos_get_tax_rate($product_info['products_tax_class_id']));
         }
         if (isset($price_discount)) {
             $oSmarty->assign('price_discount', $price_discount);
         }
     }
 }
 require 'includes/modules/products_options.php';
 // assign Smarty variables;
 $oSmarty->assign(array('oos_breadcrumb' => $oBreadcrumb->trail(BREADCRUMB_SEPARATOR), 'discounts_price' => $discounts_price));
 if (!isset($block_get_parameters)) {
     $block_get_parameters = oos_get_all_get_parameters(array('action'));
     $block_get_parameters = oos_remove_trailing($block_get_parameters);
     $oSmarty->assign('get_params', $block_get_parameters);
 }
 $oSmarty->assign('product_info', $product_info);
예제 #16
0
            }
        }
    }
    // Tax (not in shopping cart, tax rate may be unknown)
    if ($sPage != $aPages['shopping_cart']) {
        $shopping_cart_detail .= '    <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "\n";
    }
    // Product price
    if ($sPage != $aPages['account_history_info']) {
        $shopping_cart_detail .= '    <td align="right" valign="top" class="main"><b>' . $oCurrencies->display_price($products[$i]['price'], oos_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>';
    } else {
        $shopping_cart_detail .= '    <td align="right" valign="top" class="main"><b>' . $oCurrencies->display_price($products[$i]['price'], $products[$i]['tax'], $products[$i]['quantity']) . '</b>';
    }
    // Product options prices
    if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        foreach ($products[$i]['attributes'] as $option => $value) {
            if ($products[$i][$option]['options_values_price'] != 0) {
                if ($sPage != $aPages['account_history_info']) {
                    $shopping_cart_detail .= '<br /><small><i>' . $products[$i][$option]['price_prefix'] . $oCurrencies->display_price($products[$i][$option]['options_values_price'], oos_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</i></small>';
                } else {
                    $shopping_cart_detail .= '<br /><small><i>' . $products[$i][$option]['price_prefix'] . $oCurrencies->display_price($products[$i][$option]['options_values_price'], $products[$i]['tax'], $products[$i]['quantity']) . '</i></small>';
                }
            } else {
                // Keep price aligned with corresponding option
                $shopping_cart_detail .= '<br /><small><i>&nbsp;</i></small>';
            }
        }
    }
    $shopping_cart_detail .= '</td>' . "\n";
}
$shopping_cart_detail .= '  </tr>' . "\n";
예제 #17
0
 function cart()
 {
     global $oCurrencies;
     $this->content_type = $_SESSION['cart']->get_content_type();
     $nLanguageID = isset($_SESSION['language_id']) ? $_SESSION['language_id'] + 0 : 1;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $customerstable = $oostable['customers'];
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address,\n                       ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city,\n                       ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2,\n                       co.countries_iso_code_3, co.address_format_id, ab.entry_state\n                FROM {$customerstable} c,\n                     {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                 ON  (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} co\n                 ON (ab.entry_country_id = co.countries_id)\n                WHERE c.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                    ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                     c.customers_default_address_id = ab.address_book_id";
     $customer_address = $dbconn->GetRow($sql);
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,\n                       ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,\n                       ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,\n                       c.countries_iso_code_3, c.address_format_id, ab.entry_state\n                FROM {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                  ON (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} c ON\n                     (ab.entry_country_id = c.countries_id)\n                WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                      ab.address_book_id = '" . intval($_SESSION['sendto']) . "'";
     $shipping_address = $dbconn->GetRow($sql);
     $address_booktable = $oostable['address_book'];
     $zonestable = $oostable['zones'];
     $countriestable = $oostable['countries'];
     $sql = "SELECT ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address,\n                       ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name,\n                       ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2,\n                       c.countries_iso_code_3, c.countries_moneybookers, c.address_format_id, ab.entry_state\n                FROM {$address_booktable} ab LEFT JOIN\n                     {$zonestable} z\n                  ON (ab.entry_zone_id = z.zone_id) LEFT JOIN\n                     {$countriestable} c ON\n                     (ab.entry_country_id = c.countries_id)\n                WHERE ab.customers_id = '" . intval($_SESSION['customer_id']) . "' AND\n                    ab.address_book_id = '" . intval($_SESSION['billto']) . "'";
     $billing_address = $dbconn->GetRow($sql);
     $class =& $_SESSION['payment'];
     $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID, 'campaigns' => $_SESSION['campaigns_id'], 'currency' => $_SESSION['currency'], 'currency_value' => $oCurrencies->currencies[$_SESSION['currency']]['value'], 'payment_method' => $GLOBALS[$class]->title, 'cc_type' => isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : '', 'cc_owner' => isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : '', 'cc_number' => isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : '', 'cc_expires' => isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : '', 'cc_cvv' => isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : '', 'shipping_method' => $_SESSION['shipping']['title'], 'shipping_cost' => $_SESSION['shipping']['cost'], 'comments' => isset($_SESSION['comments']) ? $_SESSION['comments'] : '', 'shipping_class' => strpos($shipping['id'], '_') > 0 ? substr(strrev(strchr(strrev($shipping['id']), '_')), 0, -1) : $shipping['id'], 'payment_class' => $_SESSION['payment']);
     if (isset($GLOBALS['payment']) && is_object($GLOBALS['payment'])) {
         $this->info['payment_method'] = $GLOBALS['payment']->title;
         if (isset($GLOBALS['payment']->order_status) && is_numeric($GLOBALS['payment']->order_status) && $GLOBALS['payment']->order_status > 0) {
             $this->info['order_status'] = $GLOBALS['payment']->order_status;
         }
     }
     $this->customer = array('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' => oos_is_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']), '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' => oos_is_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' => oos_is_not_null($billing_address['entry_state']) ? $billing_address['entry_state'] : $billing_address['zone_name'], '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'], 'moneybookers' => $billing_address['countries_moneybookers']), 'country_id' => $billing_address['entry_country_id'], 'format_id' => $billing_address['address_format_id']);
     $index = 0;
     $products = $_SESSION['cart']->get_products();
     for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
         $this->products[$index] = array('qty' => $products[$i]['quantity'], 'name' => $products[$i]['name'], 'model' => $products[$i]['model'], 'ean' => $products[$i]['ean'], 'tax' => oos_get_tax_rate($products[$i]['tax_class_id'], $billing_address['entry_country_id'], ${$billing_address}['entry_zone_id']), 'tax_description' => oos_get_tax_description($products[$i]['tax_class_id'], $billing_address['entry_country_id'], $billing_address['entry_zone_id']), 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), 'weight' => $products[$i]['weight'], 'towlid' => $products[$i]['towlid'], 'id' => $products[$i]['id']);
         if ($products[$i]['attributes']) {
             $subindex = 0;
             foreach ($products[$i]['attributes'] as $option => $value) {
                 $products_optionstable = $oostable['products_options'];
                 $products_options_valuestable = $oostable['products_options_values'];
                 $products_attributestable = $oostable['products_attributes'];
                 if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
                     $sql = "SELECT popt.products_options_name, poval.products_options_values_name,\n                                       pa.options_values_price, pa.price_prefix\n                                FROM {$products_optionstable} popt,\n                                     {$products_options_valuestable} poval,\n                                     {$products_attributestable} pa\n                                WHERE\n                                     pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND\n                                     pa.options_id = '" . oos_db_input($option) . "' AND\n                                     pa.options_id = popt.products_options_id AND\n                                   popt.products_options_languages_id = '" . intval($nLanguageID) . "'";
                 } else {
                     $sql = "SELECT popt.products_options_name, poval.products_options_values_name,\n                                       pa.options_values_price, pa.price_prefix\n                                FROM {$products_optionstable} popt,\n                                     {$products_options_valuestable} poval,\n                                     {$products_attributestable} pa\n                                WHERE pa.products_id = '" . oos_db_input($products[$i]['id']) . "' AND\n                                      pa.options_id = '" . oos_db_input($option) . "' AND\n                                      pa.options_id = popt.products_options_id AND\n                                      pa.options_values_id = '" . oos_db_input($value) . "' AND\n                                      pa.options_values_id = poval.products_options_values_id AND\n                                      popt.products_options_languages_id = '" . intval($nLanguageID) . "' AND\n                                      poval.products_options_values_languages_id = '" . intval($nLanguageID) . "'";
                 }
                 $attributes = $dbconn->GetRow($sql);
                 if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID) {
                     $attr_value = $products[$i]['attributes_values'][$option];
                 } else {
                     $attr_value = $attributes['products_options_values_name'];
                 }
                 $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'], 'value' => $attr_value, 'option_id' => $option, 'value_id' => $value, 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
                 $subindex++;
             }
         }
         $shown_price = oos_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
         $this->info['subtotal'] += $shown_price;
         $products_tax = $this->products[$index]['tax'];
         if ($_SESSION['member']->group['show_price_tax'] == 1) {
             $this->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
             $this->info['tax_groups']["{$products_tax}"] += $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;
             $this->info['tax_groups']["{$products_tax}"] += $products_tax / 100 * $shown_price;
         }
         $index++;
     }
     if ($_SESSION['member']->group['show_price_tax'] == 1) {
         $this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
     } else {
         $this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
     }
 }
예제 #18
0
 function get_product_price($product_id)
 {
     global $oOrder;
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     $products_id = oos_get_product_id($product_id);
     // products price
     $qty = $_SESSION['cart']->contents[$product_id]['qty'];
     $productstable = $oostable['products'];
     $product_query = $dbconn->Execute("SELECT products_id, products_price, products_tax_class_id, products_weight FROM {$productstable} WHERE products_id='" . (int) $product_id . "'");
     if ($product = $product_query->fields) {
         $prid = $product['products_id'];
         $products_tax = oos_get_tax_rate($product['products_tax_class_id']);
         $products_price = $product['products_price'];
         $specialstable = $oostable['specials'];
         $specials_query = $dbconn->Execute("SELECT specials_new_products_price FROM {$specialstable} WHERE products_id = '" . (int) $prid . "' AND status = '1'");
         if ($specials_query->RecordCount()) {
             $specials = $specials_query->fields;
             $products_price = $specials['specials_new_products_price'];
         }
         if ($this->include_tax == '1') {
             $total_price += ($products_price + oos_calculate_tax($products_price, $products_tax)) * $qty;
         } else {
             $total_price += $products_price * $qty;
         }
         // attributes price
         if (isset($_SESSION['cart']->contents[$product_id]['attributes'])) {
             reset($_SESSION['cart']->contents[$product_id]['attributes']);
             while (list($option, $value) = each($_SESSION['cart']->contents[$product_id]['attributes'])) {
                 $products_attributestable = $oostable['products_attributes'];
                 $attribute_price_query = $dbconn->Execute("SELECT options_values_price, price_prefix FROM {$products_attributestable} WHERE products_id = '" . (int) $prid . "' AND options_id = '" . oos_db_input($option) . "' AND options_values_id = '" . oos_db_input($value) . "'");
                 $attribute_price = $attribute_price_query->fields;
                 if ($attribute_price['price_prefix'] == '+') {
                     if ($this->include_tax == '1') {
                         $total_price += $qty * ($attribute_price['options_values_price'] + oos_calculate_tax($attribute_price['options_values_price'], $products_tax));
                     } else {
                         $total_price += $qty * $attribute_price['options_values_price'];
                     }
                 } else {
                     if ($this->include_tax == '1') {
                         $total_price -= $qty * ($attribute_price['options_values_price'] + oos_calculate_tax($attribute_price['options_values_price'], $products_tax));
                     } else {
                         $total_price -= $qty * $attribute_price['options_values_price'];
                     }
                 }
             }
         }
     }
     if ($this->include_shipping == '1') {
         $total_price += $oOrder->info['shipping_cost'];
     }
     return $total_price;
 }
 function calculate()
 {
     $this->total_virtual = 0;
     // Gift Voucher System
     $this->weight_virtual = 0;
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) {
         return 0;
     }
     // Get database information
     $dbconn =& oosDBGetConn();
     $oostable =& oosDBGetTables();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
         $nQuantity = $this->contents[$products_id]['qty'];
         // products price
         $productstable = $oostable['products'];
         $product_sql = "SELECT products_id, products_model, products_price, products_discount_allowed,\r\n                                   products_tax_class_id, products_weight\r\n                            FROM {$productstable}\r\n                            WHERE products_id='" . oos_get_product_id($products_id) . "'";
         $product_result = $dbconn->Execute($product_sql);
         if ($product = $product_result->fields) {
             $no_count = 1;
             if (ereg('^GIFT', $product['products_model'])) {
                 $no_count = 0;
             }
             $prid = $product['products_id'];
             $products_tax = oos_get_tax_rate($product['products_tax_class_id']);
             if ($_SESSION['member']->group['qty_discounts'] == 1) {
                 $products_price = $this->products_price_actual($prid, $product['products_price'], $nQuantity);
             } else {
                 $products_price = $product['products_price'];
             }
             $max_product_discount = min($product['products_discount_allowed'], $_SESSION['member']->group['discount']);
             $products_price = $products_price * (100 - $max_product_discount) / 100;
             $products_weight = $product['products_weight'];
             $specialstable = $oostable['specials'];
             $sql = "SELECT specials_new_products_price\r\n                        FROM {$specialstable}\r\n                        WHERE products_id = '" . intval($prid) . "'\r\n                        AND   status = '1'";
             $specials_result = $dbconn->Execute($sql);
             if ($specials_result->RecordCount()) {
                 $specials = $specials_result->fields;
                 $products_price = $specials['specials_new_products_price'];
             }
             $this->total_virtual += oos_add_tax($products_price, $products_tax) * $nQuantity * $no_count;
             $this->weight_virtual += $nQuantity * $products_weight * $no_count;
             $this->total += oos_add_tax($products_price, $products_tax) * $nQuantity;
             $this->weight += $nQuantity * $products_weight;
         }
         // attributes price
         if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
                 $products_attributestable = $oostable['products_attributes'];
                 $sql = "SELECT options_values_price, price_prefix\r\n                            FROM {$products_attributestable}\r\n                            WHERE products_id = '" . intval($prid) . "'\r\n                            AND options_id = '" . intval($option) . "'\r\n                            AND options_values_id = '" . intval($value) . "'";
                 $attribute_price = $dbconn->GetRow($sql);
                 if ($attribute_price['price_prefix'] == '+') {
                     $this->total += $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax);
                 } else {
                     $this->total -= $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax);
                 }
             }
         }
     }
 }
예제 #20
0
        if ($wishlist_special_price != '') {
            $wishlist_base_product_special_price = $oCurrencies->display_price($wishlist_special_price * $wishlist_product['products_base_price'], oos_get_tax_rate($wishlist_product['products_tax_class_id']));
        }
    }
    $sql = "SELECT products_options_id, products_options_value_id\n            FROM " . $oostable['customers_wishlist_attributes'] . "\n            WHERE customers_wishlist_link_id = '" . oos_db_input($wlid) . "'\n              AND products_id = '" . $wishlist['products_id'] . "'";
    $attributes_result = $dbconn->Execute($sql);
    $attributes_print = '';
    while ($attributes = $attributes_result->fields) {
        $attributes_print .= oos_draw_hidden_field('id[' . $attributes['products_options_id'] . ']', $attributes['products_options_value_id']);
        $attributes_print .= '                   <tr>';
        $sql = "SELECT popt.products_options_name,\n                       poval.products_options_values_name,\n                       pa.options_values_price, pa.price_prefix\n                FROM " . $oostable['products_options'] . " popt,\n                     " . $oostable['products_options_values'] . " poval,\n                     " . $oostable['products_attributes'] . " pa\n                WHERE pa.products_id = '" . intval($wl_products_id) . "'\n                  AND pa.options_id = '" . $attributes['products_options_id'] . "'\n                  AND pa.options_id = popt.products_options_id\n                  AND pa.options_values_id = '" . $attributes['products_options_value_id'] . "'\n                  AND pa.options_values_id = poval.products_options_values_id\n                  AND popt.products_options_languages_id = '" . intval($nLanguageID) . "'\n                  AND poval.products_options_values_languages_id = '" . intval($nLanguageID) . "'";
        $option = $dbconn->Execute($sql);
        $option_values = $option->fields;
        $attributes_print .= '<td><br /><small><i> - ' . $option_values['products_options_name'] . ' ' . $option_values['products_options_values_name'] . '</i></small></td>';
        if ($option_values['options_values_price'] != 0) {
            $attributes_print .= '<td align="right"><small><i>' . $option_values['price_prefix'] . $oCurrencies->display_price($option_values['options_values_price'], oos_get_tax_rate($wishlist_product['products_tax_class_id'])) . '</i></small></td>';
        } else {
            $attributes_print .= '<td><small><i>&nbsp;</i></small></td>';
        }
        $attributes_print .= '                   </tr>';
        $attributes_result->MoveNext();
    }
    $aWishlist[] = array('products_id' => $wishlist_product['products_id'], 'wl_products_id' => $wl_products_id, 'products_image' => $wishlist_product['products_image'], 'products_name' => $wishlist_product['products_name'], 'product_price' => $wishlist_product_price, 'product_special_price' => $wishlist_product_special_price, 'max_product_discount' => $wishlist_product_discount, 'product_discount_price' => $wishlist_product_discount_price, 'base_product_price' => $wishlist_base_product_price, 'base_product_special_price' => $wishlist_base_product_special_price, 'products_base_price' => $wishlist_product['products_base_price'], 'products_base_unit' => $wishlist_product['products_base_unit'], 'attributes_print' => $attributes_print);
    $wishlist_result->MoveNext();
}
// links breadcrumb
$oBreadcrumb->add($customer . $aLang['navbar_title'], oos_href_link($aPages['main_wishlist']), bookmark);
$aOption['template_main'] = $sTheme . '/modules/wishlist.html';
$aOption['page_heading'] = $sTheme . '/heading/page_heading.html';
$aOption['page_navigation'] = $sTheme . '/heading/page_navigation.html';
$aOption['breadcrumb'] = 'default/system/breadcrumb.html';
예제 #21
0
 function quote($method = '')
 {
     global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
     $dest_country = $oOrder->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     $error = false;
     for ($i = 1; $i <= $this->num_dp; $i++) {
         $countries_table = constant('MODULE_SHIPPING_DP_COUNTRIES_' . $i);
         $country_zones = preg_split("/[,]/", $countries_table);
         if (in_array($dest_country, $country_zones)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $error = true;
     } else {
         $shipping = -1;
         $dp_cost = constant('MODULE_SHIPPING_DP_COST_' . $i);
         $dp_table = preg_split("/[:,]/", $dp_cost);
         $nArrayCountDP = count($dp_table);
         for ($i = 0; $i < $nArrayCountDP; $i += 2) {
             if ($shipping_weight <= $dp_table[$i]) {
                 $shipping = $dp_table[$i + 1];
                 $shipping_method = $aLang['module_shipping_dp_text_way'] . ' ' . $dest_country . ': ';
                 break;
             }
         }
         if ($shipping == -1) {
             $shipping_cost = 0;
             $shipping_method = $aLang['module_shipping_dp_undefined_rate'];
         } else {
             $shipping_cost = $shipping + MODULE_SHIPPING_DP_HANDLING;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $aLang['module_shipping_dp_text_title'], 'methods' => array(array('id' => $this->code, 'title' => $shipping_method . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . $aLang['module_shipping_dp_text_units'] . ')', 'cost' => $shipping_cost * $shipping_num_boxes)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = $aLang['module_shipping_dp_invalid_zone'];
     }
     return $this->quotes;
 }
        if (isset($order_history['specials_new_products_price'])) {
            $new_special_price = $order_history['specials_new_products_price'];
            $new_product_special_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($order_history['products_tax_class_id']));
        } else {
            $new_max_product_discount = min($order_history['products_discount_allowed'],$_SESSION['member']->group['discount']);
            if ($new_max_product_discount != 0) {
                $new_special_price = $order_history['products_price']*(100-$new_max_product_discount)/100;
                $new_product_discount_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($order_history['products_tax_class_id']));
            }
        }

        if ($order_history['products_base_price'] != 1) {
            $new_base_product_price = $oCurrencies->display_price($order_history['products_price'] * $order_history['products_base_price'], oos_get_tax_rate($order_history['products_tax_class_id']));

            if ($new_special_price != '') {
                $new_base_product_special_price = $oCurrencies->display_price($new_special_price * $order_history['products_base_price'], oos_get_tax_rate($order_history['products_tax_class_id']));
            }
        }
        $order_history_array[] = array('id' => $order_history['products_id'],
                                       'name' => $order_history['products_name'],
                                       'image' => $order_history['products_image'],
                                       'new_product_price' => $new_product_price,
                                       'new_product_special_price' => $new_product_special_price,
                                       'new_max_product_discount' => $new_max_product_discount,
                                       'new_special_price' => $new_special_price,
                                       'new_product_discount_price' => $new_product_discount_price,
                                       'new_base_product_price' => $new_base_product_price,
                                       'new_base_product_special_price' => $new_base_product_special_price,
                                       'products_base_price' => $order_history['products_base_price'],
                                       'new_products_base_unit' => $order_history['products_base_unit'],
                                       'date_added' => $order_history['products_date_added'],
예제 #23
0
 function process()
 {
     global $oOrder, $oCurrencies, $cod_cost, $cod_country;
     if (MODULE_ORDER_TOTAL_COD_STATUS == '1') {
         //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 = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
             }
             if ($_SESSION['shipping']['id'] == 'item_item') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
             }
             if ($_SESSION['shipping']['id'] == 'table_table') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
             }
             if ($_SESSION['shipping']['id'] == 'zones_zones') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
             }
             if ($_SESSION['shipping']['id'] == 'ap_ap') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_AP);
             }
             if ($_SESSION['shipping']['id'] == 'dp_dp') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_DP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_ECO') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_PRI') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'chp_URG') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CHP);
             }
             if ($_SESSION['shipping']['id'] == 'certifiedmail_certifiedmail') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CERTIFIEDMAIL);
             }
             if ($_SESSION['shipping']['id'] == 'hermes_hermes') {
                 $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_HERMES);
             }
             for ($i = 0; $i < count($cod_zones); $i++) {
                 if ($cod_zones[$i] == $oOrder->billing['country']['iso_code_2']) {
                     $cod_cost = $cod_zones[$i + 1];
                     $cod_country = true;
                     //print('match' . $i . ': ' . $cod_cost);
                     break;
                 } elseif ($cod_zones[$i] == '00') {
                     $cod_cost = $cod_zones[$i + 1];
                     $cod_country = true;
                     //print('match' . $i . ': ' . $cod_cost);
                     break;
                 } else {
                     //print('no match');
                 }
                 $i++;
             }
         } else {
             //COD selected, but no shipping module which offers COD
         }
         if ($cod_country) {
             if (MODULE_ORDER_TOTAL_COD_TAX_CLASS > 0) {
                 $cod_tax = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 // $cod_tax_description = oos_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 $cod_tax_description = oos_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS, $oOrder->billing['country']['id'], $oOrder->billing['zone_id']);
                 $oOrder->info['tax'] += oos_calculate_tax($cod_cost, $cod_tax);
                 $oOrder->info['tax_groups']["{$cod_tax_description}"] += oos_calculate_tax($cod_cost, $cod_tax);
                 $oOrder->info['total'] += $cod_cost + oos_calculate_tax($cod_cost, $cod_tax);
                 $this->output[] = array('title' => $this->title . ':', 'text' => $oCurrencies->format(oos_add_tax($cod_cost, $cod_tax), true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => oos_add_tax($cod_cost, $cod_tax));
             } else {
                 $oOrder->info['total'] += $cod_cost;
                 $this->output[] = array('title' => $this->title . ':', 'text' => $oCurrencies->format($cod_cost, true, $oOrder->info['currency'], $oOrder->info['currency_value']), 'value' => $cod_cost);
             }
         } 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' => '');
         }
     }
 }
예제 #24
0
                }

            }

            if ($product_info['products_base_price'] != 1) {
                $info_base_product_price = $oCurrencies->display_price($product_info['products_price'] * $product_info['products_base_price'], oos_get_tax_rate($product_info['products_tax_class_id']));

                if ($info_product_special_price != '') {
                    $info_base_product_special_price = $oCurrencies->display_price($info_product_special_price * $product_info['products_base_price'], oos_get_tax_rate($product_info['products_tax_class_id']));
                }
            }
        }


        if (OOS_BASE_PRICE == '0') {
            $info_product_price_list = $oCurrencies->display_price($product_info['products_price_list'], oos_get_tax_rate($product_info['products_tax_class_id']));
            $oSmarty->assign('info_product_price_list', $info_product_price_list);
        }

        // assign Smarty variables;
        $oSmarty->assign_by_ref("oEvent", $oEvent);

        $oSmarty->assign('product_info', $product_info);
        $oSmarty->assign('oosDate', date('Y-m-d H:i:s'));
        $oSmarty->assign('oos_base', (($request_type == 'SSL') ? OOS_HTTPS_SERVER : OOS_HTTP_SERVER) . OOS_SHOP);

        $oSmarty->assign(
              array(
                  'request_type'                    => $request_type,

                  'theme_set'                       => $sTheme,
예제 #25
0
 do {
     $nLanguageID = intval($_SESSION['language_id']);
     $productstable = $oostable['products'];
     $products_descriptiontable = $oostable['products_description'];
     $sql = "SELECT p.products_id, p.products_model, p.products_image, p.products_price,\n                         p.products_tax_class_id, p.products_quantity, pd.products_name, pd.products_description\n                    FROM {$productstable} p,\n                         {$products_descriptiontable} pd\n                   WHERE p.products_id = pd.products_id\n                     AND p.products_status >= '1'\n                     AND p.products_access = '0'\n                     AND pd.products_languages_id = '" . intval($nLanguageID) . "'";
     $products_result = $dbconn->SelectLimit($sql, $limit_step, $limit);
     $count = $products_result->RecordCount();
     if ($count > 0) {
         while ($products = $products_result->fields) {
             if ($specialprice = oos_get_products_special_price($products['products_id'])) {
                 $price = $specialprice;
             } else {
                 $price = $products['products_price'];
             }
             if ($price > 0) {
                 $tax = (100 + oos_get_tax_rate($products['products_tax_class_id'])) / 100;
                 $price = number_format($price * $tax, 2, ".", "");
                 $products_description = $products['products_description'];
                 $products_description = trim($products_description);
                 $products_description = strip_tags($products_description);
                 $products_description = utf8_encode($products_description);
                 /*
                                $output.='      <item>'."\n";
                                $output.='            <title>' . xmlentities(strip_tags($products['products_name']). " - " . $products['products_model']) . '</title>'."\n";
                                $output.='            <description>' . xmlentities($products_description) . '</description>'."\n";
                                $output.='            <link>' .  xmlentities($product_url . $products['products_id']) . '</link>'."\n";
                                $output.='            <g:image_link>' . urlencode($image_url . $products['products_image']) . '</g:image_link>'."\n";
                                $output.='            <guid isPermaLink="false">' . xmlentities($site_url.$products['products_id']) . '</guid>'."\n";
                                $output.='            <g:expiration_date>' . get_iso_8601_date(time() + ($ttl * 24 * 60 * 60)).'</g:expiration_date>'."\n";
                                $output.='            <g:currency>' . $currency . '</g:currency>'."\n";
                                $output.='            <g:price>' . $price . '</g:price>'."\n";
예제 #26
0
                           ON p.products_id = pd.products_id AND
                            pd.products_languages_id = '1' LEFT JOIN
                             " . $oostable['specials'] . " s
                           ON p.products_id = s.products_id
                         WHERE
                           (p.products_status >= '1' or p.products_status <= '4')
                         ORDER BY
                            p.products_date_added DESC,
                            pd.products_name";
        $products_result = $dbconn->Execute($products_sql);
        while ($products = $products_result->fields) {
          if ( (!empty($products['products_name'])) && (!empty($products['products_image'])) && (!empty($products['products_model'])) && (!empty($products['products_description'])) ) {
            if (isset($products['specials_new_products_price'])) {
              $products_price =  $currencies->psm_price($products['specials_new_products_price'], oos_get_tax_rate($products['products_tax_class_id']));
            } else {
              $products_price =  $currencies->psm_price($products['products_price'], oos_get_tax_rate($products['products_tax_class_id']));
            }
            switch ($products['products_status']) {
              case '1':
              case '2':
                $products_status = 'nicht verfgbar';
                break;

              case '3':
              case '4':
                $products_status = '3 Tage';
              break;
            }
            $products_description = strip_tags($products['products_description']);
            $products_description = substr($products_description, 0, 250) . '..';
            $products_description = str_replace(";",", ",$products_description);
예제 #27
0
        $new_product_units = UNITS_DELIMITER . $products_units[$top_viewed['products_units_id']];
        $new_product_price = $oCurrencies->display_price($top_viewed['products_price'], oos_get_tax_rate($top_viewed['products_tax_class_id']));
        if (isset($top_viewed['specials_new_products_price'])) {
            $new_special_price = $top_viewed['specials_new_products_price'];
            $new_product_special_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($top_viewed['products_tax_class_id']));
        } else {
            $new_max_product_discount = min($top_viewed['products_discount_allowed'], $_SESSION['member']->group['discount']);
            if ($new_max_product_discount != 0) {
                $new_special_price = $top_viewed['products_price'] * (100 - $new_max_product_discount) / 100;
                $new_product_discount_price = $oCurrencies->display_price($new_special_price, oos_get_tax_rate($top_viewed['products_tax_class_id']));
            }
        }
        if ($top_viewed['products_base_price'] != 1) {
            $new_base_product_price = $oCurrencies->display_price($top_viewed['products_price'] * $top_viewed['products_base_price'], oos_get_tax_rate($top_viewed['products_tax_class_id']));
            if ($new_special_price != '') {
                $new_base_product_special_price = $oCurrencies->display_price($new_special_price * $top_viewed['products_base_price'], oos_get_tax_rate($top_viewed['products_tax_class_id']));
            }
        }
        $top_viewed_array[] = array('id' => $top_viewed['products_id'], 'name' => $top_viewed['products_name'], 'image' => $top_viewed['products_image'], 'new_product_price' => $new_product_price, 'new_product_units' => $new_product_units, 'new_product_special_price' => $new_product_special_price, 'new_max_product_discount' => $new_max_product_discount, 'new_special_price' => $new_special_price, 'new_product_discount_price' => $new_product_discount_price, 'new_base_product_price' => $new_base_product_price, 'new_base_product_special_price' => $new_base_product_special_price, 'products_base_price' => $top_viewed['products_base_price'], 'new_products_base_unit' => $top_viewed['products_base_unit'], 'date_added' => $top_viewed['products_date_added'], 'manufacturer' => $top_viewed['manufacturers_name']);
        $top_viewed_result->MoveNext();
    }
    // links breadcrumb
    $oBreadcrumb->add($aLang['header_title_catalog'], oos_href_link($aPages['shop']));
    $oBreadcrumb->add($aLang['navbar_title'], oos_href_link($aPages['top_viewed']), bookmark);
    // assign Smarty variables;
    $oSmarty->assign(array('oos_breadcrumb' => $oBreadcrumb->trail(BREADCRUMB_SEPARATOR), 'oos_heading_title' => $aLang['heading_title'], 'oos_heading_image' => 'top_viewed.gif', 'oos_page_split' => $top_viewed_split->display_count($top_viewed_numrows, MAX_DISPLAY_PRODUCTS_NEW, $nCurrentPageNumber, $aLang['text_display_number_of_top_viewed']), 'oos_display_links' => $top_viewed_split->display_links($top_viewed_numrows, MAX_DISPLAY_PRODUCTS_NEW, MAX_DISPLAY_PAGE_LINKS, $nCurrentPageNumber, oos_get_all_get_parameters(array('nv', 'info'))), 'oos_page_numrows' => $top_viewed_numrows, 'products_image_box' => SMALL_IMAGE_WIDTH + 10, 'oos_top_viewed_array' => $top_viewed_array));
}
$oSmarty->assign('oosPageNavigation', $oSmarty->fetch($aOption['page_navigation'], $contents_cache_id));
$oSmarty->assign('oosBreadcrumb', $oSmarty->fetch($aOption['breadcrumb'], $contents_cache_id));
$oSmarty->assign('oosPageHeading', $oSmarty->fetch($aOption['page_heading'], $contents_cache_id));
$oSmarty->assign('contents', $oSmarty->fetch($aOption['template_main'], $contents_cache_id));
예제 #28
0
 function quote($method = '')
 {
     global $aLang, $oOrder, $shipping_weight, $shipping_num_boxes;
     if (!empty($method) && isset($this->types[$method])) {
         $prod = $method;
     } else {
         $prod = 'GNDRES';
     }
     if ($method) {
         $this->_upsAction('3');
     }
     // return a single quote
     $this->_upsProduct($prod);
     $country_name = oos_get_countries(STORE_COUNTRY, true);
     $this->_upsOrigin(STORE_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
     $this->_upsDest($oOrder->delivery['postcode'], $oOrder->delivery['country']['iso_code_2']);
     $this->_upsRate(MODULE_SHIPPING_UPS_PICKUP);
     $this->_upsContainer(MODULE_SHIPPING_UPS_PACKAGE);
     $this->_upsWeight($shipping_weight);
     $this->_upsRescom(MODULE_SHIPPING_UPS_RES);
     $upsQuote = $this->_upsGetQuote();
     if (is_array($upsQuote) && count($upsQuote) > 0) {
         $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');
         $methods = array();
         $qsize = count($upsQuote);
         for ($i = 0; $i < $qsize; $i++) {
             list($type, $cost) = each($upsQuote[$i]);
             $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
         }
         $this->quotes['methods'] = $methods;
         if ($this->tax_class > 0) {
             $this->quotes['tax'] = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
         }
     } else {
         $this->quotes = array('module' => $this->title, 'error' => 'An error occured with the UPS shipping calculations.<br />' . $upsQuote . '<br />If you prefer to use UPS as your shipping method, please contact the store owner.');
     }
     if (!empty($this->icon)) {
         $this->quotes['icon'] = oos_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
예제 #29
0
if (!$oSmarty->is_cached($aOption['template_main'], $contents_cache_id)) {
    $productstable = $oostable['products'];
    $specialstable = $oostable['specials'];
    $products_descriptiontable = $oostable['products_description'];
    $specials_result_raw = "SELECT p.products_id, pd.products_name, p.products_image, p.products_price,\n                                   p.products_base_price, p.products_base_unit, p.products_tax_class_id,\n                                   p.products_units_id, p.products_image, s.specials_new_products_price,\n                                   substring(pd.products_description, 1, 150) AS products_description\n                            FROM {$productstable} p,\n                                 {$products_descriptiontable} pd,\n                                 {$specialstable} s\n                           WHERE p.products_status >= '1'\n                             AND (p.products_access = '0' OR p.products_access = '" . intval($nGroupID) . "')\n                             AND s.products_id = p.products_id\n                             AND p.products_id = pd.products_id\n                             AND pd.products_languages_id = '" . intval($nLanguageID) . "'\n                             AND s.status = '1'\n                           ORDER BY s.specials_date_added DESC";
    $specials_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SPECIAL_PRODUCTS, $specials_result_raw, $specials_numrows);
    $specials_result = $dbconn->Execute($specials_result_raw);
    $aSpecials = array();
    while ($specials = $specials_result->fields) {
        $specials_base_product_price = '';
        $specials_base_product_special_price = '';
        $specials_product_price = $oCurrencies->display_price($specials['products_price'], oos_get_tax_rate($specials['products_tax_class_id']));
        $specials_product_special_price = $oCurrencies->display_price($specials['specials_new_products_price'], oos_get_tax_rate($specials['products_tax_class_id']));
        if ($specials['products_base_price'] != 1) {
            $specials_base_product_price = $oCurrencies->display_price($specials['products_price'] * $specials['products_base_price'], oos_get_tax_rate($specials['products_tax_class_id']));
            $specials_base_product_special_price = $oCurrencies->display_price($specials['specials_new_products_price'] * $specials['products_base_price'], oos_get_tax_rate($specials['products_tax_class_id']));
        }
        $aSpecials[] = array('products_id' => $specials['products_id'], 'products_image' => $specials['products_image'], 'products_name' => $specials['products_name'], 'products_description' => $specials['products_description'], 'products_base_unit' => $specials['products_base_unit'], 'products_base_price' => $specials['products_base_price'], 'products_price' => $specials_product_price, 'products_special_price' => $specials_product_special_price, 'base_product_price' => $specials_base_product_price, 'base_product_special_price' => $specials_base_product_special_price);
        $specials_result->MoveNext();
    }
    // links breadcrumb
    $oBreadcrumb->add($aLang['navbar_title'], oos_href_link($aPages['specials']), bookmark);
    // assign Smarty variables;
    $oSmarty->assign(array('oos_breadcrumb' => $oBreadcrumb->trail(BREADCRUMB_SEPARATOR), 'oos_heading_title' => $aLang['heading_title'], 'oos_heading_image' => 'specials.gif', 'oos_page_split' => $specials_split->display_count($specials_numrows, MAX_DISPLAY_SPECIAL_PRODUCTS, $_GET['page'], $aLang['text_display_number_of_specials']), 'oos_display_links' => $specials_split->display_links($specials_numrows, MAX_DISPLAY_SPECIAL_PRODUCTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], oos_get_all_get_parameters(array('page', 'info'))), 'oos_page_numrows' => $specials_numrows, 'oos_specials_array' => $aSpecials));
}
$oSmarty->assign('oosPageNavigation', $oSmarty->fetch($aOption['page_navigation'], $contents_cache_id));
$oSmarty->assign('oosBreadcrumb', $oSmarty->fetch($aOption['breadcrumb'], $contents_cache_id));
$oSmarty->assign('oosPageHeading', $oSmarty->fetch($aOption['page_heading'], $contents_cache_id));
$oSmarty->assign('contents', $oSmarty->fetch($aOption['template_main'], $contents_cache_id));
$oSmarty->caching = false;
// display the template
예제 #30
0
 function calculate_tax_deduction($amount, $od_amount, $method)
 {
     global $oOrder;
     switch ($method) {
         case 'Standard':
             $ratio1 = round($od_amount / $amount, 2);
             $tod_amount = 0;
             foreach ($oOrder->info['tax_groups'] as $key => $value) {
                 $tax_rate = oos_get_tax_rate_from_desc($key);
                 $total_net += $tax_rate * $oOrder->info['tax_groups'][$key];
             }
             if ($od_amount > $total_net) {
                 $od_amount = $total_net;
             }
             foreach ($oOrder->info['tax_groups'] as $key => $value) {
                 $tax_rate = oos_get_tax_rate_from_desc($key);
                 $net = $tax_rate * $oOrder->info['tax_groups'][$key];
                 if ($net > 0) {
                     $god_amount = $oOrder->info['tax_groups'][$key] * $ratio1;
                     $tod_amount += $god_amount;
                     $oOrder->info['tax_groups'][$key] = $oOrder->info['tax_groups'][$key] - $god_amount;
                 }
             }
             $oOrder->info['tax'] -= $tod_amount;
             $oOrder->info['total'] -= $tod_amount;
             break;
         case 'Credit Note':
             $tax_rate = oos_get_tax_rate($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
             $tax_desc = oos_get_tax_description($this->tax_class, $oOrder->delivery['country']['id'], $oOrder->delivery['zone_id']);
             $tod_amount = $this->deduction / (100 + $tax_rate) * $tax_rate;
             $oOrder->info['tax_groups'][$tax_desc] -= $tod_amount;
             //          $oOrder->info['total'] -= $tod_amount;
             break;
         default:
     }
     return $tod_amount;
 }