• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP vam_get_tax_rate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中vam_get_tax_rate函数的典型用法代码示例。如果您正苦于以下问题:PHP vam_get_tax_rate函数的具体用法?PHP vam_get_tax_rate怎么用?PHP vam_get_tax_rate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vam_get_tax_rate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: quote

 function quote($method = '')
 {
     global $order, $shipping_weight, $shipping_num_boxes, $vamPrice;
     if (MODULE_SHIPPING_NEWPOST_MODE == 'price') {
         $order_total = $vamPrice->RemoveCurr($_SESSION['cart']->show_total());
     } else {
         $order_total = $shipping_weight;
     }
     $table_cost = preg_split("/[:,]/", MODULE_SHIPPING_NEWPOST_COST);
     $size = sizeof($table_cost);
     for ($i = 0, $n = $size; $i < $n; $i += 2) {
         if ($order_total <= $table_cost[$i]) {
             $shipping = $table_cost[$i + 1];
             break;
         }
     }
     if (MODULE_SHIPPING_NEWPOST_MODE == 'weight') {
         $shipping = $shipping * $shipping_num_boxes;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_NEWPOST_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_NEWPOST_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_NEWPOST_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:28,代码来源:newpost.php


示例2: quote

 function quote($method = '')
 {
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_SOGL_TEXT_TITLE);
     $this->quotes['methods'] = array(array('id' => $this->code, 'title' => MODULE_SHIPPING_SOGL_TEXT_WAY, 'cost' => 0));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:12,代码来源:sogl.php


示例3: process

 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));
     }
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:53,代码来源:ot_shipping.php


示例4: quote

 function quote($method = '')
 {
     global $order, $total_count;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_COST * $total_count + MODULE_SHIPPING_ITEM_HANDLING)));
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:12,代码来源:item.php


示例5: process

 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);
         }
     }
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:49,代码来源:ot_loworderfee.php


示例6: ItemAttributsSetUp

function ItemAttributsSetUp($current_product_id)
{
    // I found the easiest way to do this is just delete the current attributes & start over =)
    // download function start
    $delete_sql = vam_db_query("SELECT products_attributes_id FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'");
    while ($delete_res = vam_db_fetch_array($delete_sql)) {
        $delete_download_sql = vam_db_query("SELECT products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['prducts_attributes_id'] . "'");
        $delete_download_file = vam_db_fetch_array($delete_download_sql);
        vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['products_attributes_id'] . "'");
    }
    // download function end
    vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'");
    // Simple, yet effective.. loop through the selected Option Values.. find the proper price & prefix.. insert.. yadda yadda yadda.
    for ($i = 0; $i < sizeof($_POST['optionValues']); $i++) {
        $query = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . $_POST['optionValues'][$i] . "'";
        $result = vam_db_query($query);
        $matches = vam_db_num_rows($result);
        while ($line = vam_db_fetch_array($result)) {
            $optionsID = $line['products_options_id'];
        }
        $cv_id = $_POST['optionValues'][$i];
        $value_price = $_POST[$cv_id . '_price'];
        if (PRICE_IS_BRUTTO == 'true') {
            $value_price = $value_price / (vam_get_tax_rate(vam_get_tax_class_id($current_product_id)) + 100) * 100;
        }
        $value_price = vam_round($value_price, PRICE_PRECISION);
        $value_prefix = $_POST[$cv_id . '_prefix'];
        $value_sortorder = $_POST[$cv_id . '_sortorder'];
        $value_weight_prefix = $_POST[$cv_id . '_weight_prefix'];
        $value_model = $_POST[$cv_id . '_model'];
        $value_stock = $_POST[$cv_id . '_stock'];
        $value_weight = $_POST[$cv_id . '_weight'];
        vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix ,attributes_model, attributes_stock, options_values_weight, weight_prefix,sortorder) VALUES ('" . $current_product_id . "', '" . $optionsID . "', '" . $_POST['optionValues'][$i] . "', '" . $value_price . "', '" . $value_prefix . "', '" . $value_model . "', '" . $value_stock . "', '" . $value_weight . "', '" . $value_weight_prefix . "','" . $value_sortorder . "')") or die(mysql_error());
        $products_attributes_id = vam_db_insert_id();
        if ($_POST[$cv_id . '_download_file'] != '') {
            if (DOWNLOAD_ENABLED == 'true') {
                $value_download_file = $_POST[$cv_id . '_download_file'];
                $value_download_expire = $_POST[$cv_id . '_download_expire'];
                $value_download_count = $_POST[$cv_id . '_download_count'];
                $value_is_pin = $_POST[$cv_id . '_ispin'];
                $products_attributes_is_pin = isset($value_is_pin) ? 1 : 0;
                vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " (products_attributes_id, products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount, products_attributes_is_pin) VALUES ('" . $products_attributes_id . "', '" . $value_download_file . "', '" . $value_download_expire . "', '" . $value_download_count . "', '" . $products_attributes_is_pin . "')") or die(mysql_error());
            }
        }
    }
}
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:46,代码来源:new_attributes_change.php


示例7: quote

 function quote($method = '')
 {
     global $vamPrice;
     if ($vamPrice->RemoveCurr($_SESSION['cart']->show_total()) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT && MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'False') {
         return;
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE);
     if ($vamPrice->RemoveCurr($_SESSION['cart']->show_total()) < MODULE_SHIPPING_FREEAMOUNT_AMOUNT) {
         $this->quotes['error'] = sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $vamPrice->Format(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true));
     } else {
         $this->quotes['methods'] = array(array('id' => $this->code, 'title' => sprintf(MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY, $vamPrice->Format(MODULE_SHIPPING_FREEAMOUNT_AMOUNT, true, 0, true)), 'cost' => 0));
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:20,代码来源:freeamount.php


示例8: quote

 function quote()
 {
     global $order, $shipping_weight;
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_CHRONOPOST_TEXT_TITLE, 'methods' => array());
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     $dest_country = $order->delivery['country']['iso_code_2'];
     $dest_zone = 0;
     for ($i = 1; $i <= $this->num_chronopost; $i++) {
         $countries_table = constant('MODULE_SHIPPING_CHRONOPOST_COUNTRIES_' . $i);
         $country = preg_split("/[,]/", $countries_table);
         if (in_array($dest_country, $country)) {
             $dest_zone = $i;
             break;
         }
     }
     if ($dest_zone == 0) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_INVALID_ZONE;
         return $this->quotes;
     }
     $table = preg_split("/[:,]/", constant('MODULE_SHIPPING_CHRONOPOST_COST_' . $dest_zone));
     $cost = -1;
     for ($i = 0, $n = sizeof($table); $i < $n; $i += 2) {
         if ($shipping_weight <= $table[$i]) {
             $cost = $table[$i + 1] + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING;
             break;
         }
     }
     if ($cost == -1) {
         $this->quotes['error'] = MODULE_SHIPPING_CHRONOPOST_UNDEFINED_RATE;
         return $this->quotes;
     }
     $this->quotes['methods'][] = array('id' => $this->code, 'title' => MODULE_SHIPPING_CHRONOPOST_TEXT_WAY . ' ' . $order->delivery['country']['title'], 'cost' => $cost + MODULE_SHIPPING_CHRONOPOST_HANDLING + SHIPPING_HANDLING);
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:39,代码来源:chronopost.php


示例9: quote

 function quote($method = '')
 {
     global $order, $cart, $shipping_weight, $own_zone_id;
     if ($shipping_weight == 0) {
         $shipping_weight = MODULE_SHIPPING_SPSR_DEFAULT_SHIPPING_WEIGHT;
     }
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     //вытаскиваем Region ID города назначения базы
     $region_id = vam_get_spsr_zone_id($order->delivery['zone_id']);
     //вытаскиваем свой Region ID из базы
     $own_cpcr_id = vam_get_spsr_zone_id($own_zone_id);
     //oscommerce дважды запрашивает цену доставки c cpcr.ru - до подтверждения цены доставки (для показа пользователю) и после подтверждения цены доставки (нажатие кнопки "Продолжить"). Х.з. почему, видимо так работает oscommerce. Чтобы не запрашивать дважды кешируем $cost в hidden поле cost.
     if (!isset($_POST['cost'])) {
         //составление запроса стоимости доставки
         if (isset($_POST['error_tocity'])) {
             $request = 'http://cpcr.ru/cgi-bin/postxml.pl?TariffCompute&FromRegion=' . $own_cpcr_id . '|0&FromCityName=' . iconv("UTF-8", "windows-1251", MODULE_SHIPPING_SPSR_FROM_CITY) . '&Weight=' . $shipping_weight . '&Nature=' . MODULE_SHIPPING_SPSR_NATURE . '&Amount=0&Country=209|0&ToCity=' . iconv("UTF-8", "windows-1251", $_POST['error_tocity']);
         } else {
             $request = 'http://cpcr.ru/cgi-bin/postxml.pl?TariffCompute&FromRegion=' . $own_cpcr_id . '|0&FromCityName=' . iconv("UTF-8", "windows-1251", MODULE_SHIPPING_SPSR_FROM_CITY) . '&Weight=' . $shipping_weight . '&Nature=' . MODULE_SHIPPING_SPSR_NATURE . '&Amount=0&Country=209|0&ToRegion=' . $region_id . '|0&ToCityName=' . iconv("UTF-8", "windows-1251", $order->delivery['city']);
         }
         //проверки связи с сервером
         $server_link = false;
         $file_headers = @get_headers($request);
         if ($file_headers[0] !== 'HTTP/1.1 404 Not Found' && $file_headers !== false) {
             $server_link = true;
         }
         //Запрос стоимости с cpcr.ru
         if ($server_link == true) {
             $xmlstring = simplexml_load_file($request);
         } else {
             $title = "<font color=red>Нет связи с сервером cpcr.ru, стоимость доставки не определена.</font>";
             $cost = 0;
         }
         //получение цены доставки
         if ($xmlstring->PayTariff) {
             $find_symbols = array(chr(160), 'р.', ' ');
             //вместо пробела в стоимости доставки cpcr.ru использует симовл с ascii кодом 160.
             $cost = ceil(str_replace(',', '.', str_replace($find_symbols, '', $xmlstring->Total)));
             $title .= 'Доставка в ' . $order->delivery['city'] . ', ' . $order->delivery['state'];
             if ($cost > 0) {
                 $title .= '<input type="hidden" name="cost" value="' . $cost . '">';
             }
         }
         //если $cost уже был определен
     } else {
         $cost = $_POST['cost'];
         $title .= 'Доставка в ' . $order->delivery['city'] . ', ' . $order->delivery['state'];
         if ($cost > 0) {
             $title .= '<input type="hidden" name="cost" value="' . $cost . '">';
         }
     }
     //Обработка ошибки Город не найден
     if ($xmlstring->Error->ToCity && $server_link == true) {
         $title .= "<font color=red>Ошибка, город \"" . $order->delivery['city'] . "\" не найден. Либо в названии города допущена ошибка, либо в данный город СПСР доставку не производит.</font><br>";
     }
     //Уточнение названия города, для получения City_Id c сервера cpcr.ru
     if (!$xmlstring->Error->ToCity->City->CityName == '') {
         $title .= "<font color=red>Пожалуйста уточните название вашего города:</font><br>";
         if ($xmlstring->Error->ToCity->City) {
             foreach ($xmlstring->Error->ToCity->City as $city_value) {
                 $title .= "<input type=radio name=error_tocity value=\"" . $city_value->City_Id . "|" . $city_value->City_Owner_Id . "\" onChange=\"this.form.submit()\">" . $city_value->CityName . ", " . $city_value->RegionName . "<br>";
                 //начало код для унификации с калькулятором
                 echo "<input type=hidden name=\"" . $city_value->City_Id . "|" . $city_value->City_Owner_Id . "\" value=\"" . $city_value->CityName . ", " . $city_value->RegionName . "\">";
                 //конец код для унификации с калькулятором
             }
         }
     }
     //Обработка ошибки Веса
     if ($xmlstring->Error->Weight) {
         $title .= "<br><font color=red>Ошибка! Неправильный формат веса</font>";
     }
     //Оюработка ошибки Оценочной стоимости
     if ($xmlstring->Error->Amount) {
         $title .= "<br><font color=red>Ошибка! Неправильный формат оценочной стоимости</font>";
     }
     if (!isset($own_cpcr_id)) {
         $title .= "<br><font color=red>Ошибка! Вы не выбрали зону! (Администрирование>Настройки>My store>Zone)</font>";
     }
     //Обработка ошибки Mutex Wait Timeout
     if ($xmlstring->Error['Type'] == 'Mutex' & $xmlstring->Error['SubType'] == 'Wait Timeout') {
         $title .= "<br><font color=red>Ошибка! cpcr.ru не вернул ответ на запрос. Попробуйте обновить страницу.</font>";
     }
     //Обработка ошибки ComputeTariff CalcError
     if ($xmlstring->Error['Type'] == 'ComputeTariff' & $xmlstring->Error['SubType'] == 'CalcError') {
         $title .= "<br><font color=red>Ошибка! Ошибка вычисления стоимости доставки.</font>";
     }
     //Обработка ошибки Command Unknown
     if ($xmlstring->Error['Type'] == 'Command' & $xmlstring->Error['SubType'] == 'Unknown') {
         $title .= "<br><font color=red>Ошибка! Неизвестная команда.</font>";
     }
     //Обработка ошибки Unknown Unknown (прочие ошибки)
     if ($xmlstring->Error['Type']) {
         $title .= "<br><font color=red>Неизвестная ошибка, попробуйте позже.</font>";
     }
     //Отображдение отладочной информации
     if (MODULE_SHIPPING_SPSR_DEBUG == 'True') {
         $title .= "<br>" . '$own_zone_id=' . $own_zone_id . "<br>" . '$order->delivery[\'zone_id\']=' . $order->delivery['zone_id'] . "<br>" . '$own_cpcr_id=' . $own_cpcr_id . "<br>" . 'MODULE_SHIPPING_SPSR_OWN_CITY_DELIVERY=' . MODULE_SHIPPING_SPSR_OWN_CITY_DELIVERY . "<br>" . 'MODULE_SHIPPING_SPSR_OWN_REGION_DELIVERY=' . MODULE_SHIPPING_SPSR_OWN_REGION_DELIVERY . "<br>" . '$shipping_weight=' . $shipping_weight . "<br>" . 'MODULE_SHIPPING_SPSR_NATURE=' . MODULE_SHIPPING_SPSR_NATURE . "<br>" . '$request=' . $request . "<br>" . '$cost=' . $cost . "<br>" . '$_POST[\'cost\']=' . $_POST['cost'];
         '$xmlstring:' . "<br>" . (is_object($xmlstring) ? "<textarea readonly=\"readonly\" rows=\"5\">" . $xmlstring->asXML() . "</textarea>" : '');
     }
//.........这里部分代码省略.........
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:101,代码来源:spsr.php


示例10: quote


//.........这里部分代码省略.........
                 $shipping_wpx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_wpx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_wpx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_WPX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_WPX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_WPX_50_' . $j) + $dhl_table_wpx[count($dhl_table_wpx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_wpx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_wpx[$i]) {
                         $shipping_wpx = $dhl_table_wpx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_wpx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_3 = $shipping_wpx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'WPX', 'title' => 'Waren Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_3) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_mdx != '') {
             $dhl_table_mdx = preg_split("/[:,]/", $dhl_cost_mdx);
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_mdx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_mdx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_mdx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_mdx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_MDX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_MDX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_MDX_50_' . $j) + $dhl_table_mdx[count($dhl_table_mdx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_mdx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_mdx[$i]) {
                         $shipping_mdx = $dhl_table_mdx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_mdx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_4 = $shipping_mdx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'MDX', 'title' => 'Mid Day Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_4) * $shipping_num_boxes);
             $n++;
         }
         if ($dhl_cost_sdx != '') {
             $dhl_table_sdx = preg_split("/[:,]/", $dhl_cost_sdx);
             if ($shipping_weight > 10 and $shipping_weight <= 20) {
                 $shipping_sdx = number_format(($shipping_weight - 10) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 20 and $shipping_weight <= 30) {
                 $shipping_sdx = number_format(($shipping_weight - 20) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 30 and $shipping_weight <= 50) {
                 $shipping_sdx = number_format(($shipping_weight - 30) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_50_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } elseif ($shipping_weight > 50) {
                 $shipping_sdx = number_format(($shipping_weight - 50) * 2 + 0.5, 0) * constant('MODULE_SHIPPING_DHL_STEP_SDX_51_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_20_' . $j) + 20 * constant('MODULE_SHIPPING_DHL_STEP_SDX_30_' . $j) + 40 * constant('MODULE_SHIPPING_DHL_STEP_SDX_50_' . $j) + $dhl_table_sdx[count($dhl_table_sdx) - 1];
             } else {
                 for ($i = 0; $i < sizeof($dhl_table_sdx); $i += 2) {
                     if ($shipping_weight <= $dhl_table_sdx[$i]) {
                         $shipping_sdx = $dhl_table_sdx[$i + 1];
                         break;
                     }
                 }
             }
             if ($shipping_sdx == -1) {
                 $shipping_cost = 0;
                 $shipping_method = MODULE_SHIPPING_DHL_UNDEFINED_RATE;
             } else {
                 $shipping_cost_5 = $shipping_sdx + MODULE_SHIPPING_DHL_HANDLING;
             }
             $methods[] = array('id' => 'SDX', 'title' => 'Start Day Express Service', 'cost' => (MODULE_SHIPPING_DHL_HANDLING + $shipping_cost_5) * $shipping_num_boxes);
             $n++;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_DHL_TEXT_UNITS . ')');
     $this->quotes['methods'] = $methods;
     if ($this->tax_class > 0) {
         $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
     }
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     if ($error == true) {
         $this->quotes['error'] = MODULE_SHIPPING_DHL_INVALID_ZONE;
     }
     if (vam_not_null($method) && isset($this->types[$method])) {
         for ($i = 0; $i < sizeof($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;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:101,代码来源:dhl.php


示例11: process

 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' => '');
         }
     }
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:83,代码来源:ot_ps_fee.php


示例12: splitPageResults

    echo TABLE_HEADING_ACTION;
    ?>
&nbsp;</td>
              </tr>
<?php 
    $specials_query_raw = "select p.products_id, pd.products_name,p.products_tax_class_id, p.products_price, s.specials_id, s.specials_new_products_price, s.specials_date_added, s.specials_last_modified, s.expires_date, s.date_status_change, s.status from " . TABLE_PRODUCTS . " p, " . TABLE_SPECIALS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' and p.products_id = s.products_id order by pd.products_name";
    $specials_split = new splitPageResults($_GET['page'], MAX_DISPLAY_ADMIN_PAGE, $specials_query_raw, $specials_query_numrows);
    $specials_query = vam_db_query($specials_query_raw);
    while ($specials = vam_db_fetch_array($specials_query)) {
        $price = $specials['products_price'];
        $new_price = $specials['specials_new_products_price'];
        if (PRICE_IS_BRUTTO == 'true') {
            $price_netto = vam_round($price, PRICE_PRECISION);
            $new_price_netto = vam_round($new_price, PRICE_PRECISION);
            $price = $price * (vam_get_tax_rate($specials['products_tax_class_id']) + 100) / 100;
            $new_price = $new_price * (vam_get_tax_rate($specials['products_tax_class_id']) + 100) / 100;
        }
        $specials['products_price'] = vam_round($price, PRICE_PRECISION);
        $specials['specials_new_products_price'] = vam_round($new_price, PRICE_PRECISION);
        if ((!$_GET['sID'] || $_GET['sID'] == $specials['specials_id']) && !$sInfo) {
            $products_query = vam_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . $specials['products_id'] . "'");
            $products = vam_db_fetch_array($products_query);
            $sInfo_array = vam_array_merge($specials, $products);
            $sInfo = new objectInfo($sInfo_array);
            $sInfo->specials_new_products_price = $specials['specials_new_products_price'];
            $sInfo->products_price = $specials['products_price'];
        }
        if (is_object($sInfo) && $specials['specials_id'] == $sInfo->specials_id) {
            echo '                  <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . vam_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=edit') . '\'">' . "\n";
        } else {
            echo '                  <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . vam_href_link(FILENAME_SPECIALS, 'page=' . $_GET['page'] . '&sID=' . $specials['specials_id']) . '\'">' . "\n";
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:31,代码来源:specials.php


示例13: quote

 function quote($method = '')
 {
     global $order, $cart, $shipping_weight, $own_city_id;
     $calc = new CalculatePriceDeliveryCdek();
     try {
         if ($this->tax_class > 0) {
             $this->quotes['tax'] = vam_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
         }
         //устанавливаем город-отправитель
         $check_query = vam_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key='MODULE_SHIPPING_SDEK_FROM_CITY'");
         $check = vam_db_fetch_array($check_query);
         $own_city_name = $check['configuration_value'];
         //echo 'Grad:'.$own_city_name.'<br>';
         $city_check_query = vam_db_query("select city_id from city where city_name='" . $own_city_name . "'");
         $city_check = vam_db_fetch_array($city_check_query);
         $own_city_id = $city_check['city_id'];
         $calc->setSenderCityId($own_city_id);
         //echo 'Grad:'.$own_city_id.'<br>';
         //устанавливаем город-получатель
         $city_shipping_to_name = $order->delivery['city'];
         $city_check_query = vam_db_query("select city_id from city where city_name='" . $city_shipping_to_name . "'");
         $city_check = vam_db_fetch_array($city_check_query);
         $city_shipping_id = $city_check['city_id'];
         $calc->setReceiverCityId($city_shipping_id);
         //echo 'Grad primaoca:'.$city_shipping_id.'<br>';
         //устанавливаем дату планируемой отправки
         $shipping_date = date("Y-m-d");
         $calc->setDateExecute($shipping_date);
         //echo 'Datum:'.$shipping_date.'<br>';
         //устанавливаем тариф по-умолчанию
         $calc->setTariffId('1');
         //устанавливаем режим доставки
         $calc->setModeDeliveryId('1');
         //добавляем места в отправление
         if ($shipping_weight == 0) {
             $shipping_weight = MODULE_SHIPPING_SDEK_DEFAULT_SHIPPING_WEIGHT;
             //echo 'Tezina:'.$shipping_weight.'<br>';
         }
         $calc->addGoodsItemBySize($shipping_weight, '40', '50', '60');
         //$calc->addGoodsItemByVolume('0.1', '0.1');
         if ($calc->calculate() === true) {
             $res = $calc->getResult();
         }
         /*
         		echo 'Цена доставки: ' . $res['result']['price'] . 'руб.<br />';
         		echo 'Срок доставки: ' . $res['result']['deliveryPeriodMin'] . '-' . 
         								 $res['result']['deliveryPeriodMax'] . ' дн.<br />';
         		echo 'Планируемая дата доставки: c ' . $res['result']['deliveryDateMin'] . ' по ' . $res['result']['deliveryDateMax'] . '.<br />';
         		echo 'id тарифа, по которому произведён расчёт: ' . $res['result']['tariffId'] . '.<br />';
                 if(array_key_exists('cashOnDelivery', $res['result'])) {
                     echo 'Ограничение оплаты наличными, от (руб): ' . $res['result']['cashOnDelivery'] . '.<br />';
                 }
         	} else {
         		$err = $calc->getError();
         		if( isset($err['error']) && !empty($err) ) {
         			var_dump($err);
         			foreach($err['error'] as $e) {
         				echo 'Код ошибки: ' . $e['code'] . '.<br />';
         				echo 'Текст ошибки: ' . $e['text'] . '.<br />';
         			}
         		}
         	}	*/
     } catch (Exception $e) {
         echo 'Ошибка: ' . $e->getMessage() . "<br />";
     }
     if ($method != '') {
         $title = strip_tags($title);
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_SDEK_TEXT_TITLE);
     $this->quotes['methods'] = array(array('id' => $this->code, 'title' => MODULE_SHIPPING_SDEK_TEXT_NOTE, 'cost' => $res['result']['price']));
     if (vam_not_null($this->icon)) {
         $this->quotes['icon'] = vam_image($this->icon, $this->title);
     }
     return $this->quotes;
 }
开发者ID:vitaliyhan,项目名称:shipping_module_sdek,代码行数:75,代码来源:sdek.php


示例14: quote

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP vam_href_link函数代码示例发布时间:2022-05-23
下一篇:
PHP vam_get_all_get_params函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap