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


PHP order_total::pre_confirmation_check方法代码示例

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


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

示例1: getZenTotals

 /**
  * Get zen-cart order totals.
  *
  * @param  ShoppingCart $shoppingCart The current shopping cart.
  * @return array        zencart order totals.
  */
 protected function getZenTotals(ShoppingCart $shoppingCart)
 {
     global $order, $shipping_modules;
     // save
     $otmp = $order;
     $smtmp = $shipping_modules;
     $order = new \order();
     if (!isset($shipping_modules)) {
         $ssm = array();
         if (null != ($shippingMethod = $shoppingCart->getSelectedShippingMethod())) {
             $ssm = array('id' => $shippingMethod->getShippingId(), 'title' => $shippingMethod->getName(), 'cost' => $shippingMethod->getCost());
         }
         $shipping_modules = new \shipping($ssm);
     }
     $zenTotals = new \order_total();
     $zenTotals->collect_posts();
     $zenTotals->pre_confirmation_check();
     $zenTotals->process();
     // restore
     $order = $otmp;
     $shipping_modules = $smtmp;
     return $zenTotals;
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:29,代码来源:ZMOrderTotals.php

示例2: order

}
if ($kein_versand == 1) {
    $_SESSION['shipping'] = false;
}
$order = new order();
// load all enabled payment modules
require DIR_WS_CLASSES . 'payment.php';
$payment_modules = new payment($_SESSION['payment']);
$payment_modules->update_status();
require DIR_WS_CLASSES . 'order_total.php';
// GV Code ICW ADDED FOR CREDIT CLASS SYSTEM
$order_total_modules = new order_total();
$order_total_modules->process();
// GV Code Start
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
// GV Code End
if (is_array($payment_modules->modules)) {
    $payment_modules->pre_confirmation_check();
}
$breadcrumb->add(NAVBAR_TITLE_PAYPAL_CHECKOUT, xtc_href_link(FILENAME_PAYPAL_CHECKOUT, '', 'SSL'));
require DIR_WS_INCLUDES . 'header.php';
if (SHOW_IP_LOG == 'true') {
    $smarty->assign('IP_LOG', 'true');
    if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
        $customers_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $customers_ip = $_SERVER['REMOTE_ADDR'];
    }
    $smarty->assign('CUSTOMERS_IP', $customers_ip);
}
开发者ID:shophelfer,项目名称:shophelfer.com-shop,代码行数:31,代码来源:paypal_checkout.php

示例3: order

 /**
  * This method sends the user to PayPal's site
  * There, they will log in to their account, choose a funding source and shipping method
  * and then return to our site with an EC token
  */
 function ec_step1()
 {
     global $order, $db, $doPayPal;
     // if cart is empty due to timeout on login or shopping cart page, go to timeout screen
     if ($_SESSION['cart']->count_contents() == 0) {
         zen_redirect(zen_href_link(FILENAME_TIME_OUT, '', 'SSL'));
     }
     // init new order object
     require DIR_WS_CLASSES . 'order.php';
     $order = new order();
     // load the selected shipping module so that shipping taxes can be assessed
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($_SESSION['shipping']);
     // load OT modules so that discounts and taxes can be assessed
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     $order_totals = $order_total_modules->pre_confirmation_check();
     $order_totals = $order_total_modules->process();
     $doPayPal = $this->paypal_init();
     $options = array();
     // unused at present:
     // $options['CUSTOM'] = '';
     // $options['INVNUM'] = '';
     // Determine the language to use when visiting the PP site
     $lc_code = $this->getLanguageCode();
     if ($lc_code != '') {
         $options['LOCALECODE'] = $lc_code;
     }
     // Set currency and amount
     $options['CURRENCY'] = $this->selectCurrency();
     $order_amount = $this->calc_order_amount($order->info['total'], $options['CURRENCY']);
     // Payment Transaction/Authorization Mode
     $options['PAYMENTACTION'] = MODULE_PAYMENT_PAYPALWPP_TRANSACTION_MODE == 'Auth Only' ? 'Authorization' : 'Sale';
     // for future:
     if (MODULE_PAYMENT_PAYPALWPP_TRANSACTION_MODE == 'Order') {
         $options['PAYMENTACTION'] = 'Order';
     }
     // Set the return URL if they click "Submit" on PayPal site
     $return_url = zen_href_link('ipn_main_handler.php', 'type=ec', 'SSL', true, true, true);
     // Select the return URL if they click "cancel" on PayPal site or click to return without making payment or login
     $cancel_url = zen_href_link($_SESSION['customer_first_name'] != '' && $_SESSION['customer_id'] != '' ? FILENAME_CHECKOUT_SHIPPING : FILENAME_LOGIN, 'ec_cancel=1', 'SSL');
     // debug
     $this->zcLog('ec_step1 - 1', 'Checking to see if we are in markflow' . "\n" . 'cart contents: ' . $_SESSION['cart']->get_content_type() . "\n\nNOTE: " . '$this->showPaymentPage = ' . (int) $this->showPaymentPage . "\nCustomer ID: " . (int) $_SESSION['customer_id'] . "\nSession Data: " . print_r($_SESSION, true));
     /**
      * Check whether shipping is required on this order or not.
      * If not, tell PayPal to skip all shipping options
      * ie: don't ask for any shipping info if cart content is strictly virtual and customer is already logged-in
      * (if not logged in, we need address information only to build the customer record)
      */
     if ($_SESSION['cart']->get_content_type() == 'virtual' && isset($_SESSION['customer_id']) && $_SESSION['customer_id'] > 0) {
         $this->zcLog('ec-step1-addr_check', "cart contents is virtual and customer is logged in ... therefore options['NOSHIPPING']=1");
         $options['NOSHIPPING'] = 1;
     } else {
         $this->zcLog('ec-step1-addr_check', "cart contents is not all virtual or customer is not logged in ... therefore will be submitting address details");
         // If we are in a "mark" flow and the customer has a usable address, set the addressoverride variable to 1. This will
         // override the shipping address in PayPal with the shipping address that is selected in Zen Cart.
         if (($address_arr = $this->getOverrideAddress()) !== false) {
             $address_error = false;
             foreach (array('entry_firstname', 'entry_lastname', 'entry_street_address', 'entry_city', 'entry_postcode', 'zone_code', 'countries_iso_code_2') as $key) {
                 if ($address_arr[$key] == '') {
                     $address_error = true;
                 }
                 if ($address_error == true) {
                     $this->zcLog('ec-step1-addr_check2', '$address_error = true because ' . $key . ' is blank.');
                 }
             }
             if ($address_error == false) {
                 // set the override var
                 $options['ADDROVERRIDE'] = 1;
                 // set the address info
                 $options['SHIPTONAME'] = $address_arr['entry_firstname'] . ' ' . $address_arr['entry_lastname'];
                 $options['SHIPTOSTREET'] = $address_arr['entry_street_address'];
                 if ($address_arr['entry_suburb'] != '') {
                     $options['SHIPTOSTREET2'] = $address_arr['entry_suburb'];
                 }
                 $options['SHIPTOCITY'] = $address_arr['entry_city'];
                 $options['SHIPTOZIP'] = $address_arr['entry_postcode'];
                 $options['SHIPTOSTATE'] = $address_arr['zone_code'];
                 $options['SHIPTOCOUNTRYCODE'] = $address_arr['countries_iso_code_2'];
             }
         }
         $this->zcLog('ec-step1-addr_check3', 'address details from override check:' . print_r($address_arr, true));
         // Do we require a "confirmed" shipping address ?
         if (MODULE_PAYMENT_PAYPALWPP_CONFIRMED_ADDRESS == 'Yes') {
             $options['REQCONFIRMSHIPPING'] = 1;
         }
     }
     // if we know customer's email address, supply it, so as to pre-fill the signup box at PayPal (for new PayPal accounts only)
     if (!empty($_SESSION['customer_first_name']) && !empty($_SESSION['customer_id'])) {
         $sql = "select * from " . TABLE_CUSTOMERS . " where customers_id = :custID ";
         $sql = $db->bindVars($sql, ':custID', $_SESSION['customer_id'], 'integer');
         $zc_getemail = $db->Execute($sql);
         if ($zc_getemail->RecordCount() > 0 && $zc_getemail->fields['customers_email_address'] != '') {
             $options['EMAIL'] = $zc_getemail->fields['customers_email_address'];
         }
//.........这里部分代码省略.........
开发者ID:BGCX067,项目名称:ez-commerce-svn-to-git,代码行数:101,代码来源:paypalwpp.php

示例4: shipping

    $oOrder = new order;


    if ( (isset($_SESSION['shipping'])) && ($_SESSION['shipping']['id'] == 'free_free')) {
        if ( ($oOrder->info['total'] - $oOrder->info['shipping_cost']) < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER ) {
            MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_shipping'], '', 'SSL'));
        }
    }

    $oPaymentModules->update_status();
    $oOrderTotalModules = new order_total;
    $oOrderTotalModules->collect_posts();


    if (isset($_SESSION['cot_gv'])) {
        $credit_covers = $oOrderTotalModules->pre_confirmation_check();
    }


    if ( (is_array($oPaymentModules->modules)) && (count($oPaymentModules->modules) > 1) && (!is_object($$_SESSION['payment'])) && (!$credit_covers) ) {
      $_SESSION['error_message'] = $aLang['error_no_payment_module_selected'];
      MyOOS_CoreApi::redirect(oos_href_link($aPages['checkout_payment'], '', 'SSL'));
    }

    if (is_array($oPaymentModules->modules)) {
      $oPaymentModules->pre_confirmation_check();
    }

    // load the selected shipping module
    require 'includes/classes/class_shipping.php';
    $shipping_modules = new shipping($_SESSION['shipping']);
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:31,代码来源:checkout_confirmation.php

示例5: order

 /**
  * This method sends the customer to PayPal's site
  * There, they will log in to their PayPal account, choose a funding source and shipping method
  * and then return to our store site with an EC token
  */
 function ec_step1()
 {
     global $order, $order_totals, $db, $doPayPal;
     // if cart is empty due to timeout on login or shopping cart page, go to timeout screen
     if ($_SESSION['cart']->count_contents() == 0) {
         $message = 'Logging out due to empty shopping cart.  Is session started properly? ... ' . "\nSESSION Details:\n" . print_r($_SESSION, TRUE) . 'GET:' . "\n" . print_r($_GET, TRUE);
         include_once DIR_WS_MODULES . 'payment/paypal/paypal_functions.php';
         ipn_debug_email($message);
         zen_redirect(zen_href_link(FILENAME_TIME_OUT, '', 'SSL'));
     }
     // init new order object
     require DIR_WS_CLASSES . 'order.php';
     $order = new order();
     // load the selected shipping module so that shipping taxes can be assessed
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($_SESSION['shipping']);
     // load OT modules so that discounts and taxes can be assessed
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     $order_totals = $order_total_modules->pre_confirmation_check();
     $order_totals = $order_total_modules->process();
     $doPayPal = $this->paypal_init();
     $options = array();
     $options = $this->getLineItemDetails($this->selectCurrency());
     // Determine the language to use when visiting the PP site
     $lc_code = $this->getLanguageCode();
     if ($lc_code != '') {
         $options['LOCALECODE'] = $lc_code;
     }
     // Set currency and amount
     $options['CURRENCY'] = $this->selectCurrency();
     $order_amount = $this->calc_order_amount($order->info['total'], $options['CURRENCY']);
     // Payment Transaction/Authorization Mode
     $options['PAYMENTACTION'] = MODULE_PAYMENT_PAYPALWPP_TRANSACTION_MODE == 'Auth Only' ? 'Authorization' : 'Sale';
     // for future:
     if (MODULE_PAYMENT_PAYPALWPP_TRANSACTION_MODE == 'Order') {
         $options['PAYMENTACTION'] = 'Order';
     }
     $options['ALLOWNOTE'] = 1;
     // allow customer to enter a note on the PayPal site, which will be copied to order comments upon return to store.
     $options['SOLUTIONTYPE'] = 'Sole';
     // Use 'Mark' for normal Express Checkout, 'Sole' for auctions or alternate flow
     $options['LANDINGPAGE'] = 'Billing';
     // "Billing" or "Login" selects the style of landing page on PayPal site during checkout
     // Set the return URL if they click "Submit" on PayPal site
     $return_url = str_replace('&amp;', '&', zen_href_link('ipn_main_handler.php', 'type=ec', 'SSL', true, true, true));
     // Select the return URL if they click "cancel" on PayPal site or click to return without making payment or login
     $cancel_url = str_replace('&amp;', '&', zen_href_link($_SESSION['customer_first_name'] != '' && $_SESSION['customer_id'] != '' ? FILENAME_CHECKOUT_SHIPPING : FILENAME_SHOPPING_CART, 'ec_cancel=1', 'SSL'));
     // debug
     $val = $_SESSION;
     unset($val['navigation']);
     $this->zcLog('ec_step1 - 1', 'Checking to see if we are in markflow' . "\n" . 'cart contents: ' . $_SESSION['cart']->get_content_type() . "\n\nNOTE: " . '$this->showPaymentPage = ' . (int) $this->showPaymentPage . "\nCustomer ID: " . (int) $_SESSION['customer_id'] . "\nSession Data: " . print_r($val, true));
     /**
      * Check whether shipping is required on this order or not.
      * If not, tell PayPal to skip all shipping options
      * ie: don't ask for any shipping info if cart content is strictly virtual and customer is already logged-in
      * (if not logged in, we need address information only to build the customer record)
      */
     if ($_SESSION['cart']->get_content_type() == 'virtual' && isset($_SESSION['customer_id']) && $_SESSION['customer_id'] > 0) {
         $this->zcLog('ec-step1-addr_check', "cart contents is virtual and customer is logged in ... therefore options['NOSHIPPING']=1");
         $options['NOSHIPPING'] = 1;
     } else {
         $this->zcLog('ec-step1-addr_check', "cart content is not all virtual (or customer is not logged in) ... therefore will be submitting address details");
         // If we are in a "mark" flow and the customer has a usable address, set the addressoverride variable to 1. This will
         // override the shipping address in PayPal with the shipping address that is selected in Zen Cart.
         // @TODO: consider using address-validation against Paypal's addresses
         if (($address_arr = $this->getOverrideAddress()) !== false) {
             $address_error = false;
             foreach (array('entry_firstname', 'entry_lastname', 'entry_street_address', 'entry_city', 'entry_postcode', 'zone_code', 'countries_iso_code_2') as $val) {
                 if ($address_arr[$val] == '') {
                     $address_error = true;
                 }
                 if ($address_error == true) {
                     $this->zcLog('ec-step1-addr_check2', '$address_error = true because ' . $val . ' is blank.');
                 }
             }
             if ($address_error == false) {
                 // set the override var
                 $options['ADDROVERRIDE'] = 1;
                 // set the address info
                 $options['SHIPTONAME'] = $address_arr['entry_firstname'] . ' ' . $address_arr['entry_lastname'];
                 $options['SHIPTOSTREET'] = $address_arr['entry_street_address'];
                 if ($address_arr['entry_suburb'] != '') {
                     $options['SHIPTOSTREET2'] = $address_arr['entry_suburb'];
                 }
                 $options['SHIPTOCITY'] = $address_arr['entry_city'];
                 $options['SHIPTOZIP'] = $address_arr['entry_postcode'];
                 $options['SHIPTOSTATE'] = $address_arr['zone_code'];
                 $options['SHIPTOCOUNTRYCODE'] = $address_arr['countries_iso_code_2'];
             }
         }
         $this->zcLog('ec-step1-addr_check3', 'address details from override check:' . ($address_arr == FALSE ? ' <NONE FOUND>' : print_r($address_arr, true)));
         // Do we require a "confirmed" shipping address ?
         if (MODULE_PAYMENT_PAYPALWPP_CONFIRMED_ADDRESS == 'Yes') {
             $options['REQCONFIRMSHIPPING'] = 1;
//.........这里部分代码省略.........
开发者ID:dalinhuang,项目名称:yijinhuanxiang,代码行数:101,代码来源:paypalwpp.php

示例6: array

 /**
  * This method is for step 2 of the express checkout option.
  * This
  * retrieves from PayPal the data set by step one and sets the Zen Cart
  * data accordingly depending on admin settings.
  */
 function ec_step2()
 {
     // Visitor just came back from PayPal and so we collect all
     // the info returned, create an account if necessary, then log
     // them in, and then send them to the appropriate page.
     if (empty($_SESSION['paypal_ec_token'])) {
         // see if the token is set -- if not, we cannot continue -- ideally the token should match the session token
         if (isset($_GET['token'])) {
             // we have a token, so we will proceed
             $_SESSION['paypal_ec_token'] = $_GET['token'];
             // sanitize this
             $_SESSION['paypal_ec_token'] = preg_replace('/[^0-9.A-Z\\-]/', '', $_GET['token']);
         } else {
             // no token -- not ready for this step -- send them back to checkout page with error
             $this->terminateEC(MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE, true);
         }
     }
     // debug
     // $this->zcLog('PayPal test Log - ec_step2 $_REQUEST data', "In function: ec_step2()\r\nData in \$_REQUEST = \r\n" . print_r($_REQUEST, true));
     // Initialize the paypal caller object.
     global $doPayPal;
     $doPayPal = $this->paypal_init();
     // with the token we retrieve the data about this user
     $response = $doPayPal->GetExpressCheckoutDetails($_SESSION['paypal_ec_token']);
     // $this->zcLog('ec_step2 - GetExpressCheckout response', print_r($response, true));
     /**
      * Determine result of request for data -- if error occurred, the errorHandler will redirect accordingly
      */
     $error = $this->_errorHandler($response, 'GetExpressCheckoutDetails');
     // Check for blank address -- if address received from PayPal is blank, ask the customer to register in the store first and then resume checkout
     if ($_SESSION['cart']->get_content_type() != 'virtual') {
         if ($response['SHIPTONAME'] . $response['SHIPTOSTREET'] . $response['SHIPTOSTREET2'] . $response['SHIPTOCITY'] . $response['SHIPTOSTATE'] . $response['SHIPTOZIP'] . $response['SHIPTOCOUNTRYCODE'] == '') {
             $this->terminateEC(MODULES_PAYMENT_PAYPALWPP_TEXT_BLANK_ADDRESS, true, FILENAME_CREATE_ACCOUNT);
         }
     }
     // will we be creating an account for this customer? We must if the cart contents are virtual, so can login to download etc.
     if ($_SESSION['cart']->get_content_type('true') > 0 || in_array($_SESSION['cart']->content_type, array('mixed', 'virtual'))) {
         $this->new_acct_notify = 'Yes';
     }
     // get the payer_id from the customer's info as returned from PayPal
     $_SESSION['paypal_ec_payer_id'] = $response['PAYERID'];
     $this->notify('NOTIFY_PAYPAL_EXPRESS_CHECKOUT_PAYERID_DETERMINED', $response['PAYERID']);
     $gender = '';
     if (urldecode($response['SALUTATION'] == 'Mr')) {
         $gender = 'm';
     }
     if (in_array(urldecode($response['SALUTATION']), array('Ms', 'Mrs'))) {
         $gender = 'f';
     }
     // prepare the information to pass to the ec_step2_finish() function, which does the account creation, address build, etc
     $step2_payerinfo = array('payer_id' => $response['PAYERID'], 'payer_email' => urldecode($response['EMAIL']), 'payer_salutation' => urldecode($response['SALUTATION']), 'payer_gender' => $gender, 'payer_firstname' => urldecode($response['FIRSTNAME']), 'payer_lastname' => urldecode($response['LASTNAME']), 'payer_business' => urldecode($response['BUSINESS']), 'payer_status' => $response['PAYERSTATUS'], 'ship_country_code' => urldecode($response['COUNTRYCODE']), 'ship_address_status' => urldecode($response['ADDRESSSTATUS']), 'ship_phone' => urldecode($response['SHIPTOPHONENUM'] != '' ? $response['SHIPTOPHONENUM'] : $response['PHONENUM']), 'order_comment' => urldecode($response['NOTETEXT']));
     // if (strtoupper($response['ADDRESSSTATUS']) == 'NONE' || !isset($response['SHIPTOSTREET']) || $response['SHIPTOSTREET'] == '') {
     // $step2_shipto = array();
     // } else {
     // accomodate PayPal bug which repeats 1st line of address for 2nd line if 2nd line is empty.
     if ($response['SHIPTOSTREET2'] == $response['SHIPTOSTREET1']) {
         $response['SHIPTOSTREET2'] = '';
     }
     // accomodate PayPal bug which incorrectly treats 'Yukon Territory' as YK instead of ISO standard of YT.
     if ($response['SHIPTOSTATE'] == 'YK') {
         $response['SHIPTOSTATE'] = 'YT';
     }
     // same with Newfoundland
     if ($response['SHIPTOSTATE'] == 'NF') {
         $response['SHIPTOSTATE'] = 'NL';
     }
     // process address details supplied
     $step2_shipto = array('ship_name' => urldecode($response['SHIPTONAME']), 'ship_street_1' => urldecode($response['SHIPTOSTREET']), 'ship_street_2' => urldecode($response['SHIPTOSTREET2']), 'ship_city' => urldecode($response['SHIPTOCITY']), 'ship_state' => isset($response['SHIPTOSTATE']) && $response['SHIPTOSTATE'] != '' ? urldecode($response['SHIPTOSTATE']) : urldecode($response['SHIPTOCITY']), 'ship_postal_code' => urldecode($response['SHIPTOZIP']), 'ship_country_code' => urldecode($response['SHIPTOCOUNTRYCODE']), 'ship_country_name' => isset($response['SHIPTOCOUNTRY']) ? urldecode($response['SHIPTOCOUNTRY']) : urldecode($response['SHIPTOCOUNTRYNAME']));
     // }
     // reset all previously-selected shipping choices, because cart contents may have been changed
     if (!(isset($_SESSION['paypal_ec_markflow']) && $_SESSION['paypal_ec_markflow'] == 1)) {
         unset($_SESSION['shipping']);
     }
     // set total temporarily based on amount returned from PayPal, so validations continue to work properly
     global $order, $order_totals;
     if (!isset($order) || !isset($order->info) || !is_array($order->info) || !zen_not_null($order)) {
         $this->zcLog('ec_step2 ', 'Re-instantiating $order object.');
         // init new order object
         if (!class_exists('order')) {
             require DIR_WS_CLASSES . 'order.php';
         }
         $order = new order();
         // load the selected shipping module so that shipping taxes can be assessed
         if (!class_exists('shipping')) {
             require DIR_WS_CLASSES . 'shipping.php';
         }
         $shipping_modules = new shipping($_SESSION['shipping']);
         // load OT modules so that discounts and taxes can be assessed
         if (!class_exists('order_total')) {
             require DIR_WS_CLASSES . 'order_total.php';
         }
         $order_total_modules = new order_total();
         $order_totals = $order_total_modules->pre_confirmation_check();
         $order_totals = $order_total_modules->process();
//.........这里部分代码省略.........
开发者ID:wwxgitcat,项目名称:zencart_v1.0,代码行数:101,代码来源:paypalwpp.php

示例7: prepareConfirmation

 public function prepareConfirmation()
 {
     global $messageStack, $template, $breadcrumb, $template_dir_select, $template_dir, $language_page_directory, $currencies, $order, $zco_notifier, $db, $current_page_base, $order_total_modules, $credit_covers;
     // error_reporting(E_ALL);
     // ini_set('display_errors', 'on');
     $_GET['main_page'] = $current_page_base = $current_page = FILENAME_CHECKOUT_CONFIRMATION;
     if ($_SESSION['cart']->count_contents() <= 0) {
         zen_redirect(zen_href_link(FILENAME_TIME_OUT));
     }
     if (!$_SESSION['customer_id']) {
         $_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     } else {
         // validate customer
         if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
             $_SESSION['navigation']->set_snapshot();
             zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
         }
     }
     // avoid hack attempts during the checkout procedure by checking the internal cartID
     if (isset($_SESSION['cart']->cartID) && $_SESSION['cartID']) {
         if ($_SESSION['cart']->cartID != $_SESSION['cartID']) {
             zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
         }
     }
     // if no shipping method has been selected, redirect the customer to the shipping method selection page
     if (!isset($_SESSION['shipping'])) {
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
     }
     if (isset($_SESSION['shipping']['id']) && $_SESSION['shipping']['id'] == 'free_free' && $_SESSION['cart']->get_content_type() != 'virtual' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true' && defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER') && $_SESSION['cart']->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
     }
     if (isset($_POST['payment'])) {
         $_SESSION['payment'] = $_POST['payment'];
     }
     $_SESSION['comments'] = $_POST['comments'];
     if (DISPLAY_CONDITIONS_ON_CHECKOUT == 'true') {
         if (!isset($_POST['conditions']) || $_POST['conditions'] != '1') {
             $messageStack->add_session('checkout_payment', ERROR_CONDITIONS_NOT_ACCEPTED, 'error');
         }
     }
     // echo $messageStack->size('checkout_payment');
     // load the selected payment module
     require DIR_WS_CLASSES . 'payment.php';
     $payment_modules = new payment($_POST['payment']);
     $payment_modules->update_status();
     if (($_POST['payment'] == '' || !is_object($payment_modules->paymentClass)) && $credit_covers === FALSE) {
         $messageStack->add_session('checkout_payment', ERROR_NO_PAYMENT_MODULE_SELECTED, 'error');
     }
     $GLOBALS[$_POST['payment']] = $payment_modules->paymentClass;
     require DIR_WS_CLASSES . 'order.php';
     $order = new order();
     // load the selected shipping module
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($_SESSION['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();
     if (!isset($credit_covers)) {
         $credit_covers = FALSE;
     }
     // echo 'credit covers'.$credit_covers;
     if ($credit_covers) {
         unset($_SESSION['payment']);
         $_SESSION['payment'] = '';
     }
     // @debug echo ($credit_covers == true) ? 'TRUE' : 'FALSE';
     if (is_array($payment_modules->modules)) {
         $payment_modules->pre_confirmation_check();
     }
     if ($messageStack->size('checkout_payment') > 0) {
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
     }
     // Stock Check
     $flagAnyOutOfStock = false;
     $stock_check = array();
     if (STOCK_CHECK == 'true') {
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             if ($stock_check[$i] = zen_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
                 $flagAnyOutOfStock = true;
             }
         }
         // Out of Stock
         if (STOCK_ALLOW_CHECKOUT != 'true' && $flagAnyOutOfStock == true) {
             zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
         }
     }
     // update customers_referral with $_SESSION['gv_id']
     if ($_SESSION['cc_id']) {
         $discount_coupon_query = "SELECT coupon_code\n                            FROM " . TABLE_COUPONS . "\n                            WHERE coupon_id = :couponID";
         $discount_coupon_query = $db->bindVars($discount_coupon_query, ':couponID', $_SESSION['cc_id'], 'integer');
         $discount_coupon = $db->Execute($discount_coupon_query);
         $customers_referral_query = "SELECT customers_referral\n                               FROM " . TABLE_CUSTOMERS . "\n                               WHERE customers_id = :customersID";
         $customers_referral_query = $db->bindVars($customers_referral_query, ':customersID', $_SESSION['customer_id'], 'integer');
         $customers_referral = $db->Execute($customers_referral_query);
         // only use discount coupon if set by coupon
         if ($customers_referral->fields['customers_referral'] == '' and CUSTOMERS_REFERRAL_STATUS == 1) {
             $sql = "UPDATE " . TABLE_CUSTOMERS . "\n            SET customers_referral = :customersReferral\n            WHERE customers_id = :customersID";
             $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
//.........这里部分代码省略.........
开发者ID:kirkbauer2,项目名称:kirkzc,代码行数:101,代码来源:zcAjaxPayment.php

示例8: assertInfo

 /**
  * Assert info.
  *
  * @param boolean withTotals Flag to include/apply totals or not.
  */
 private function assertInfo($withTotals)
 {
     global $order;
     $order = new \order();
     if ($withTotals) {
         if (!isset($shipping_modules)) {
             $shipping_modules = new \shipping($_SESSION['shipping']);
         }
         $order_total_modules = new \order_total();
         $order_total_modules->collect_posts();
         $order_total_modules->pre_confirmation_check();
         $order_total_modules->process();
     }
     foreach ($order->info as $key => $value) {
         if (in_array($key, array('rowClass', 'ip_address'))) {
             continue;
         }
         if (array_key_exists($key, $this->info)) {
             if ('tax_groups' == $key) {
                 // drop [0] as that is the default for none in zc
                 if (isset($value[0])) {
                     unset($value[0]);
                 }
                 $mytg = $this->info[$key];
                 if (count($value) != count($mytg)) {
                     echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): tax groups length diff! order: ';
                     var_dump($value);
                     echo 'ZM got: ';
                     var_dump($mytg);
                     echo '<br>';
                 }
                 continue;
             }
             if (in_array($key, array('total', 'subtotal', 'tax'))) {
                 $value = round($value, 3);
                 $this->info[$key] = round($this->info[$key], 3);
             }
             if ((string) $value != (string) $this->info[$key]) {
                 echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): value mismatch for ' . $key . ': value=';
                 var_dump($value);
                 echo ', ZM got: ';
                 var_dump($this->info[$key]);
                 echo "<BR>";
             }
         } else {
             echo 'info(' . ($withTotals ? 'with' : 'without') . ' ot): missing key: ' . $key . ', value is: ' . $value . "<BR>";
         }
     }
     echo '<br>';
 }
开发者ID:zenmagick,项目名称:zenmagick,代码行数:55,代码来源:ZenCartCheckoutOrder.php

示例9: amazon_process_order


//.........这里部分代码省略.........
                            //							{$itemTax->getCurrencyCode()}
                            $order->contents[$productsKey]['tax'] = $itemTax->getAmount();
                        }
                        if ($shippingPrice = $azi->getShippingPrice()) {
                            //							{$itemTax->getCurrencyCode()}
                            $order->info['shipping_cost'] = $shippingPrice->getAmount();
                        }
                        if (empty($attrString)) {
                            $attrString = $gCommerceSystem->getConfig('MODULE_PAYMENT_AMAZONMWS_DEFAULT_ATTRIBUTES');
                        }
                        // stock up the attributes
                        if ($attrString && ($attrs = explode(',', $attrString))) {
                            foreach ($attrs as $optionValueId) {
                                $optionId = $order->mDb->getOne("SELECT cpa.`products_options_id` FROM " . TABLE_PRODUCTS_ATTRIBUTES . " cpa WHERE cpa.`products_options_values_id`=?", array($optionValueId));
                                $order->contents[$productsKey]['attributes'][$optionId . '_' . $optionValueId] = $optionValueId;
                            }
                        }
                        if (!empty($order->contents[$productsKey]['attributes'])) {
                            $attributes = $order->contents[$productsKey]['attributes'];
                            $order->contents[$productsKey]['attributes'] = array();
                            $subindex = 0;
                            foreach ($attributes as $option => $value) {
                                $optionValues = zen_get_option_value(zen_get_options_id($option), (int) $value);
                                // Determine if attribute is a text attribute and change products array if it is.
                                if ($value == PRODUCTS_OPTIONS_VALUES_TEXT_ID) {
                                    $attr_value = $order->contents[$productsKey]['attributes_values'][$option];
                                } else {
                                    $attr_value = $optionValues['products_options_values_name'];
                                }
                                $order->contents[$productsKey]['attributes'][$subindex] = array('option' => $optionValues['products_options_name'], 'value' => $attr_value, 'option_id' => $option, 'value_id' => $value, 'prefix' => $optionValues['price_prefix'], 'price' => $optionValues['options_values_price']);
                                $subindex++;
                            }
                        }
                        $shown_price = zen_add_tax($order->contents[$productsKey]['final_price'], $order->contents[$productsKey]['tax']) * $order->contents[$productsKey]['products_quantity'] + zen_add_tax($order->contents[$productsKey]['onetime_charges'], $order->contents[$productsKey]['tax']);
                        $order->subtotal += $shown_price;
                        $products_tax = $order->contents[$productsKey]['tax'];
                        $products_tax_description = $order->contents[$productsKey]['tax_description'];
                        if (DISPLAY_PRICE_WITH_TAX == 'true') {
                            $order->info['tax'] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $shown_price - $shown_price / ($products_tax < 10 ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax));
                            }
                        } else {
                            $order->info['tax'] += $products_tax / 100 * $shown_price;
                            if (isset($order->info['tax_groups']["{$products_tax_description}"])) {
                                $order->info['tax_groups']["{$products_tax_description}"] += $products_tax / 100 * $shown_price;
                            } else {
                                $order->info['tax_groups']["{$products_tax_description}"] = $products_tax / 100 * $shown_price;
                            }
                        }
                        $order->info['tax'] = zen_round($order->info['tax'], 2);
                        if ($azi->isSetShippingPrice()) {
                            $shippingPrice = $azi->getShippingPrice();
                            $shipping['cost'] += $shippingPrice->getAmount();
                        }
                    }
                    foreach (array('cc_type', 'cc_owner', 'cc_number', 'cc_expires', 'coupon_code') as $key) {
                        $order->info[$key] = NULL;
                    }
                    $order->info['shipping_method'] = $shipping['title'];
                    $order->info['shipping_method_code'] = $shipping['code'];
                    $order->info['shipping_module_code'] = $shipping['id'];
                    $order->info['payment_module_code'] = 'amazonmws';
                    $order->info['payment_method'] = 'Amazon Order';
                    $_SESSION['sendto'] = NULL;
                    $_SESSION['shipping'] = $shipping;
                    unset($_SESSION['cot_gv']);
                    require_once DIR_FS_CLASSES . 'order_total.php';
                    global $order_total_modules;
                    $order_total_modules = new order_total();
                    $order_totals = $order_total_modules->pre_confirmation_check();
                    require_once DIR_WS_MODULES . 'payment/amazonmws.php';
                    $amazon = new amazonmws($azOrder->getAmazonOrderId());
                    $amazonOutput = $amazon->process();
                    $order_totals = $order_total_modules->process();
                    array_splice($order_totals, count($order_totals) - 1, 0, array($amazonOutput));
                    if ($ordersId = $order->create($order_totals, 2)) {
                        $order->create_add_products($ordersId);
                        $ret = $ordersId;
                        $order->updateStatus(array('status' => MODULE_PAYMENT_AMAZONMWS_INITIAL_ORDER_STATUS_ID));
                    }
                }
                chdir($oldCwd);
            }
        }
    } catch (MarketplaceWebServiceOrders_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
    $gBitUser = $holdUser;
    $gBitCustomer = new CommerceCustomer($gBitUser->mUserId);
    $_SESSION['customer_id'] = $gBitUser->mUserId;
    return $ret;
}
开发者ID:bitweaver,项目名称:commerce,代码行数:101,代码来源:amazonmws_setup_inc.php


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