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


PHP shipping::quote方法代码示例

本文整理汇总了PHP中shipping::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP shipping::quote方法的具体用法?PHP shipping::quote怎么用?PHP shipping::quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shipping的用法示例。


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

示例1: setShippingMethod

 /**
  * Determine the appropriate shipping method if applicable
  * By default, selects the lowest-cost quote
  */
 function setShippingMethod()
 {
     global $total_count, $total_weight;
     // ensure that cart contents is calculated properly for weight and value
     if (!isset($total_weight)) {
         $total_weight = $_SESSION['cart']->show_weight();
     }
     if (!isset($total_count)) {
         $total_count = $_SESSION['cart']->count_contents();
     }
     // set the shipping method if one is not already set
     // defaults to the cheapest shipping method
     if (!$_SESSION['shipping'] || $_SESSION['shipping'] && $_SESSION['shipping'] == false && zen_count_shipping_modules() > 1) {
         require_once DIR_WS_CLASSES . 'http_client.php';
         require_once DIR_WS_CLASSES . 'shipping.php';
         $shipping_Obj = new shipping();
         // generate the quotes
         $shipping_Obj->quote();
         // set the cheapest one
         $_SESSION['shipping'] = $shipping_Obj->cheapest();
     }
 }
开发者ID:BGCX067,项目名称:ez-commerce-svn-to-git,代码行数:26,代码来源:paypalwpp.php

示例2: list

    }
} else {
    $free_shipping = false;
}
// process the selected shipping method
if (isset($_POST['action']) && $_POST['action'] == 'process') {
    if (xtc_count_shipping_modules() > 0 || $free_shipping == true) {
        if (isset($_POST['shipping']) && strpos($_POST['shipping'], '_')) {
            $_SESSION['shipping'] = $_POST['shipping'];
            list($module, $method) = explode('_', $_SESSION['shipping']);
            if (is_object(${$module}) || $_SESSION['shipping'] == 'free_free') {
                if ($_SESSION['shipping'] == 'free_free') {
                    $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
                    $quote[0]['methods'][0]['cost'] = '0';
                } else {
                    $quote = $shipping_modules->quote($method, $module);
                }
                if (isset($quote['error'])) {
                    unset($_SESSION['shipping']);
                } else {
                    if (isset($quote[0]['methods'][0]['title']) && isset($quote[0]['methods'][0]['cost'])) {
                        $_SESSION['shipping'] = array('id' => $_SESSION['shipping'], 'title' => $free_shipping == true ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')', 'cost' => $quote[0]['methods'][0]['cost']);
                        xtc_redirect(xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL'));
                    }
                }
            } else {
                unset($_SESSION['shipping']);
            }
        }
    } else {
        $_SESSION['shipping'] = false;
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:31,代码来源:paypal_checkout.php

示例3: shipping

// Load the selected shipping module(needed to calculate tax correctly)
require DIR_WS_CLASSES . 'shipping.php';
$shipping_modules = new shipping();
require DIR_WS_CLASSES . 'order_total.php';
$order_total_modules = new order_total();
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
//4px
//require(DIR_WS_CLASSES . 'DSFShipping.php');
// $objDSFShipping = new DSFShipping();
//  $country_info = zen_get_countries($order->delivery['country_id'], true);
//var_dump($country_info, $total_weight);
//$dsf_shippings = $objDSFShipping->calculate($country_info['countries_iso_code_2'], $total_weight);
//4px end
// get all available shipping quotes
$quotes = $shipping_modules->quote();
//4px shipping
//$quotes = array_merge($dsf_shippings, $quotes);
//end 4px shipping
//  $_SESSION['comments'] = '';
$comments = $_SESSION['comments'];
if (!empty($quotes)) {
    $_SESSION['shipping_list'] = $quotes;
}
if (empty($_SESSION['sendto']) && !empty($_SESSION['billto'])) {
    $_SESSION['sendto'] = $_SESSION['billto'];
}
// load all enabled payment modules
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment();
$flagOnSubmit = sizeof($payment_modules->selection());
开发者ID:dalinhuang,项目名称:cameras,代码行数:31,代码来源:header_php.php

示例4: array

         // first timer
         $_SESSION['cart_country_id'] = STORE_COUNTRY;
         $_SESSION['country_info'] = zen_get_countries(STORE_COUNTRY, true);
         $country_info = $_SESSION['country_info'];
         $order->delivery = array('country' => array('id' => STORE_COUNTRY, 'title' => $country_info['countries_name'], 'iso_code_2' => $country_info['countries_iso_code_2'], 'iso_code_3' => $country_info['countries_iso_code_3']), 'country_id' => STORE_COUNTRY, 'zone_id' => $state_zone_id, 'format_id' => zen_get_address_format_id($_POST['zone_country_id']));
     }
     // set the cost to be able to calculate free shipping
     $order->info = array('total' => $_SESSION['cart']->show_total(), 'currency' => $currency, 'currency_value' => $currencies->currencies[$currency]['value']);
 }
 // weight and count needed for shipping !
 $total_weight = $_SESSION['cart']->show_weight();
 $shipping_estimator_display_weight = $total_weight;
 $total_count = $_SESSION['cart']->count_contents();
 require DIR_WS_CLASSES . 'shipping.php';
 $shipping_modules = new shipping();
 $quotes = $shipping_modules->quote();
 // print_r($quotes);
 // die('here');
 $order->info['subtotal'] = $_SESSION['cart']->show_total();
 // set selections for displaying
 $selected_country = $order->delivery['country']['id'];
 $selected_address = $sendto;
 // }
 // eo shipping cost
 // check free shipping based on order $total
 if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
     switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
         case 'national':
             if ($order->delivery['country_id'] == STORE_COUNTRY) {
                 $pass = true;
             }
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:31,代码来源:shipping_estimator.php

示例5: intval

    if (isset($_POST['campaign_id']) && is_numeric($_POST['campaign_id'])) {
        $_SESSION['campaigns_id'] = intval($_POST['campaign_id']);
    }

    if ( (oos_count_shipping_modules() > 0) || ($free_shipping == true) ) {
        if ( (isset($_POST['shipping'])) && (strpos($_POST['shipping'], '_')) ) {
            $_SESSION['shipping'] = $_POST['shipping'];

            list($module, $method) = explode('_', $_SESSION['shipping']);
            if ( is_object($$module) || ($_SESSION['shipping'] == 'free_free') ) {
                if ($_SESSION['shipping'] == 'free_free') {
                    $quote[0]['methods'][0]['title'] = $aLang['free_shipping_title'];
                    $quote[0]['methods'][0]['cost'] = '0';
                } else {
                    $quote = $oShippingModules->quote($method, $module);
                }

                if (isset($quote['error'])) {
                   unset($_SESSION['shipping']);
                } else {
                    if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
                        $_SESSION['shipping'] = array('id' => $_SESSION['shipping'],
                                                      'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
                                                      'cost' => $quote[0]['methods'][0]['cost']);

                        MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
                    }
                }
            } else {
                unset($_SESSION['shipping']);
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:30,代码来源:checkout_shipping.php

示例6: process_merchant_calculation_callback_single

/**
 * Process a <merchant-calculation-callback>.
 */
function process_merchant_calculation_callback_single($google_response)
{
    global $google_checkout, $order, $cart, $total_weight, $total_count;
    list($root, $gc_data) = $google_response->GetParsedXML();
    $currencies = new currencies();
    // Get a hash array with the description of each shipping method
    $shipping_methods = $google_checkout->getMethods();
    require DIR_WS_CLASSES . 'order.php';
    $order = new order();
    $items = gc_get_arr_result($gc_data[$root]['shopping-cart']['items']['item']);
    // Get Coustoms OT
    $custom_order_totals_total = 0;
    $custom_order_totals = array();
    $order->products = array();
    foreach ($items as $item) {
        if (isset($item['merchant-private-item-data']['item']['VALUE'])) {
            $order->products[] = unserialize(base64_decode($item['merchant-private-item-data']['item']['VALUE']));
        } else {
            if ($item['merchant-private-item-data']['order_total']['VALUE']) {
                $ot = unserialize(base64_decode($item['merchant-private-item-data']['order_total']['VALUE']));
                $custom_order_totals[] = $ot;
                $order_total_value = $ot['value'] * (strrpos($ot['text'], '-') === false ? 1 : -1);
                $custom_order_totals_total += $currencies->get_value($gc_data[$root]['order-total']['currency']) * $order_total_value;
            } else {
                // For invoices.
                $order->products[] = array('qty' => $item['quantity']['VALUE'], 'name' => $item['item-name']['VALUE'], 'model' => $item['item-description']['VALUE'], 'tax' => 0, 'tax_description' => @$item['tax-table-selector']['VALUE'], 'price' => $item['unit-price']['VALUE'], 'final_price' => $item['unit-price']['VALUE'], 'onetime_charges' => 0, 'weight' => 0, 'products_priced_by_attribute' => 0, 'product_is_free' => 0, 'products_discount_type' => 0, 'products_discount_type_from' => 0, 'id' => @$item['merchant-item-id']['VALUE']);
            }
        }
    }
    $ex_cart = $cart;
    $cart = new shoppingCart();
    $prod_attr = gc_get_prattr($order->products);
    foreach ($prod_attr as $product_id => $item_data) {
        //$products_id, $qty = '1', $attributes = '
        $cart->add_cart($product_id, $item_data['qty'], $item_data['attr']);
    }
    // Register a random ID in the session to check throughout the checkout procedure
    // against alterations in the shopping cart contents.
    // TODO(eddavisson): Why is this commented out?
    //if (!tep_session_is_registered('cartID')) {
    //  tep_session_register('cartID');
    //}
    //$cartID = $cart->cartID;
    $total_weight = $cart->show_weight();
    $total_count = $cart->count_contents();
    // Create the results and send it
    $merchant_calc = new GoogleMerchantCalculations(DEFAULT_CURRENCY);
    // Loop through the list of address ids from the callback.
    $addresses = gc_get_arr_result($gc_data[$root]['calculate']['addresses']['anonymous-address']);
    // Get all the enabled shipping methods.
    require_once DIR_WS_CLASSES . 'shipping.php';
    // Required for some shipping methods (ie. USPS).
    require_once 'includes/classes/http_client.php';
    foreach ($addresses as $curr_address) {
        // Set up the order address.
        $curr_id = $curr_address['id'];
        $country = $curr_address['country-code']['VALUE'];
        $city = $curr_address['city']['VALUE'];
        $region = $curr_address['region']['VALUE'];
        $postal_code = $curr_address['postal-code']['VALUE'];
        $row = tep_db_fetch_array(tep_db_query("select * from " . TABLE_COUNTRIES . " where countries_iso_code_2 = '" . gc_make_sql_string($country) . "'"));
        $order->delivery['country'] = array('id' => $row['countries_id'], 'title' => $row['countries_name'], 'iso_code_2' => $country, 'iso_code_3' => $row['countries_iso_code_3']);
        $order->delivery['country_id'] = $row['countries_id'];
        $order->delivery['format_id'] = $row['address_format_id'];
        $row = tep_db_fetch_array(tep_db_query("select * from " . TABLE_ZONES . " where zone_code = '" . gc_make_sql_string($region) . "'"));
        $order->delivery['zone_id'] = $row['zone_id'];
        $order->delivery['state'] = $row['zone_name'];
        $order->delivery['city'] = $city;
        $order->delivery['postcode'] = $postal_code;
        //print_r($order);
        $shipping_modules = new shipping();
        // Loop through each shipping method if merchant-calculated shipping
        // support is to be provided
        //print_r($gc_data[$root]['calculate']['shipping']['method']);
        if (isset($gc_data[$root]['calculate']['shipping'])) {
            $shipping = gc_get_arr_result($gc_data[$root]['calculate']['shipping']['method']);
            // TODO(eddavisson): If we reactivate this, need to move to new configuration system.
            if (MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET == 'True') {
                // Single.
                // Get all the enabled shipping methods.
                $name = $shipping[0]['name'];
                // Compute the price for this shipping method and address id
                list($a, $method_name) = explode(': ', $name);
                if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY && $shipping_methods[$method_name][1] == 'domestic_types' || $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY && $shipping_methods[$method_name][1] == 'international_types') {
                    // Reset the shipping class to set the new address
                    if (class_exists($shipping_methods[$method_name][2])) {
                        $GLOBALS[$shipping_methods[$method_name][2]] = new $shipping_methods[$method_name][2]();
                    }
                }
                $quotes = $shipping_modules->quote('', $shipping_methods[$method_name][2]);
            } else {
                // Standard
                foreach ($shipping as $curr_ship) {
                    $name = $curr_ship['name'];
                    // Compute the price for this shipping method and address id
                    list($a, $method_name) = explode(': ', $name);
                    if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY && $shipping_methods[$method_name][1] == 'domestic_types' || $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY && $shipping_methods[$method_name][1] == 'international_types') {
//.........这里部分代码省略.........
开发者ID:digideskio,项目名称:oscmax2,代码行数:101,代码来源:responsehandler.php

示例7: count

 function osC_Checkout_Shipping()
 {
     global $osC_Database, $osC_Session, $osC_Customer, $osC_Services, $breadcrumb, $order, $cart, $total_weight, $total_count, $shipping_modules, $pass, $free_shipping, $quotes;
     if ($cart->count_contents() < 1) {
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, '', 'SSL'));
     }
     if ($osC_Services->isStarted('breadcrumb')) {
         $breadcrumb->add(NAVBAR_TITLE_CHECKOUT_SHIPPING, tep_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL'));
     }
     if ($osC_Customer->hasDefaultAddress() === false) {
         $this->page_contents = 'checkout_shipping_address.php';
     }
     // if no shipping destination address was selected, use the customers own address as default
     if ($osC_Session->exists('sendto') == false) {
         $osC_Session->set('sendto', $osC_Customer->default_address_id);
     } else {
         // verify the selected shipping address
         $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id');
         $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
         $Qcheck->bindInt(':customers_id', $osC_Customer->id);
         $Qcheck->bindInt(':address_book_id', $osC_Session->value('sendto'));
         $Qcheck->execute();
         if ($Qcheck->valueInt('total') != 1) {
             $osC_Session->set('sendto', $osC_Customer->default_address_id);
             $osC_Session->remove('shipping');
         }
     }
     $order = new order();
     // register a random ID in the session to check throughout the checkout procedure
     // against alterations in the shopping cart contents
     $osC_Session->set('cartID', $cart->cartID);
     // if the order contains only virtual products, forward the customer to the billing page as
     // a shipping address is not needed
     if ($order->content_type == 'virtual') {
         $false = false;
         $osC_Session->set('shipping', $false);
         $osC_Session->set('sendto', $false);
         tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'payment', 'SSL'));
     }
     $total_weight = $cart->show_weight();
     $total_count = $cart->count_contents();
     // load all enabled shipping modules
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping();
     if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
         $pass = false;
         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;
         }
         $free_shipping = false;
         if ($pass == true && $order->info['total'] - $order->info['shipping_cost'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
             $free_shipping = true;
             include DIR_WS_LANGUAGES . $osC_Session->value('language') . '/modules/order_total/ot_shipping.php';
         }
     } else {
         $free_shipping = false;
     }
     // get all available shipping quotes
     $quotes = $shipping_modules->quote();
     // if no shipping method has been selected, automatically select the cheapest method.
     // if the modules status was changed when none were available, to save on implementing
     // a javascript force-selection method, also automatically select the cheapest shipping
     // method if more than one module is now enabled
     if ($osC_Session->exists('shipping') == false || $osC_Session->exists('shipping') && $osC_Session->value('shipping') == false && tep_count_shipping_modules() > 1) {
         $osC_Session->set('shipping', $shipping_modules->cheapest());
     }
     if ($_GET[$this->_module] == 'process') {
         $this->_process();
     }
 }
开发者ID:itnovator,项目名称:oscommerce_cvs,代码行数:82,代码来源:shipping.php

示例8: array

// Required for some shipping methods (ie. USPS).
require_once 'includes/classes/http_client.php';
// Set up the order address.
$country = 'US';
$city = 'Miami';
$region = 'FL';
$postal_code = '33102';
$row = tep_db_fetch_array(tep_db_query("select * from " . TABLE_COUNTRIES . " where countries_iso_code_2 = '" . $country . "'"));
$order->delivery['country'] = array('id' => $row['countries_id'], 'title' => $row['countries_name'], 'iso_code_2' => $country, 'iso_code_3' => $row['countries_iso_code_3']);
$order->delivery['country_id'] = $row['countries_id'];
$order->delivery['format_id'] = $row['address_format_id'];
$row = tep_db_fetch_array(tep_db_query("select * from " . TABLE_ZONES . " where zone_code = '" . $region . "'"));
$order->delivery['zone_id'] = $row['zone_id'];
$order->delivery['state'] = $row['zone_name'];
$order->delivery['city'] = $city;
$order->delivery['postcode'] = $postal_code;
$shipping_modules = new shipping();
foreach ($shippers as $shipper) {
    list($start_m, $start_s) = explode(' ', microtime());
    $start = $start_m + $start_s;
    $quotes = $shipping_modules->quote('', $shipper);
    list($end_m, $end_s) = explode(' ', microtime());
    $end = $end_m + $end_s;
    echo $shipper . " took " . number_format($end - $start, 5) . " Secs\n";
}
list($start_m, $start_s) = explode(' ', microtime());
$start = $start_m + $start_s;
$quotes = $shipping_modules->quote();
list($end_m, $end_s) = explode(' ', microtime());
$end = $end_m + $end_s;
echo "All quotes took " . number_format($end - $start, 5) . " Secs\n";
开发者ID:digideskio,项目名称:oscmax2,代码行数:31,代码来源:shipping_metrics_commandline.php

示例9: process_merchant_calculation_callback_single

function process_merchant_calculation_callback_single($Gresponse)
{
    global $googlepayment, $order, $db, $total_weight, $total_count;
    list($root, $data) = $Gresponse->GetParsedXML();
    $currencies = new currencies();
    $cart = $_SESSION['cart'];
    $methods_hash = $googlepayment->getMethods();
    require DIR_WS_CLASSES . 'order.php';
    $order = new order();
    // Register a random ID in the session to check throughout the checkout procedure
    // against alterations in the shopping cart contents.
    //  if (!tep_session_is_registered('cartID')) {
    //  tep_session_register('cartID');
    // }
    //  $cartID = $cart->cartID;
    $items = get_arr_result($data[$root]['shopping-cart']['items']['item']);
    $products = array();
    foreach ($items as $item) {
        if (isset($item['merchant-private-item-data']['item']['VALUE'])) {
            $products[] = unserialize(base64_decode($item['merchant-private-item-data']['item']['VALUE']));
        }
    }
    $order->products = $products;
    $total_weight = $cart->show_weight();
    $total_count = $cart->count_contents();
    // Create the results and send it
    $merchant_calc = new GoogleMerchantCalculations(DEFAULT_CURRENCY);
    // Loop through the list of address ids from the callback.
    $addresses = get_arr_result($data[$root]['calculate']['addresses']['anonymous-address']);
    // Get all the enabled shipping methods.
    require DIR_WS_CLASSES . 'shipping.php';
    // Required for some shipping methods (ie. USPS).
    require_once 'includes/classes/http_client.php';
    foreach ($addresses as $curr_address) {
        // Set up the order address.
        $curr_id = $curr_address['id'];
        $country = $curr_address['country-code']['VALUE'];
        $city = $curr_address['city']['VALUE'];
        $region = $curr_address['region']['VALUE'];
        $postal_code = $curr_address['postal-code']['VALUE'];
        $countr_query = $db->Execute("select * \n                     from " . TABLE_COUNTRIES . " \n                     where countries_iso_code_2 = '" . makeSqlString($country) . "'");
        $row = $countr_query->fields;
        $order->delivery['country'] = array('id' => $row['countries_id'], 'title' => $row['countries_name'], 'iso_code_2' => $country, 'iso_code_3' => $row['countries_iso_code_3']);
        $order->delivery['country_id'] = $row['countries_id'];
        $order->delivery['format_id'] = $row['address_format_id'];
        $zone_query = $db->Execute("select * \n        \t\t                               from " . TABLE_ZONES . "\n        \t\t                               where zone_code = '" . makeSqlString($region) . "'");
        $row = $zone_query->fields;
        $order->delivery['zone_id'] = $row['zone_id'];
        $order->delivery['state'] = $row['zone_name'];
        $order->delivery['city'] = $city;
        $order->delivery['postcode'] = $postal_code;
        $shipping_modules = new shipping();
        // Loop through each shipping method if merchant-calculated shipping
        // support is to be provided
        //print_r($data[$root]['calculate']['shipping']['method']);
        if (isset($data[$root]['calculate']['shipping']['method'])) {
            $shipping = get_arr_result($data[$root]['calculate']['shipping']['method']);
            //      if (MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET == 'True') {
            //        // Single
            //        // i get all the enabled shipping methods
            //        $name = $shipping[0]['name'];
            //        //            Compute the price for this shipping method and address id
            //        list ($a, $method_name) = explode(': ', $name);
            //        if ((($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY)
            //              && ($methods_hash[$method_name][1] == 'domestic_types'))
            //           || (($order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY)
            //              && ($methods_hash[$method_name][1] == 'international_types'))) {
            //          //								reset the shipping class to set the new address
            //          if (class_exists($methods_hash[$method_name][2])) {
            //            $GLOBALS[$methods_hash[$method_name][2]] = new $methods_hash[$method_name][2];
            //          }
            //        }
            //        $quotes = $shipping_modules->quote('', $methods_hash[$method_name][2]);
            //      } else {
            // Standard
            foreach ($shipping as $curr_ship) {
                $name = $curr_ship['name'];
                //            Compute the price for this shipping method and address id
                list($a, $method_name) = explode(': ', $name, 2);
                if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY && $methods_hash[$method_name][1] == 'domestic_types' || $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY && $methods_hash[$method_name][1] == 'international_types') {
                    //								reset the shipping class to set the new address
                    if (class_exists($methods_hash[$method_name][2])) {
                        $GLOBALS[$methods_hash[$method_name][2]] = new $methods_hash[$method_name][2]();
                    }
                }
            }
            $quotes = $shipping_modules->quote();
            //      }
            reset($shipping);
            foreach ($shipping as $curr_ship) {
                $name = $curr_ship['name'];
                //            Compute the price for this shipping method and address id
                list($a, $method_name) = explode(': ', $name, 2);
                unset($quote_povider);
                unset($quote_method);
                if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY && $methods_hash[$method_name][1] == 'domestic_types' || $order->delivery['country']['id'] != SHIPPING_ORIGIN_COUNTRY && $methods_hash[$method_name][1] == 'international_types') {
                    foreach ($quotes as $key_provider => $shipping_provider) {
                        // privider name (class)
                        if ($shipping_provider['id'] == $methods_hash[$method_name][2]) {
                            // method name
//.........这里部分代码省略.........
开发者ID:happyxlq,项目名称:lt_svn,代码行数:101,代码来源:responsehandler.php

示例10: array

}
$_SESSION['delivery_zone'] = $order->delivery['country']['iso_code_2'];
//suppot downloads and gifts
if ($order->content_type == 'virtual' || $order->content_type == 'virtual_weight' || $_SESSION['cart']->count_contents_virtual() == 0) {
    $shipping_content = array();
    $shipping_content[] = array('NAME' => _SHIPPING_FREE);
} else {
    require DIR_WS_CLASSES . 'shipping.php';
    $shipping = new shipping();
    $free_shipping = $free_shipping_freeamount = $has_freeamount = false;
    require DIR_WS_MODULES . 'order_total/ot_shipping.php';
    include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/ot_shipping.php';
    $ot_shipping = new ot_shipping();
    $ot_shipping->process();
    // load all enabled shipping modules
    $quotes = $shipping->quote();
    foreach ($quotes as $quote) {
        if ($quote['id'] == 'freeamount') {
            $has_freeamount = true;
            if (isset($quote['methods'])) {
                $free_shipping_freeamount = true;
                break;
            }
        }
    }
    $shipping_content = array();
    if ($free_shipping == true) {
        $shipping_content[] = array('NAME' => FREE_SHIPPING_TITLE, 'VALUE' => $xtPrice->xtcFormat(0, true, 0, true));
    } else {
        if ($free_shipping_freeamount) {
            $shipping_content[] = array('NAME' => $quote['module'] . ' - ' . $quote['methods'][0]['title'], 'VALUE' => $xtPrice->xtcFormat(0, true, 0, true));
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:31,代码来源:shipping_estimate.php

示例11: confirmation

 function confirmation()
 {
     global $order, $smarty, $xtPrice, $main, $messageStack, $total_weight, $total_count, $free_shipping;
     if (isset($_GET['conditions_message'])) {
         $message_condition = str_replace('\\n', '', ERROR_CONDITIONS_NOT_ACCEPTED);
         $message_address = str_replace('\\n', '', ERROR_ADDRESS_NOT_ACCEPTED);
         switch ($_GET['conditions_message']) {
             case "1":
                 $messageStack->add('checkout_confirmation', $message_condition);
                 break;
             case "13":
                 $messageStack->add('checkout_confirmation', $message_condition);
                 $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD);
                 break;
             case "2":
                 $messageStack->add('checkout_confirmation', $message_address);
                 break;
             case "23":
                 $messageStack->add('checkout_confirmation', $message_address);
                 $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD);
                 break;
             case "12":
                 $messageStack->add('checkout_confirmation', $message_condition);
                 $messageStack->add('checkout_confirmation', $message_address);
                 break;
             case "123":
                 $messageStack->add('checkout_confirmation', $message_condition);
                 $messageStack->add('checkout_confirmation', $message_address);
                 $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD);
                 break;
             case "3":
                 $messageStack->add('checkout_confirmation', ERROR_CHECKOUT_SHIPPING_NO_METHOD);
                 break;
         }
     }
     if ($order->delivery['country']['iso_code_2'] != '') {
         $_SESSION['delivery_zone'] = $order->delivery['country']['iso_code_2'];
     }
     $no_shipping = false;
     if ($order->content_type == 'virtual' || $order->content_type == 'virtual_weight' || $_SESSION['cart']->count_contents_virtual() == 0) {
         $no_shipping = true;
     }
     $total_weight = $_SESSION['cart']->show_weight();
     $total_count = $_SESSION['cart']->count_contents();
     // load all enabled shipping modules
     $shipping_modules = new shipping();
     // add unallowed payment / shipping
     if (defined('MODULE_EXCLUDE_PAYMENT_STATUS') && MODULE_EXCLUDE_PAYMENT_STATUS == 'True') {
         for ($i = 1; $i <= MODULE_EXCLUDE_PAYMENT_NUMBER; $i++) {
             $payment_exclude = explode(',', constant('MODULE_EXCLUDE_PAYMENT_PAYMENT_' . $i));
             if (in_array($this->code, $payment_exclude)) {
                 $shipping_exclude = explode(',', constant('MODULE_EXCLUDE_PAYMENT_SHIPPING_' . $i));
                 for ($i = 0, $n = count($shipping_modules->modules); $i < $n; $i++) {
                     if (in_array(substr($shipping_modules->modules[$i], 0, -4), $shipping_exclude)) {
                         unset($shipping_modules->modules[$i]);
                     }
                 }
             }
         }
     }
     $free_shipping = false;
     $ot_shipping = new ot_shipping();
     $ot_shipping->process();
     if ($no_shipping === true) {
         $_SESSION['shipping'] = false;
     }
     // get all available shipping quotes
     $quotes = $shipping_modules->quote();
     // if no shipping method has been selected, automatically select the cheapest method.
     // if the modules status was changed when none were available, to save on implementing
     // a javascript force-selection method, also automatically select the cheapest shipping
     // method if more than one module is now enabled
     if (!isset($_SESSION['shipping']) && CHECK_CHEAPEST_SHIPPING_MODUL == 'true' || isset($_SESSION['shipping']) && $_SESSION['shipping'] == false && xtc_count_shipping_modules() > 1) {
         $_SESSION['shipping'] = $shipping_modules->cheapest();
     }
     if ($no_shipping === true) {
         $_SESSION['shipping'] = false;
     }
     if (defined('SHOW_SELFPICKUP_FREE') && SHOW_SELFPICKUP_FREE == 'true') {
         if ($free_shipping == true) {
             $free_shipping = false;
             $quotes = array_merge($ot_shipping->quote(), $shipping_modules->quote('selfpickup', 'selfpickup'));
         }
     }
     $module_smarty = new Smarty();
     $shipping_block = '';
     if (xtc_count_shipping_modules() > 0) {
         $showtax = $_SESSION['customers_status']['customers_status_show_price_tax'];
         $module_smarty->assign('FREE_SHIPPING', $free_shipping);
         # free shipping or not...
         if ($free_shipping == true) {
             $module_smarty->assign('FREE_SHIPPING_TITLE', FREE_SHIPPING_TITLE);
             $module_smarty->assign('FREE_SHIPPING_DESCRIPTION', sprintf(FREE_SHIPPING_DESCRIPTION, $xtPrice->xtcFormat($free_shipping_value_over, true, 0, true)) . xtc_draw_hidden_field('shipping', 'free_free'));
             $module_smarty->assign('FREE_SHIPPING_ICON', $quotes[$i]['icon']);
         } else {
             $radio_buttons = 0;
             #loop through installed shipping methods...
             for ($i = 0, $n = sizeof($quotes); $i < $n; $i++) {
                 if (!isset($quotes[$i]['error'])) {
                     for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j++) {
//.........这里部分代码省略.........
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:101,代码来源:paypalcart.php

示例12: mod_calculate_shipping_cost

function mod_calculate_shipping_cost($products_id, $products_price)
{
    // set globals
    global $xtPrice, $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes, $em_shipping_countries;
    // init shipping content array
    $shipping_content = array();
    foreach ($em_shipping_countries as $country) {
        // init order class for dummy order
        $order = new order();
        //Data for shipping cost
        $default_data_query_raw = "SELECT countries_id,\n\t\t\t\t\t\t\t\t\t\tcountries_name,\n\t\t\t\t\t\t\t\t\t\tcountries_iso_code_2,\n\t\t\t\t\t\t\t\t\t\tcountries_iso_code_3,\n\t\t\t\t\t\t\t\t\t\taddress_format_id\n\t\t\t\t\t\t\t\t   FROM " . TABLE_COUNTRIES . "\n\t\t\t\t\t\t\t\t  WHERE countries_iso_code_2 = '" . strtoupper(trim($country)) . "'";
        $default_data_query = xtc_db_query($default_data_query_raw);
        $default_data = xtc_db_fetch_array($default_data_query);
        $default_data['entry_postcode'] = '10000';
        $default_data['zone_name'] = '';
        $default_data['zone_id'] = '';
        // set customer data
        $order->customer = array('postcode' => $default_data['entry_postcode'], 'state' => $default_data['zone_name'], 'zone_id' => $default_data['zone_id'], 'format_id' => $default_data['address_format_id'], 'country' => array('id' => $default_data['countries_id'], 'title' => $default_data['countries_name'], 'iso_code_2' => $default_data['countries_iso_code_2'], 'iso_code_3' => $default_data['countries_iso_code_3']));
        // set delivery data
        $order->delivery = array('postcode' => $default_data['entry_postcode'], 'state' => $default_data['zone_name'], 'zone_id' => $default_data['zone_id'], 'format_id' => $default_data['address_format_id'], 'country' => array('id' => $default_data['countries_id'], 'title' => $default_data['countries_name'], 'iso_code_2' => $default_data['countries_iso_code_2'], 'iso_code_3' => $default_data['countries_iso_code_3']));
        $GLOBALS['order'] = $order;
        // set session for calculation shipping costs
        $_SESSION['delivery_zone'] = $order->delivery['country']['iso_code_2'];
        // init shipping class
        $shipping = new shipping();
        // init shipping modules
        $quotes = $shipping->quote();
        $free_shipping = false;
        if (defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && 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 && $products_price >= $xtPrice->xtcFormat(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER, false, 0, true)) {
                $free_shipping = true;
            }
        }
        $has_freeamount = false;
        $free_shipping_freeamount = false;
        foreach ($quotes as $quote) {
            if ($quote['id'] == 'freeamount') {
                $has_freeamount = true;
                if (isset($quote['methods'])) {
                    $free_shipping_freeamount = true;
                    break;
                }
            }
        }
        if ($free_shipping == true) {
            $shipping_content[] = array('country' => $order->delivery['country']['iso_code_2'], 'service' => mod_convert_string(FREE_SHIPPING_TITLE), 'price' => floatval(0));
        } elseif ($free_shipping_freeamount) {
            $shipping_content[] = array('country' => $order->delivery['country']['iso_code_2'], 'service' => mod_convert_string($quote['module']), 'price' => floatval(0));
        } else {
            foreach ($quotes as $quote) {
                if ($quote['id'] != 'freeamount') {
                    $quote['methods'][0]['cost'] = $xtPrice->xtcCalculateCurr($quote['methods'][0]['cost']);
                    $value = isset($quote['tax']) && $quote['tax'] > 0 ? $xtPrice->xtcAddTax($quote['methods'][0]['cost'], $quote['tax']) : (!empty($quote['methods'][0]['cost']) ? $quote['methods'][0]['cost'] : '0');
                    $value = $xtPrice->xtcFormat($value, false);
                    $shipping_content[] = array('country' => $order->delivery['country']['iso_code_2'], 'service' => mod_convert_string($quote['module'] . (!empty($quote['methods'][0]['title']) ? ' - ' . $quote['methods'][0]['title'] : '')), 'price' => floatval($value));
                }
            }
        }
        // unset used variables and objects
        unset($quotes);
        unset($shipping);
        unset($order);
        unset($_SESSION['delivery_zone']);
        unset($_SESSION['shipping']);
    }
    // return cheapest Shipping module
    return $shipping_content;
}
开发者ID:digitaldevelopers,项目名称:gambio,代码行数:86,代码来源:functions.php

示例13: array

         }
         // set the cost to be able to calvculate free shipping
         $order->info = array('total' => $cart->show_total());
         // TAX ????
     }
     // weight and count needed for shipping !
     $total_weight = $cart->show_weight();
     $total_count = $cart->count_contents();
     //require(DIR_WS_CLASSES . 'shipping.php');
     if (defined('MVS_STATUS') && MVS_STATUS == 'true') {
         include DIR_WS_CLASSES . 'vendor_shipping.php';
     } else {
         include DIR_WS_CLASSES . 'shipping.php';
     }
     $shipping_modules = new shipping();
     $quotes = $shipping_modules->quote();
     $cheapest = $shipping_modules->cheapest();
     // set selections for displaying
     //if (!isset($order->delivery['country'])) {
     //  $order->delivery['country'] = false;
     //}
     //if (!isset($order->delivery['postcode'])) {
     //  $order->delivery['postcode'] = false;
     //}
     $selected_country = $order->delivery['country']['id'];
     $selected_zip = $order->delivery['postcode'];
     if (isset($_SESSION['sendto'])) {
         $selected_address = $_SESSION['sendto'];
     }
 }
 // eo shipping cost
开发者ID:resultsonlyweb,项目名称:loaded6-template,代码行数:31,代码来源:shipping_estimator.php


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