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


PHP Cart::LoadByIdStr方法代码示例

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


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

示例1: onCreateOrder

 /**
  * Attached event for anytime a new customer is created
  * @param $event
  * @return bool
  */
 public function onCreateOrder($event)
 {
     $this->init();
     $topicArn = $this->getTopicArn();
     //don't run this unless we actually have a cloud acct
     if (Yii::app()->params['LIGHTSPEED_CLOUD'] == '0' || empty($topicArn)) {
         return true;
     }
     $objCart = Cart::LoadByIdStr($event->order_id);
     $strSignal = $this->buildOrderSignal($objCart);
     $this->sendSignal($strSignal, $topicArn);
     return true;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:18,代码来源:wscloud.php

示例2: generateErrorResponse

 private static function generateErrorResponse($trnOrderNumber, $messageText)
 {
     $objCart = Cart::LoadByIdStr($trnOrderNumber);
     $url = Yii::app()->controller->createAbsoluteUrl('cart/restoredeclined', array('getuid' => $objCart->linkid, 'reason' => $messageText));
     $arrReturn = array('order_id' => $trnOrderNumber, 'output' => "<html><head><meta http-equiv=\"refresh\" content=\"1;url={$url}\"></head><body><a href=\"{$url}\">Verifying order, please wait...</a></body></html>", 'success' => false);
     return $arrReturn;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:7,代码来源:beanstreamsim.php

示例3: actionConfirmation

 public function actionConfirmation()
 {
     // We should only be in here if someone has chosen a SIM.
     $this->checkoutForm = MultiCheckoutForm::loadFromSessionOrNew();
     $this->layout = '/layouts/checkout-confirmation';
     $objCart = Yii::app()->shoppingcart;
     $error = null;
     if (isset($_POST['MultiCheckoutForm'])) {
         $this->checkoutForm->attributes = $_POST['MultiCheckoutForm'];
         if ($objCart->shipping->isStorePickup) {
             $this->checkoutForm->setScenario('ConfirmationStorePickup');
         } else {
             $this->checkoutForm->setScenario('ConfirmationSim');
         }
         $isFormValid = $this->checkoutForm->updateCartCustomerId() && $this->checkoutForm->validate();
         if ($isFormValid && Yii::app()->shoppingcart->wasCartModified === false) {
             // our form is valid and the cart items are as we expect, continue
             self::executeCheckoutProcessInit();
             $this->runPaymentSim();
         } else {
             $this->layout = '/layouts/checkout-confirmation';
             $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => $objCart, 'error' => $this->formatErrors(), 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'recalculateShippingOnLoad' => Yii::app()->shoppingcart->wasCartModified));
         }
     } else {
         $orderId = Yii::app()->getRequest()->getQuery('orderId');
         $errorNote = Yii::app()->getRequest()->getQuery('errorNote');
         if (isset($errorNote) && isset($orderId)) {
             // Cancelled/Declined simple integration transaction.
             $objCart = Cart::LoadByIdStr($orderId);
             if (stripos($errorNote, 'cancel') !== false) {
                 // Cancelled.
                 $translatedErrorNote = Yii::t('checkout', 'You <strong>cancelled</strong> your payment.');
             } else {
                 // Declined.
                 $translatedErrorNote = Yii::t('checkout', 'There was an issue with your payment.') . '<br><br><strong>' . $errorNote . '</strong><br><br>';
                 $translatedErrorNote .= Yii::t('checkout', 'Try re-entering your payment details or contact us at {email} or {phone}', array('{email}' => _xls_get_conf('EMAIL_FROM'), '{phone}' => _xls_get_conf('STORE_PHONE')));
             }
             $this->checkoutForm->addErrors(array('note' => $translatedErrorNote));
         }
         $this->render('confirmation', array('model' => $this->checkoutForm, 'cart' => $objCart, 'shippingEstimatorOptions' => $this->_getShippingEstimatorOptions(), 'error' => $this->formatErrors()));
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:42,代码来源:CheckoutController.php

示例4: add_order

 /**
  * Add an order for display
  *
  * @param string $passkey
  * @param string $strId
  * @param int $intDttDate
  * @param int $intDttDue
  * @param string $strPrintedNotes
  * @param string $strStatus
  * @param string $strEmail
  * @param string $strPhone
  * @param string $strZipcode
  * @param int $intTaxcode
  * @param float $fltShippingSell
  * @param float $fltShippingCost
  * @return string
  */
 public function add_order($passkey, $strId, $intDttDate, $intDttDue, $strPrintedNotes, $strStatus, $strEmail, $strPhone, $strZipcode, $intTaxcode, $fltShippingSell, $fltShippingCost)
 {
     if (!$this->check_passkey($passkey)) {
         return self::FAIL_AUTH;
     }
     $objDocument = Document::LoadByIdStr($strId);
     if (!$objDocument instanceof Document) {
         $objDocument = new Document();
     } else {
         // if cart already exists then delete the items
         foreach ($objDocument->documentItems as $item) {
             $item->qty = 0;
             $item->save();
             $item->product->SetAvailableInventory();
             $item->delete();
         }
     }
     $objDocument->order_type = CartType::order;
     $objDocument->order_str = $strId;
     $objDocument->printed_notes = $strPrintedNotes;
     $objDocument->datetime_cre = date("Y-m-d H:i:s", trim($intDttDate));
     $objDocument->datetime_due = date("Y-m-d H:i:s", trim($intDttDue));
     $objDocument->fk_tax_code_id = $intTaxcode ? $intTaxcode : 0;
     $objDocument->status = $strStatus;
     $objCustomer = Customer::LoadByEmail($strEmail);
     if ($objCustomer instanceof Customer) {
         $objDocument->customer_id = $objCustomer->id;
     }
     $objCart = Cart::LoadByIdStr($strId);
     if ($objCart instanceof Cart) {
         $objDocument->cart_id = $objCart->id;
     }
     $objDocument->status = $strStatus;
     if (!$objDocument->save()) {
         Yii::log("SOAP ERROR : add_order " . print_r($objDocument->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return self::UNKNOWN_ERROR;
     }
     if ($objCart instanceof Cart) {
         $objCart->document_id = $objDocument->id;
         $objCart->save();
     }
     if (substr($strId, 0, 3) == "WO-") {
         Configuration::SetHighestWO();
     }
     return self::OK;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:63,代码来源:LegacysoapController.php

示例5: gateway_response_process

 public function gateway_response_process()
 {
     $status = Yii::app()->getRequest()->getQuery('Status');
     $authCode = Yii::app()->getRequest()->getQuery('AuthCode');
     $orderId = Yii::app()->getRequest()->getQuery('TransactionID');
     $objCart = Cart::LoadByIdStr($orderId);
     if (strtolower($status) != 'approved') {
         $url = Yii::app()->controller->createAbsoluteUrl('cart/restoredeclined', array('getuid' => $objCart->linkid, 'reason' => $status));
         return array('success' => false, 'order_id' => $objCart->id_str, 'output' => "<html><head><meta http-equiv=\"refresh\" content=\"1;url={$url}\"></head><body><a href=\"{$url}\">Verifying order, please wait...</a></body></html>");
     }
     return array('success' => true, 'data' => $authCode, 'order_id' => $objCart->id_str, 'amount' => $objCart->total);
 }
开发者ID:hjlan,项目名称:webstore,代码行数:12,代码来源:cayan.php

示例6: onActionListOrderDetails

 public function onActionListOrderDetails($event)
 {
     Yii::log("Running event " . print_r($event, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
     $data_id = $event->data_id;
     $arrData = explode(",", $data_id);
     $cartId = $arrData[0];
     $checkDate = $arrData[1];
     $config = array('ServiceURL' => $this->getMWSUrl() . "/Orders/" . $checkDate, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
     $service = new MarketplaceWebServiceOrders_Client($this->MWS_ACCESS_KEY_ID, $this->MWS_SECRET_ACCESS_KEY, $this->APPLICATION_NAME, $this->APPLICATION_VERSION, $config);
     $request = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
     $request->setSellerId($this->MerchantID);
     $request->setAmazonOrderId($cartId);
     // object or array of parameters
     $response = $this->invokeListOrderItems($service, $request);
     $listOrderItemsResult = $response->getListOrderItemsResult();
     if ($listOrderItemsResult->isSetOrderItems()) {
         $objCart = Cart::LoadByIdStr($cartId);
         if ($objCart->cart_type == CartType::cart) {
             $orderItems = $listOrderItemsResult->getOrderItems();
             $orderItemList = $orderItems->getOrderItem();
             $shippingCost = 0;
             foreach ($orderItemList as $orderItem) {
                 $strCode = $orderItem->getSellerSKU();
                 Yii::log("Amazon " . $cartId . " item on order " . $strCode, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 Yii::log("Order item information " . print_r($orderItem, true), 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 $intQty = $orderItem->getQuantityOrdered();
                 $objPrice = $orderItem->getItemPrice();
                 $fltPrice = $objPrice->getAmount();
                 $strCurrency = $objPrice->getCurrencyCode();
                 //Amazon provides price as total for line item, but our AddToCart expects per item
                 //so we divide
                 if ($intQty > 1) {
                     $fltPrice = $fltPrice / $intQty;
                 }
                 if ($orderItem->isSetShippingPrice()) {
                     $objShippingPrice = $orderItem->getShippingPrice();
                     if ($objShippingPrice->isSetAmount()) {
                         $shippingCost += $objShippingPrice->getAmount();
                     }
                 }
                 if ($orderItem->isSetPromotionDiscount()) {
                     $promotionDiscount = $orderItem->getPromotionDiscount();
                     $fltDiscount = $promotionDiscount->getAmount();
                 } else {
                     $fltDiscount = 0;
                 }
                 $objProduct = Product::LoadByCode($strCode);
                 if (is_null($objProduct)) {
                     $objCart->printed_notes .= "ERROR MISSING PRODUCT - " . "Attempted to download a product from Amazon " . $strCode . " that doesn't exist in Web Store\n";
                     Yii::log("Attempted to download a product from Amazon " . $strCode . " that doesn't exist in Web Store", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 } else {
                     $objCart->AddProduct($objProduct, $intQty, CartType::order, null, $orderItem->getTitle(), $fltPrice, $fltDiscount);
                 }
                 $objCart->currency = $strCurrency;
                 if (!$objCart->save()) {
                     Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 }
             }
             $objCart->cart_type = CartType::order;
             if (!$objCart->save()) {
                 Yii::log("Error saving cart " . print_r($objCart->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             }
             $objShipping = $objCart->shipping;
             $objShipping->shipping_cost = $shippingCost;
             $objShipping->shipping_sell = $shippingCost;
             $objShipping->save();
             $objCart->recalculateAndSave();
             $objCart->RecalculateInventoryOnCartItems();
             //A new order has been created, so run signal
             $objEvent = new CEventOrder('wsamazon', 'onCreateOrder', $objCart->id_str);
             _xls_raise_events('CEventOrder', $objEvent);
         }
     }
     return self::SUCCESS;
 }
开发者ID:hjlan,项目名称:webstore,代码行数:75,代码来源:wsamazon.php

示例7: update_order_downloaded_status_by_id

 /**
  * Update an individual order as downloaded
  * @param string $passkey
  * @param string $strId
  * @param int $intDownloaded
  * @return string
  * @throws SoapFault
  * @soap
  */
 public function update_order_downloaded_status_by_id($passkey, $strId, $intDownloaded)
 {
     self::check_passkey($passkey);
     try {
         $objCart = Cart::LoadByIdStr($strId);
         if ($objCart === null) {
             throw new WsSoapException("Cart with ID '" . $strId . "' was not found");
         }
         Cart::model()->updateByPk($objCart->id, array('downloaded' => $intDownloaded, 'status' => OrderStatus::Downloaded));
     } catch (WsSoapException $wsse) {
         $strMsg = "update_order_downloaded_status_by_id " . $wsse;
         Yii::log("SOAP ERROR : {$strMsg}", CLogger::LEVEL_ERROR, 'application.' . __CLASS__ . "." . __FUNCTION__);
         throw new SoapFault($strMsg, WsSoapException::ERROR_UNKNOWN);
     } catch (Exception $ex) {
         $strMsg = "Unknown error while trying to update downloaded status for the cart with ID '" . $strId . "'";
         Yii::log("SOAP ERROR : {$strMsg}", CLogger::LEVEL_ERROR, 'application.' . __CLASS__ . "." . __FUNCTION__);
         throw new SoapFault($strMsg, WsSoapException::ERROR_UNKNOWN);
     }
     return self::OK;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:29,代码来源:SoapController.php

示例8: gateway_response_process

 /**
  * gateway_response_process
  *
  * Processes processor gateway response
  * Processes returned $_GET or $_POST variables from the third party website
  */
 public function gateway_response_process()
 {
     Yii::log("Response Transaction " . print_r($_POST, true), $this->logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__);
     $x_response_code = Yii::app()->getRequest()->getPost('x_response_code');
     $x_invoice_num = Yii::app()->getRequest()->getPost('x_invoice_num');
     $x_MD5_Hash = Yii::app()->getRequest()->getPost('x_MD5_Hash');
     $x_amount = Yii::app()->getRequest()->getPost('x_amount');
     $x_trans_id = Yii::app()->getRequest()->getPost('x_trans_id');
     if (empty($x_response_code) || empty($x_invoice_num)) {
         return false;
     }
     if ($x_response_code != 1) {
         // failed order
         Yii::log(__CLASS__ . " failed order payment received " . print_r($_POST, true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
         return false;
     }
     if (isset($this->config['md5hash']) && $this->config['md5hash'] && !empty($x_MD5_Hash)) {
         $md5 = strtolower(md5($this->config['md5hash'] . $this->config['login'] . Yii::app()->getRequest()->getPost('x_trans_id') . $x_amount));
         if (strtolower($x_MD5_Hash) != $md5) {
             Yii::log("authorize.net.sim failed md5 hash", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
             return false;
         }
     }
     $objCart = Cart::LoadByIdStr($x_invoice_num);
     $url = Yii::app()->createAbsoluteUrl('cart/receipt', array('getuid' => $objCart->linkid));
     return array('order_id' => $x_invoice_num, 'amount' => !empty($x_amount) ? $x_amount : 0, 'success' => true, 'data' => !empty($x_trans_id) ? $x_trans_id : '', 'output' => "<html><head><meta http-equiv=\"refresh\" content=\"0;url={$url}\"></head><body><a href=\"{$url}\">" . Yii::t('global', 'Redirecting to your receipt') . "...</a></body></html>");
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:33,代码来源:authorizedotnetsim.php

示例9: actionPayment

 /**
  * Process payments coming in from third party systems, such as Paypal IPN and other SIM integrations
  */
 public function actionPayment()
 {
     $strModule = Yii::app()->getRequest()->getQuery('id');
     Yii::log("Incoming message for " . $strModule, 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
     try {
         $retVal = Yii::app()->getComponent($strModule)->gateway_response_process();
         Yii::log("Gateway response {$strModule}:\n" . print_r($retVal, true), 'info', 'application.' . __CLASS__ . '.' . __FUNCTION__);
         if (is_array($retVal)) {
             if ($retVal['success']) {
                 $objCart = Cart::model()->findByAttributes(array('id_str' => $retVal['order_id']));
                 if (is_null($objCart)) {
                     Yii::log($retVal['order_id'] . " is not our order, ignoring", 'info', 'application.' . __CLASS__ . "." . __FUNCTION__);
                 }
                 if ($objCart instanceof Cart && $objCart->cart_type == CartType::awaitpayment) {
                     $objPayment = CartPayment::model()->findByPk($objCart->payment_id);
                     $objPayment->payment_amount = isset($retVal['amount']) ? $retVal['amount'] : 0;
                     $objPayment->payment_data = $retVal['data'];
                     $objPayment->datetime_posted = isset($retVal['payment_date']) ? date("Y-m-d H:i:s", strtotime($retVal['payment_date'])) : new CDbExpression('NOW()');
                     $objPayment->save();
                     self::EmailReceipts($objCart);
                     Yii::log('Receipt e-mails added to the queue', 'info', __CLASS__ . '.' . __FUNCTION__);
                     self::FinalizeCheckout($objCart, Yii::app()->getComponent($strModule)->performInternalFinalizeSteps);
                     Yii::log('Checkout Finalized', 'info', __CLASS__ . '.' . __FUNCTION__);
                     if (!isset($retVal['output'])) {
                         Yii::app()->controller->redirect(Yii::app()->controller->createAbsoluteUrl('cart/receipt', array('getuid' => $objCart->linkid), 'http'));
                     }
                 }
             }
             if (isset($retVal['output'])) {
                 echo $retVal['output'];
             } else {
                 $objCart = Cart::LoadByIdStr($retVal['order_id']);
                 if ($objCart instanceof Cart) {
                     Yii::app()->controller->redirect(Yii::app()->controller->createAbsoluteUrl('cart/restore', array('getuid' => $objCart->linkid)));
                 }
                 echo Yii::t('global', 'Payment Error: Was not successful, and payment attempt did not return a proper error message');
             }
         }
     } catch (Exception $e) {
         //Can't find module. if $val=="fancyshipping" then filename must be "FancyshippingModule.php" (case sensitive)
         Yii::log("Received payment but could not process {$e}", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:46,代码来源:CartController.php


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