当前位置: 首页>>代码示例>>PHP>>正文


PHP vam_get_tax_rate函数代码示例

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


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


//.........这里部分代码省略.........
     //узнаем посылка или бандероль
     //вес заказа меньше максимального для бандероли
     $need_wr = MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPER_MAXWEIGHT < $shipping_weight ? MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPERS_OR_PARCEL == 'True' ? 1 : 0 : 1;
     //$wrapper = 0 - посылка
     //$wrapper = 1 - бандероль
     #####			$wrapper = (MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPER_STATUS_PF == 'True' && $need_wr) ? $this->is_wrapper($order->products)  : 0;
     $wrapper = MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPER_STATUS_PF == 'True' && $need_wr ? $this->is_wrapper($_SESSION['cart']->get_products()) : 0;
     if ($wrapper == 0 && MODULE_SHIPPING_RUSSIANPOSTPREPAY_PARCEL_STATUS_PF != 'True') {
         return false;
     }
     $mode = $wrapper == 1 ? 'WRAPPER' : 'PARCEL';
     //смотрим запрещённые регионы
     $zones_table = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_LIMITATION_PF');
     $zones = preg_split("/[,]/", $zones_table);
     if (in_array($dest_zone_id, $zones)) {
         return false;
         /*
         					$error = true;
                   			$err_msg = MODULE_SHIPPING_RUSSIANPOSTPREPAY_UNDEFINED_RATE_PF;
         */
     }
     //высчитываем на сколько посылок/бандеролей нужно разбить заказ
     $need_parcel = 1;
     $maxweight = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_MAXWEIGHT');
     if ($shipping_weight > $maxweight) {
         $need_parcel = ceil($shipping_weight / $maxweight);
     }
     if ($dest_zone == 0) {
         $error = true;
         $err_msg = MODULE_SHIPPING_RUSSIANPOSTPREPAY_INVALID_ZONE_PF;
     } else {
         $zones_cost = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_STATES_PRICE_' . $mode . '_' . $dest_zone);
         $cost_table = preg_split("/[:,]/", $zones_cost);
         $shipping = $this->price($cost_table, $shipping_weight, $need_parcel, $maxweight, constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_REG'));
         $shipping_method = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_WAY_' . $mode . '_PF') . ' <nobr>(' . $order->delivery['state'] . ' - ' . $shipping_weight . ' ' . MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_UNITS_PF . '</nobr> <nobr>[' . constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_NEED_PF') . $this->om_number($need_parcel, array(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_1_PF'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_2_PF'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_5_PF'))) . ']</nobr>)';
         if ($shipping == 0) {
             $shipping = -1;
         }
         if ($shipping == -1) {
             $error = true;
             $err_msg = MODULE_SHIPPING_RUSSIANPOSTPREPAY_UNDEFINED_RATE_PF;
         } else {
             /**** Формула подсчёта цены ****/
             /*-- "Риски" магазина --*/
             //РИСКИ МАГАЗИНА
             $burden = 0;
             $burden_data = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_COST');
             if (!empty($burden_data) || $burden_data > 0) {
                 $burden = strpos($burden_data, '%') === false ? $burden_data : substr($burden_data, 0, strpos($burden_data, '%'));
                 $burden_proc = strpos($burden_data, '%') === false ? false : true;
                 //узнаем откуда высчитывать страховку
                 $burden_method = 0;
                 if ($burden_proc) {
                     $bm = substr($burden_data, 0, 1);
                     if ($bm == 'p' || $bm == 'P' || $bm == 'р' || $bm == 'Р') {
                         $burden_method = 'products';
                     } else {
                         if ($bm == 'd' || $bm == 'D') {
                             $burden_method = 'delivery';
                         } else {
                             $burden_method = 'all';
                         }
                     }
                     ###                     		$burden = substr(substr($burden_data, 0, strpos($burden_data, '%')), ((intval($bm) > 0)?0:1), strlen($burden_data)-1);
                     $burden = substr(substr($burden_data, 0, strpos($burden_data, '%')), $bm == '' ? 0 : 1, strlen($burden_data) - 1);
                 }
             }
             if ($burden_method == 'delivery' && $burden_proc) {
                 $delivery = $shipping + $shipping / 100 * $burden;
             } elseif ($burden_method == 'products' && $burden_proc) {
                 $delivery = $shipping + $vamPrice->RemoveCurr($_SESSION['cart']->show_total()) / 100 * $burden;
             } elseif ($burden_method == 'all' && $burden_proc) {
                 $delivery = $shipping + ($shipping + $_SESSION['cart']->show_total()) / 100 * $burden;
             } else {
                 $delivery = $shipping;
             }
             //прибавим страховую сумму магазина (НЕ процент)
             if (!$burden_proc) {
                 $delivery += $burden;
             }
             //доставка + сумма заказа
             $appraisal_price = $delivery + $_SESSION['cart']->show_total();
             //высчитываем страховую стоимость
             $insurance_price = $this->insurance($appraisal_price, intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE')));
             //итоговая стоимость доставки = доставка + плата за сбор посылки + страховой процент
             $shipping_cost = $delivery + $insurance_price;
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_TITLE_PF, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => ceil($shipping_cost))));
     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'] = $err_msg;
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:101,代码来源:russianpostpf.php

示例15: quote


//.........这里部分代码省略.........
             }
         }
     }
     //узнаем посылка или бандероль
     //вес заказа меньше максимального для бандероли
     $need_wr = MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPER_MAXWEIGHT < $shipping_weight ? MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPERS_OR_PARCEL == 'True' ? 1 : 0 : 1;
     //$wrapper = 0 - посылка
     //$wrapper = 1 - бандероль
     $wrapper = MODULE_SHIPPING_RUSSIANPOSTPREPAY_WRAPPER_STATUS == 'True' && $need_wr ? $this->is_wrapper($_SESSION['cart']->get_products()) : 0;
     if ($wrapper == 0 && MODULE_SHIPPING_RUSSIANPOSTPREPAY_PARCEL_STATUS != 'True') {
         return false;
     }
     $mode = $wrapper == 1 ? 'WRAPPER' : 'PARCEL';
     //высчитываем на сколько посылок/бандеролей нужно разбить заказ
     $need_parcel = 1;
     $maxweight = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . ($dest_zone < 20 ? $mode : 'INTER') . '_MAXWEIGHT');
     if ($shipping_weight > $maxweight) {
         $need_parcel = ceil($shipping_weight / $maxweight);
     }
     if ($dest_zone == 0) {
         $error = true;
         $err_msg = MODULE_SHIPPING_RUSSIANPOSTPREPAY_INVALID_ZONE;
     } else {
         //отправление по России
         if ($dest_zone < 20) {
             $shipping = -1;
             $zones_cost = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_STATES_PRICE_' . $mode . '_' . $dest_zone);
             $cost_table = preg_split("/[:,]/", $zones_cost);
             $shipping = $this->price($cost_table, $shipping_weight, $need_parcel, $maxweight, constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . ($dest_zone < 20 ? $mode : 'INTER') . '_REG'));
             $shipping_method = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_WAY_' . $mode) . ' <nobr>(' . $order->delivery['state'] . ' - ' . $shipping_weight . ' ' . MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_UNITS . '</nobr> <nobr>[' . constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_NEED') . $this->om_number($need_parcel, array(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_1'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_2'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_5'))) . ']</nobr>)';
         } else {
             $shipping = -1;
             $zones_cost = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_COUNTRY_PRICE_' . ($dest_zone == '21' ? 1 : 2));
             $cost_table = preg_split("/[:,]/", $zones_cost);
             $shipping = $this->price($cost_table, $shipping_weight, $need_parcel, $maxweight, constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . ($dest_zone < 20 ? $mode : 'INTER') . '_REG'));
             $shipping_method = constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_WAY_COUNTRY') . ' <nobr>(' . $order->delivery['country']['title'] . ' - ' . $shipping_weight . ' ' . MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_UNITS . '</nobr> <nobr>[' . constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_NEED') . $this->om_number($need_parcel, array(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_1'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_2'), constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_5'))) . ']</nobr>)';
         }
         if ($shipping == 0) {
             $shipping = -1;
         }
         if ($shipping == -1) {
             $error = true;
             $err_msg = MODULE_SHIPPING_RUSSIANPOSTPREPAY_UNDEFINED_RATE;
         } else {
             /**** Формула подсчёта цены ****/
             //внутренние отправления
             if ($dest_zone < 20) {
                 /*-- Оценочная стоимость в настройках --*/
                 $appraisal = 0;
                 if (constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE') != 0) {
                     $appraisal = strpos(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE'), '%') === false ? constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE') : substr(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE'), 0, strpos(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE'), '%'));
                     $appraisal_proc = strpos(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE_PRICE'), '%') === false ? false : true;
                 }
                 $appraisal = intval($appraisal);
                 //оценочная стоимость
                 if ($appraisal > 0) {
                     //процент от суммы
                     if ($appraisal_proc) {
                         $appraisal_price = ($shipping + $_SESSION['cart']->show_total() / 100) * $appraisal;
                     } else {
                         $appraisal_price = $appraisal;
                     }
                 } else {
                     //доставка + сумма заказа
                     $appraisal_price = $shipping + $_SESSION['cart']->show_total();
                 }
                 //высчитываем страховую стоимость
                 $insurance_price = $this->insurance($appraisal_price, intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_INSURANCE')));
                 //итоговая стоимость доставки = доставка + плата за сбор посылки + страховой процент
                 $shipping_cost = $shipping + $insurance_price;
                 //БЕСПЛАТНАЯ ДОСТАВКА
                 if (intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_FREE')) > 0) {
                     if ($_SESSION['cart']->show_total() >= intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_' . $mode . '_FREE'))) {
                         $shipping_cost = 0;
                     }
                 }
             } else {
                 //итоговая стоимость доставки = доставка + плата за сбор посылки
                 $shipping_cost = $shipping;
                 //БЕСПЛАТНАЯ ДОСТАВКА
                 if (intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_FREE')) > 0) {
                     if ($_SESSION['cart']->show_total() >= intval(constant('MODULE_SHIPPING_RUSSIANPOSTPREPAY_INTER_FREE'))) {
                         $shipping_cost = 0;
                     }
                 }
             }
         }
     }
     $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_RUSSIANPOSTPREPAY_TEXT_TITLE_PREPAY, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => ceil($shipping_cost))));
     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'] = $err_msg;
     }
     return $this->quotes;
 }
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:101,代码来源:russianpostprepay.php


注:本文中的vam_get_tax_rate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。