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


PHP shipping类代码示例

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


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

示例1: onListRates

 function onListRates(&$d)
 {
     $shippinghelper = new shipping();
     $shippingrate = array();
     $rate = 0;
     $shipping = $shippinghelper->getShippingMethodByClass($this->classname);
     $shippingArr = $shippinghelper->getShopperGroupDefaultShipping();
     if (!empty($shippingArr)) {
         $shopper_shipping = $shippingArr['shipping_rate'];
         $shippingVatRate = $shippingArr['shipping_vat'];
         $default_shipping = JText::_('COM_REDSHOP_DEFAULT_SHOPPER_GROUP_SHIPPING');
         $shopper_shipping_id = $shippinghelper->encryptShipping(__CLASS__ . "|" . $shipping->name . "|" . $default_shipping . "|" . number_format($shopper_shipping, 2, '.', '') . "|" . $default_shipping . "|single|" . $shippingVatRate . "|0|1");
         $shippingrate[$rate]->text = $default_shipping;
         $shippingrate[$rate]->value = $shopper_shipping_id;
         $shippingrate[$rate]->rate = $shopper_shipping;
         $rate++;
     }
     $ratelist = $shippinghelper->listshippingrates($shipping->element, $d['users_info_id'], $d);
     for ($i = 0; $i < count($ratelist); $i++) {
         $rs = $ratelist[$i];
         $shippingRate = $rs->shipping_rate_value;
         $rs->shipping_rate_value = $shippinghelper->applyVatOnShippingRate($rs, $d['user_id']);
         $shippingVatRate = $rs->shipping_rate_value - $shippingRate;
         $economic_displaynumber = $rs->economic_displaynumber;
         $shipping_rate_id = $shippinghelper->encryptShipping(__CLASS__ . "|" . $shipping->name . "|" . $rs->shipping_rate_name . "|" . number_format($rs->shipping_rate_value, 2, '.', '') . "|" . $rs->shipping_rate_id . "|single|" . $shippingVatRate . '|' . $economic_displaynumber . '|' . $rs->deliver_type);
         $shippingrate[$rate] = new stdClass();
         $shippingrate[$rate]->text = $rs->shipping_rate_name;
         $shippingrate[$rate]->value = $shipping_rate_id;
         $shippingrate[$rate]->rate = $rs->shipping_rate_value;
         $shippingrate[$rate]->vat = $shippingVatRate;
         $rate++;
     }
     return $shippingrate;
 }
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: displayMoney

 function displayMoney($value)
 {
     $config = shipping::getConfig();
     if ($config['rightAlignCurency'] == '1') {
         $formatted = number_format($value, $config['decs'], $config['dsep'], $config['tsep']) . ' ' . $config['currency'];
     } else {
         $formatted = $config['currency'] . " " . number_format($value, $config['decs'], $config['dsep'], $config['tsep']);
     }
     return $formatted;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:10,代码来源:admin.shipping.html.php

示例3: display

 public function display($tpl = null)
 {
     $context = 'shipping_rate';
     $uri = JFactory::getURI();
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $shippinghelper = new shipping();
     $lists['order'] = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'shipping_rate_id');
     $lists['order_Dir'] = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $id = $app->getUserStateFromRequest($context . 'extension_id', 'extension_id', '0');
     if ((int) $id == 0) {
         JError::raiseError(500, "Direct Access not allowed, go to <a href='index.php?option=com_redshop&view=shipping'>" . JText::_('COM_REDSHOP_SHIPPING') . "</a>");
         return false;
     }
     $shipping = $shippinghelper->getShippingMethodById($id);
     $shipping_rates = $this->get('Data');
     $total = $this->get('Total');
     $pagination = $this->get('Pagination');
     $shippingpath = JPATH_ROOT . '/plugins/' . $shipping->folder . '/' . $shipping->element . '.xml';
     $myparams = new JRegistry($shipping->params, $shippingpath);
     $is_shipper = $myparams->get('is_shipper');
     $shipper_location = $myparams->get('shipper_location');
     $jtitle = $shipper_location ? JText::_('COM_REDSHOP_SHIPPING_LOCATION') : JText::_('COM_REDSHOP_SHIPPING_RATE');
     JToolBarHelper::title($jtitle . ' <small><small>[ ' . $shipping->name . ' ]</small></small>', 'redshop_shipping_rates48');
     JToolBarHelper::addNewX();
     JToolBarHelper::editListX();
     if ($is_shipper) {
         JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', JText::_('COM_REDSHOP_TOOLBAR_COPY'), true);
     }
     JToolBarHelper::deleteList();
     JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
     $this->lists = $lists;
     $this->shipping_rates = $shipping_rates;
     $this->shipping = $shipping;
     $this->pagination = $pagination;
     $this->is_shipper = $is_shipper;
     $this->shipper_location = $shipper_location;
     $this->request_url = $uri->toString();
     parent::display($tpl);
 }
开发者ID:,项目名称:,代码行数:40,代码来源:

示例4: tep_db_fetch_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

示例5: 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

示例6: unset

if (isset($_SESSION['cartID']) && $_SESSION['cartID'] != $_SESSION['cart']->cartID && isset($_SESSION['shipping'])) {
    unset($_SESSION['shipping']);
}
$_SESSION['cartID'] = $_SESSION['cart']->cartID = $_SESSION['cart']->generate_cart_id();
// 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') {
    $_SESSION['shipping'] = false;
    $_SESSION['sendto'] = false;
    OSCOM::redirect('checkout_payment.php', '', 'SSL');
}
$total_weight = $_SESSION['cart']->show_weight();
$total_count = $_SESSION['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;
开发者ID:Akofelaz,项目名称:oscommerce2,代码行数:31,代码来源:checkout_shipping.php

示例7: shipping

<?php

/**
 * @package     RedSHOP.Backend
 * @subpackage  Template
 *
 * @copyright   Copyright (C) 2005 - 2013 redCOMPONENT.com. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/shipping.php';
$shippinghelper = new shipping();
$option = JRequest::getVar('option');
$download = JRequest::getVar('download');
if ($download) {
    $oid = JRequest::getInt('oid');
    $baseURL = JURI::root();
    $name = 'label_' . $oid . '.pdf';
    $tmp_name = JPATH_COMPONENT_ADMINISTRATOR . '/assets/lables/' . $name;
    $tmp_type = strtolower(JFile::getExt($name));
    switch ($tmp_type) {
        case "pdf":
            $ctype = "application/pdf";
            break;
        default:
            $ctype = "application/force-download";
    }
    header("Pragma: public");
    header('Expires: 0');
    header("Content-Type: {$ctype}");
    header('Content-Length: ' . filesize($tmp_name));
    header('Content-Disposition: attachment; filename=' . basename($name));
开发者ID:,项目名称:,代码行数:31,代码来源:

示例8: array

    $order->delivery['country']['title'] = $delivery_zone['countries_name'];
    $order->delivery['country']['id'] = $delivery_zone['countries_id'];
    $order->delivery['country_id'] = $delivery_zone['countries_id'];
    $order->delivery['zone_id'] = 0;
}
if (!isset($order->info['total'])) {
    $order->info['total'] = $_SESSION['cart']->show_total();
}
$_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;
            }
        }
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:31,代码来源:shipping_estimate.php

示例9: replaceMessage

 public function replaceMessage($message, $orderData, $paymentName)
 {
     $shippinghelper = new shipping();
     $shipping_method = '';
     $details = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $orderData->ship_method_id)));
     if (count($details) > 1) {
         $ext = "";
         if (array_key_exists(2, $details)) {
             $ext = " (" . $details[2] . ")";
         }
         $shipping_method = $details[1] . $ext;
     }
     $producthelper = new producthelper();
     $userData = $producthelper->getUserInformation($orderData->user_id);
     $message = str_replace('{order_id}', $orderData->order_id, $message);
     $message = str_replace('{order_status}', $orderData->order_status, $message);
     $message = str_replace('{customer_name}', $userData->firstname, $message);
     $message = str_replace('{payment_status}', $orderData->order_payment_status, $message);
     $message = str_replace('{order_comment}', $orderData->customer_note, $message);
     $message = str_replace('{shipping_method}', $shipping_method, $message);
     $message = str_replace('{payment_method}', $paymentName, $message);
     return $message;
 }
开发者ID:,项目名称:,代码行数:23,代码来源:

示例10: store

 public function store($postdata)
 {
     $redshopMail = new redshopMail();
     $order_functions = new order_functions();
     $helper = new redhelper();
     $producthelper = new producthelper();
     $rsCarthelper = new rsCarthelper();
     $shippinghelper = new shipping();
     $adminproducthelper = new adminproducthelper();
     $stockroomhelper = new rsstockroomhelper();
     // For barcode generation
     $barcode_code = $order_functions->barcode_randon_number(12, 0);
     $postdata['barcode'] = $barcode_code;
     $row = $this->getTable('order_detail');
     if (!$row->bind($postdata)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $iscrm = $helper->isredCRM();
     if ($iscrm) {
         $postdata['order_id'] = $row->order_id;
         $postdata['debitor_id'] = $postdata['user_info_id'];
         JTable::addIncludePath(REDCRM_ADMIN . '/tables');
         $crmorder =& $this->getTable('crm_order');
         if (!$crmorder->bind($postdata)) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         if (!$crmorder->store()) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
         // Update rma table entry
         if (ENABLE_RMA && isset($postdata['rmanotes'])) {
             $rmaInfo = $this->getTable('rma_orders');
             $rmaInfo->rma_number = $postdata['rma_number'];
             $rmaInfo->original_order_id = $postdata['main_order_id'];
             $rmaInfo->credit_note_order_id = $row->order_id;
             $rmaInfo->rma_note = $postdata['rmanotes'];
             $rmaInfo->store();
         }
         JTable::addIncludePath(REDSHOP_ADMIN . '/tables');
     }
     $order_shipping = explode("|", $shippinghelper->decryptShipping(str_replace(" ", "+", $row->ship_method_id)));
     $rowOrderStatus =& $this->getTable('order_status_log');
     $rowOrderStatus->order_id = $row->order_id;
     $rowOrderStatus->order_status = $row->order_status;
     $rowOrderStatus->date_changed = time();
     $rowOrderStatus->customer_note = $row->customer_note;
     $rowOrderStatus->store();
     $billingaddresses = $order_functions->getBillingAddress($row->user_id);
     if (isset($postdata['billisship']) && $postdata['billisship'] == 1) {
         $shippingaddresses = $billingaddresses;
     } else {
         $key = 0;
         $shippingaddresses = $order_functions->getShippingAddress($row->user_id);
         $shipp_users_info_id = isset($postdata['shipp_users_info_id']) && $postdata['shipp_users_info_id'] != 0 ? $postdata['shipp_users_info_id'] : 0;
         if ($shipp_users_info_id != 0) {
             for ($o = 0; $o < count($shippingaddresses); $o++) {
                 if ($shippingaddresses[$o]->users_info_id == $shipp_users_info_id) {
                     $key = $o;
                     break;
                 }
             }
         }
         $shippingaddresses = $shippingaddresses[$key];
     }
     // ORDER DELIVERY TIME IS REMAINING
     $user_id = $row->user_id;
     $item = $postdata['order_item'];
     for ($i = 0; $i < count($item); $i++) {
         $product_id = $item[$i]->product_id;
         $quantity = $item[$i]->quantity;
         $product_excl_price = $item[$i]->prdexclprice;
         $product_price = $item[$i]->productprice;
         // Attribute price added
         $generateAttributeCart = $rsCarthelper->generateAttributeArray((array) $item[$i], $user_id);
         $retAttArr = $producthelper->makeAttributeCart($generateAttributeCart, $product_id, $user_id, 0, $quantity);
         $product_attribute = $retAttArr[0];
         // Accessory price
         $generateAccessoryCart = $rsCarthelper->generateAccessoryArray((array) $item[$i], $user_id);
         $retAccArr = $producthelper->makeAccessoryCart($generateAccessoryCart, $product_id, $user_id);
         $product_accessory = $retAccArr[0];
         $accessory_total_price = $retAccArr[1];
         $accessory_vat_price = $retAccArr[2];
         $wrapper_price = 0;
         $wrapper_vat = 0;
         if ($item[$i]->wrapper_data != 0 && $item[$i]->wrapper_data != '') {
             $wrapper = $producthelper->getWrapper($product_id, $item[$i]->wrapper_data);
             if (count($wrapper) > 0) {
                 if ($wrapper[0]->wrapper_price > 0) {
                     $wrapper_vat = $producthelper->getProducttax($product_id, $wrapper[0]->wrapper_price, $user_id);
                 }
                 $wrapper_price = $wrapper[0]->wrapper_price + $wrapper_vat;
             }
         }
//.........这里部分代码省略.........
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:101,代码来源:addorder_detail.php

示例11: smn_session_register

    if (!smn_session_is_registered('shipping')) {
        smn_session_register('shipping');
    }
    /*Unregister the session shipping_store,By Cimi*/
    if (!smn_session_is_registered('shipping_store')) {
        smn_session_register('shipping_store');
    }
    $shipping = false;
    $sendto = false;
    smn_redirect(smn_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'NONSSL'));
}
$total_weight = $cart->show_weight($store_id);
$total_count = $cart->count_contents($store_id);
// 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->get_store_country()) {
                $pass = true;
            }
            break;
        case 'international':
            if ($order->delivery['country_id'] != $store->get_store_country()) {
                $pass = true;
            }
            break;
        case 'both':
            $pass = true;
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:31,代码来源:checkout_shipping.php

示例12: gbasefeed

 public function gbasefeed($data)
 {
     $producthelper = new producthelper();
     $stockroomhelper = new rsstockroomhelper();
     $shippinghelper = new shipping();
     $unpublished_data = $data['unpublished_data'];
     $cid = $data['cid'];
     $url = JURI::root();
     $currency = new CurrencyHelper();
     $product_img_url = $url . 'components/com_redshop/assets/images/product/';
     $file_path = JPATH_COMPONENT_SITE . "/assets/document/gbase";
     $file_name = $file_path . "/product.xml";
     if (count($cid)) {
         $cids = implode(',', $cid);
         if ($unpublished_data == 1) {
             $query = "SELECT p.*,m.manufacturer_name FROM " . $this->_table_prefix . "product AS p " . " LEFT JOIN " . $this->_table_prefix . "manufacturer AS m" . " ON p.manufacturer_id = m.manufacturer_id" . " WHERE p.product_id IN (" . $cids . ")";
         } else {
             $query = "SELECT p.*,m.manufacturer_name FROM " . $this->_table_prefix . "product AS p " . " LEFT JOIN " . $this->_table_prefix . "manufacturer AS m" . " ON p.manufacturer_id = m.manufacturer_id" . " WHERE p.product_id IN (" . $cids . ") and p.published =1";
         }
         $this->_db->setQuery($query);
         $rs = $this->_db->loadObjectlist();
         // For shipping information
         $shippingArr = $shippinghelper->getShopperGroupDefaultShipping();
         $default_shipping = 0.0;
         $shipping_rate = $currency->convert(number_format($shippingArr['shipping_rate'], PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
         $default_shipping = count($shippingArr) > 0 ? $shipping_rate : number_format($default_shipping, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR);
         $default_shipping_country = DEFAULT_SHIPPING_COUNTRY;
         $xml_code = '<?xml version="1.0" encoding="UTF-8" ';
         $xml_code .= '<rss version ="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:c="http://base.google.com/cns/1.0">';
         $xml_code .= "<channel>";
         for ($i = 0; $i < count($rs); $i++) {
             // For additional images
             $additional_images = $producthelper->getAdditionMediaImage($rs[$i]->product_id, $section = "product", $mediaType = "images");
             $add_image = "";
             for ($ad = 0; $ad < 10; $ad++) {
                 if (trim($additional_images[$ad]->product_full_image) != trim($additional_images[$ad]->media_name) && trim($additional_images[$ad]->media_name) != "") {
                     $add_image .= "<g:additional_image_link>" . $product_img_url . htmlspecialchars($additional_images[$ad]->media_name, ENT_NOQUOTES, "UTF-8") . "</g:additional_image_link>";
                 }
             }
             // For getting product Category
             $category_name = $producthelper->getCategoryNameByProductId($rs[$i]->product_id);
             if (USE_STOCKROOM == 1) {
                 // For cunt attributes
                 $attributes_set = array();
                 if ($rs[$i]->attribute_set_id > 0) {
                     $attributes_set = $producthelper->getProductAttribute(0, $rs[$i]->attribute_set_id, 0, 1);
                 }
                 $attributes = $producthelper->getProductAttribute($rs[$i]->product_id);
                 $attributes = array_merge($attributes, $attributes_set);
                 $totalatt = count($attributes);
                 // Get stock details
                 $isStockExists = $stockroomhelper->isStockExists($rs[$i]->product_id);
                 if ($totalatt > 0 && !$isStockExists) {
                     $isStockExists = $stockroomhelper->isAttributeStockExists($product_id);
                 }
                 $isPreorderStockExists = $stockroomhelper->isPreorderStockExists($product_id);
                 if ($totalatt > 0 && !$isPreorderStockExists) {
                     $isPreorderStockExists = $stockroomhelper->isAttributePreorderStockExists($product_id);
                 }
                 if (!$isStockExists) {
                     $product_preorder = $rs[$i]->preorder;
                     if ($product_preorder == "global" && ALLOW_PRE_ORDER || $product_preorder == "yes" || $product_preorder == "" && ALLOW_PRE_ORDER) {
                         if (!$isPreorderStockExists) {
                             $product_status = JText::_('COM_REDSHOP_OUT_OF_STOCK');
                         } else {
                             $product_status = JText::_('COM_REDSHOP_PREORDER');
                         }
                     } else {
                         $product_status = JText::_('COM_REDSHOP_OUT_OF_STOCK');
                     }
                 } else {
                     $product_status = JText::_('COM_REDSHOP_AVAILABLE_FOR_ORDER');
                 }
             } else {
                 $product_status = JText::_('COM_REDSHOP_AVAILABLE_FOR_ORDER');
             }
             $product_on_sale = 0;
             if ($rs[$i]->product_on_sale == 1 && ($rs[$i]->discount_stratdate == 0 && $rs[$i]->discount_enddate == 0 || $rs[$i]->discount_stratdate <= time() && $rs[$i]->discount_enddate >= time())) {
                 $product_on_sale = 1;
             }
             // For price and vat settings
             $product_price = $rs[$i]->product_price;
             $discount_price = $rs[$i]->discount_price;
             $sale_price = $product_on_sale == 1 ? $discount_price : $product_price;
             $price_vat = $producthelper->getGoogleVatRates($rs[$i]->product_id, $product_price, USE_TAX_EXEMPT);
             $sale_price_vat = $producthelper->getGoogleVatRates($rs[$i]->product_id, $sale_price, USE_TAX_EXEMPT);
             if (DEFAULT_VAT_COUNTRY != "USA") {
                 $product_price = $rs[$i]->product_price + $price_vat;
                 $sale_price = $sale_price + $sale_price_vat;
             }
             $product_price = $currency->convert(number_format($product_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
             $discount_price = $currency->convert(number_format($discount_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
             $sale_price = $currency->convert(number_format($sale_price, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
             $price_vat = $currency->convert(number_format($price_vat, PRICE_DECIMAL, PRICE_SEPERATOR, THOUSAND_SEPERATOR), '', CURRENCY_CODE);
             $product_url = $url . "index.php?option=com_redshop&amp;view=product&amp;pid=" . $rs[$i]->product_id;
             $xml_code .= "\n<item>";
             $xml_code .= "\n<g:id>" . htmlspecialchars($rs[$i]->product_id, ENT_NOQUOTES, "UTF-8") . "</g:id>";
             $xml_code .= "\n<title>" . htmlspecialchars($rs[$i]->product_name, ENT_NOQUOTES, "UTF-8") . "</title>";
             $xml_code .= "\n<description>'" . htmlspecialchars($rs[$i]->product_s_desc, ENT_NOQUOTES, "UTF-8") . "'</description>";
             $xml_code .= "\n<g:product_type>'" . htmlspecialchars($category_name, ENT_NOQUOTES, "UTF-8") . "'</g:product_type>";
//.........这里部分代码省略.........
开发者ID:jaanusnurmoja,项目名称:redjoomla,代码行数:101,代码来源:product.php

示例13: osC_Checkout_Shipping

 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

示例14: 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

示例15: calculateGrandTotal

 public function calculateGrandTotal()
 {
     // calulate promo codes and group discounts
     //we need to tally up the cart, apply discounts, TAX that TOTAL somehow (different tax clases come into play), then add shipping
     //grab our discounts
     $cartDiscounts = $this->getOrderDiscounts();
     //reset totals
     $this->total_discounts = 0;
     $this->shipping_total = 0;
     $this->shipping_total_before_discounts = 0;
     $this->shippingDiscount = 0;
     $this->surcharge_total = 0;
     $this->subtotal = 0;
     $this->total = 0;
     $this->grand_total = 0;
     $this->tax = 0;
     $validateDiscountMessage = '';
     //eDebug($this->surcharge_total);
     //hate doing double loops, but we need to have the subtotal figured out already for
     //doing the straight dollar disoount calculations below
     for ($i = 0; $i < count($this->orderitem); $i++) {
         // figure out the amount of the discount
         /*if (!empty($this->product_discounts)) {
               $discount_amount = ($this->orderitem[$i]->products_price * ($this->product_discounts * .01));
               // change the price of the orderitem..this is needed for when we calculate tax below.
               $this->orderitem[$i]->products_price = $this->orderitem[$i]->products_price - $discount_amount;
               // keep a tally  of the total amount being subtracted by this discount.
               $this->total_discounts += $discount_amount;                
           }*/
         //$this->orderitem[$i]->products_price = $this->orderitem[$i]->getPriceWithOptions(); // * $this->orderitem[$i]->quantity;
         $this->orderitem[$i]->products_price_adjusted = $this->orderitem[$i]->products_price;
         //$this->orderitem[$i]->products_price_original = $this->orderitem[$i]->product->getPrice();
         $this->subtotal += $this->orderitem[$i]->products_price * $this->orderitem[$i]->quantity;
         $this->surcharge_total += $this->orderitem[$i]->product->getSurcharge() * $this->orderitem[$i]->quantity;
     }
     for ($i = 0; $i < count($this->orderitem); $i++) {
         //only allowing one discount for now, but in future we'll need to process
         //multiple and accomdate the "weight" and 'allow other discounts' type settings
         //this foreach will only fire once as of now, and will only hit on one or the other
         //TODO: We need to use produce_price_adjusted in the loops to accomodate for more than one disocunt
         //otherwise it's just resetting them now instead of adding them
         foreach ($cartDiscounts as $od) {
             //do not calculate invalid discounts, but don't remove either
             $discount = new discounts($od->discounts_id);
             /*$validateDiscountMessage = $discount->validateDiscount();
               if($validateDiscountMessage != '') break;*/
             //percentage discount
             if ($discount->action_type == 3) {
                 $discount_amount = round($this->orderitem[$i]->products_price * ($discount->discount_percent / 100), 2);
                 // change the price of the orderitem..this is needed for when we calculate tax below.
                 $this->orderitem[$i]->products_price_adjusted = $this->orderitem[$i]->products_price - $discount_amount;
                 // keep a tally  of the total amount being subtracted by this discount.
                 $this->total_discounts += $discount_amount * $this->orderitem[$i]->quantity;
             }
             //straight $$ discount
             if ($discount->action_type == 4) {
                 $this->total_discounts = $discount->discount_amount;
                 //what % of the order is this product with all it's quantity
                 $percentOfTotalOrder = $this->orderitem[$i]->products_price * $this->orderitem[$i]->quantity / $this->subtotal;
                 //figoure out how much that'll be and what each quanityt piece will bare
                 $discountAmountPerItem = round($percentOfTotalOrder * $discount->discount_amount / $this->orderitem[$i]->quantity, 2);
                 //$discount_amount = $this->orderitem[$i]->products_price * ($discount->discount_percent / 100);
                 // change the price of the orderitem..this is needed for when we calculate tax below.
                 $this->orderitem[$i]->products_price_adjusted = $this->orderitem[$i]->products_price - $discountAmountPerItem;
                 // keep a tally  of the total amount being subtracted by this discount.
                 //$this->total_discounts += $discountAmountPerItem * $this->orderitem[$i]->quantity;                    //eDebug($discountAmountPerItem);
             }
         }
         // calculate the tax for this product
         $taxclass = new taxclass($this->orderitem[$i]->product->tax_class_id);
         $this->orderitem[$i]->products_tax = $taxclass->getProductTax($this->orderitem[$i]);
         $this->tax += $this->orderitem[$i]->products_tax * $this->orderitem[$i]->quantity;
         //save out the order item
         $this->orderitem[$i]->save();
     }
     // add the "cart discounts" - percentage for sure, but straight can work also should be added after the final total is calculated,
     //including tax but not shipping
     // $this->updateOrderDiscounts();
     /*foreach ($cartDiscounts as $od)
       {
           $discount = new discounts($od->discounts_id); 
           if ($discount->action_type == 4)
           {                       
                $this->total_discounts += $discount->discount_amount;                           
           }                 
       }   */
     // calculate the shipping costs - need to check shipping discounts here in the future
     $estimate_shipping = false;
     if ($this->shipping_required) {
         $shippingmethods = $this->getShippingMethods();
         if (count($shippingmethods) > 0) {
             foreach ($shippingmethods as $sm_id) {
                 $method = new shippingmethod($sm_id, true);
                 if ($method->requiresShipping($this)) {
                     /*
                                             //need to implement handling
                                             $shippingCalc = new shippingcalculator($method->shippingcalculator_id);
                                             $calc = new $shippingCalc->calculator_name($method->shippingcalculator_id);
                                             eDebug($calc,true);*/
                     $this->shipping_total += $method->shipping_cost;
//.........这里部分代码省略.........
开发者ID:notzen,项目名称:exponent-cms,代码行数:101,代码来源:order.php


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