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


PHP Mage_Sales_Model_Quote::save方法代码示例

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


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

示例1: initializeQuote

 /**
  * Initialize quote objects
  */
 private function initializeQuote()
 {
     $this->quote = Mage::getModel('sales/quote');
     $this->quote->setCheckoutMethod($this->proxyOrder->getCheckoutMethod());
     $this->quote->setStore($this->proxyOrder->getStore());
     $this->quote->save();
 }
开发者ID:xiaoguizhidao,项目名称:beut,代码行数:10,代码来源:Quote.php

示例2: initializeQuote

 private function initializeQuote()
 {
     $this->quote = Mage::getModel('sales/quote');
     $this->quote->setCheckoutMethod($this->proxyOrder->getCheckoutMethod());
     $this->quote->setStore($this->proxyOrder->getStore());
     $this->quote->getStore()->setData('current_currency', $this->quote->getStore()->getBaseCurrency());
     $this->quote->save();
     Mage::getSingleton('checkout/session')->replaceQuote($this->quote);
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:9,代码来源:Quote.php

示例3: placeOrder

 /**
  * Place the order when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $token
  * @param string $shippingMethodCode
  * @return Mage_Sales_Model_Order
  */
 public function placeOrder($token, $shippingMethodCode = null)
 {
     if ($shippingMethodCode) {
         $this->updateShippingMethod($shippingMethodCode);
     }
     if (!$this->_quote->getCustomerId()) {
         $this->_quote->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)->setCustomerEmail($this->_quote->getBillingAddress()->getEmail());
     }
     $this->_ignoreAddressValidation();
     $order = Mage::getModel('sales/service_quote', $this->_quote)->submit();
     $this->_quote->save();
     // commence redirecting to finish payment, if paypal requires it
     if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) {
         $this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token);
     }
     switch ($order->getState()) {
         // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             // TODO
             break;
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
             $order->sendNewOrderEmail();
             break;
     }
     return $order;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:37,代码来源:Checkout.php

示例4: _initShippingMethod

 /**
  * Set shipping method for order.
  * Perform price convert and tax decr/inc
  * @param array $shippingDetails information about selected eBay shipping method
  *
  * @return void
  */
 protected function _initShippingMethod($shippingDetails)
 {
     $store = $this->_quote->getStore();
     // getConfig will initialize requested key with default value
     $store->getConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS);
     // Calculate shipping tax
     if ($this->_taxPercent > 0) {
         $store->setConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $this->_productTaxClassId);
         if ($this->_taxIncludesShipping && $this->isShippingIncludesTax()) {
             $shippingDetails['price'] += $shippingDetails['price'] * $this->_taxPercent / 100;
         }
         if (!$this->_taxIncludesShipping && !$this->isShippingIncludesTax()) {
             $shippingDetails['price'] -= $shippingDetails['price'] / (100 + $this->_taxPercent) * $this->_taxPercent;
         }
     } else {
         $store->setConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, 0);
     }
     // Convert shipping price to currency
     $shippingConvertRate = $this->_shippingCurrencyRate == 0 ? 1 : $this->_shippingCurrencyRate;
     $shippingDetails['price'] = $shippingDetails['price'] / $shippingConvertRate;
     // Round price to 2 digs after comma
     $shippingDetails['price'] = round($shippingDetails['price'], 2);
     // Register information about shipping
     Mage::unregister('ebayShippingData');
     Mage::register('ebayShippingData', $shippingDetails);
     $this->_quote->getShippingAddress()->setShippingMethod('m2eproshipping_m2eproshipping');
     $this->_quote->getShippingAddress()->setCollectShippingRates(true);
     $this->_quote->collectTotals();
     $this->_quote->save();
 }
开发者ID:par-orillonsoft,项目名称:app,代码行数:37,代码来源:Order.php

示例5: place

 /**
  * Place the order and recurring payment profiles when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $token
  * @param string $shippingMethodCode
  */
 public function place($token, $shippingMethodCode = null)
 {
     if ($shippingMethodCode) {
         $this->updateShippingMethod($shippingMethodCode);
     }
     $isNewCustomer = false;
     switch ($this->getCheckoutMethod()) {
         case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST:
             $this->_prepareGuestQuote();
             break;
         case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER:
             $this->_prepareNewCustomerQuote();
             $isNewCustomer = true;
             break;
         default:
             $this->_prepareCustomerQuote();
             break;
     }
     $this->_ignoreAddressValidation();
     $this->_quote->collectTotals();
     $parameters = array('quote' => $this->_quote);
     $service = Mage::getModel('Mage_Sales_Model_Service_Quote', $parameters);
     $service->submitAll();
     $this->_quote->save();
     if ($isNewCustomer) {
         try {
             $this->_involveNewCustomer();
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles();
     // TODO: send recurring profile emails
     $order = $service->getOrder();
     if (!$order) {
         return;
     }
     $this->_billingAgreement = $order->getPayment()->getBillingAgreement();
     // commence redirecting to finish payment, if paypal requires it
     if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) {
         $this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token);
     }
     switch ($order->getState()) {
         // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             // TODO
             break;
             // regular placement, when everything is ok
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
             $order->sendNewOrderEmail();
             break;
     }
     $this->_order = $order;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:66,代码来源:Checkout.php

示例6: populuateQuote

 /**
  * Makes Quote available for Magento Core classes
  *
  * @param Mage_Sales_Model_Quote $quote
  */
 public function populuateQuote(Mage_Sales_Model_Quote &$quote)
 {
     $quote->save();
     $quote = Mage::getModel('sales/quote')->load($quote->getId());
     Mage::getSingleton('checkout/cart')->setQuote($quote);
     Mage::getSingleton('checkout/session')->setQuoteId($quote->getId());
     Mage::getSingleton('checkout/type_onepage')->setQuote($quote);
 }
开发者ID:nhp,项目名称:Xtest,代码行数:13,代码来源:Frontend.php

示例7: save

 public function save()
 {
     $this->_order->setStoreId($this->_getStore()->getId());
     $this->_order->createFromQuoteAddress($this->_quote->getShippingAddress());
     $this->_order->validate();
     $this->_order->setInitialStatus();
     $this->_order->save();
     $this->_order->setCreatedAt($this->_getRandomDate());
     $this->_order->save();
     $this->_quote->setIsActive(false);
     $this->_quote->save();
     return $this;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:13,代码来源:Random.php

示例8: place

 /**
  * Place the order and recurring payment profiles when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $workOrderId
  * @param string $shippingMethodCode
  */
 public function place($workOrderId, $shippingMethodCode = null)
 {
     if ($shippingMethodCode) {
         $this->updateShippingMethod($shippingMethodCode);
     }
     $isNewCustomer = false;
     switch ($this->getCheckoutMethod()) {
         case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST:
             $this->_prepareGuestQuote();
             break;
         case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER:
             $this->_prepareNewCustomerQuote();
             $isNewCustomer = true;
             break;
         default:
             $this->_prepareCustomerQuote();
             break;
     }
     $this->_ignoreAddressValidation();
     $this->_quote->collectTotals();
     $service = Mage::getModel('sales/service_quote', $this->_quote);
     $service->submitAll();
     $this->_quote->save();
     if ($isNewCustomer) {
         try {
             $this->_involveNewCustomer();
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles();
     $order = $service->getOrder();
     if (!$order) {
         return;
     }
     $this->_billingAgreement = $order->getPayment()->getBillingAgreement();
     switch ($order->getState()) {
         // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             // TODO
             break;
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
             $order->sendNewOrderEmail();
             break;
     }
     $this->_order = $order;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:58,代码来源:Checkout.php

示例9: place

 /**
  * Place the order and recurring payment profiles when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $token
  * @param string $shippingMethodCode
  */
 public function place($token, $shippingMethodCode = null)
 {
     $this->updateShippingMethod($shippingMethodCode);
     $isNewCustomer = $this->_prepareQuote();
     $this->_ignoreAddressValidation();
     $this->_quote->collectTotals();
     $this->_getApi();
     $payerId = $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_PAYER_ID);
     $doExpressReply = $this->_api->doExpressCheckout($this->_quote, $token, $payerId);
     $doAuthorizationReply = $this->_api->doAuthorization($this->_quote);
     $this->_quote->getPayment()->importData(array_merge($doExpressReply, $doAuthorizationReply));
     $service = Mage::getModel('sales/service_quote', $this->_quote);
     try {
         $service->submitAll();
         // Any exceptions thrown from submitAll indicate an order that failed
         // to be created. In any such cases, the payment auth needs to be voided.
     } catch (Exception $e) {
         $this->_api->doVoidQuote($this->_quote);
         // Throw an exception for the controller to handle. Needs to indicate
         // the failure to complete the PayPal payment as the PayPal process
         // needs to be restarted once the auth was performed.
         throw Mage::exception('EbayEnterprise_PayPal', $this->_helper->__(EbayEnterprise_Paypal_Model_Express_Api::EBAYENTERPRISE_PAYPAL_API_FAILED));
     }
     $this->_quote->save();
     if ($isNewCustomer) {
         try {
             $this->_involveNewCustomer();
         } catch (Exception $e) {
             $this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
         }
     }
     $order = $service->getOrder();
     if (!$order) {
         return;
     }
     switch ($order->getState()) {
         // Even after placement, paypal can disallow authorize/capture
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             break;
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
             $order->sendNewOrderEmail();
             break;
     }
     $this->_order = $order;
     Mage::dispatchEvent('checkout_submit_all_after', array('order' => $order, 'quote' => $this->_quote));
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:57,代码来源:Checkout.php

示例10: getCustomerCart

 /**
  * Retrieve customer cart quote object model
  *
  * @return Mage_Sales_Model_Quote
  */
 public function getCustomerCart()
 {
     if (!is_null($this->_cart)) {
         return $this->_cart;
     }
     $this->_cart = Mage::getModel('sales/quote');
     if ($this->getSession()->getCustomer()->getId()) {
         $this->_cart->setStore($this->getSession()->getStore())->loadByCustomer($this->getSession()->getCustomer()->getId());
         if (!$this->_cart->getId()) {
             $this->_cart->assignCustomer($this->getSession()->getCustomer());
             $this->_cart->save();
         }
     }
     return $this->_cart;
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:20,代码来源:Create.php

示例11: saveOrder

 /**
  * Place the order when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @return array
  */
 public function saveOrder()
 {
     $this->_ignoreAddressValidation();
     $order = Mage::getModel('sales/service_quote', $this->_quote)->submit();
     $this->_quote->save();
     /**
      * Prepare session to success or cancellation page
      */
     $quoteId = $this->_quote->getId();
     $this->_getCheckoutSession()->setLastQuoteId($quoteId)->setLastSuccessQuoteId($quoteId)->setLastOrderId($order->getId())->setLastRealOrderId($order->getIncrementId());
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
         try {
             $order->sendNewOrderEmail();
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     return array();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:25,代码来源:Checkout.php

示例12: place

 /**
  * Place the order and recurring payment profiles when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $token
  * @param string $shippingMethodCode
  */
 public function place($token, $shippingMethodCode = null)
 {
     $this->updateShippingMethod($shippingMethodCode);
     $isNewCustomer = $this->_prepareQuote();
     $this->_ignoreAddressValidation();
     $this->_quote->collectTotals();
     $this->_getApi();
     $payerId = $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_PAYER_ID);
     $doExpressReply = $this->_api->doExpressCheckout($this->_quote, $token, $payerId);
     $doAuthorizationReply = $this->_api->doAuthorization($this->_quote);
     $this->_quote->getPayment()->importData(array_merge($doExpressReply, $doAuthorizationReply));
     $service = Mage::getModel('sales/service_quote', $this->_quote);
     $service->submitAll();
     $this->_quote->save();
     if ($isNewCustomer) {
         try {
             $this->_involveNewCustomer();
         } catch (Exception $e) {
             $this->_logger->logException($e, $this->_context->getMetaData(__CLASS__, [], $e));
         }
     }
     $order = $service->getOrder();
     if (!$order) {
         return;
     }
     switch ($order->getState()) {
         // Even after placement, paypal can disallow authorize/capture
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             break;
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
             $order->sendNewOrderEmail();
             break;
     }
     $this->_order = $order;
     Mage::dispatchEvent('checkout_submit_all_after', array('order' => $order, 'quote' => $this->_quote));
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:47,代码来源:Checkout.php

示例13: placeOrder

 /**
  * Place the order when customer returned from paypal
  * Until this moment all quote data must be valid
  *
  * @param string $token
  * @param string $shippingMethodCode
  * @return Mage_Sales_Model_Order
  */
 public function placeOrder($token, $shippingMethodCode = null)
 {
     if ($shippingMethodCode) {
         $this->updateShippingMethod($shippingMethodCode);
     }
     $this->_ignoreAddressValidation();
     $order = Mage::getModel('sales/service_quote', $this->_quote)->submit();
     $this->_quote->save();
     switch ($order->getState()) {
         // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money
         case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
             // TODO
             break;
             // regular placement, when everything is ok
         // regular placement, when everything is ok
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
             if ($this->_config->invoiceEmailCopy && $order->getPayment()->getCreatedInvoice()) {
                 $order->sendNewOrderEmail();
             }
             break;
     }
     return $order;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:32,代码来源:Checkout.php

示例14: place

 /**
  * Place the order and recurring payment profiles when customer returned from paypal
  * Until this moment all quote data must be valid
  */
 public function place()
 {
     $isNewCustomer = false;
     if ($this->_quote->getCheckoutMethod() == 'register') {
         $isNewCustomer = $this->_prepareNewCustomerQuote();
     } elseif (!$this->_quote->getCustomerId()) {
         $this->_quote->setCustomerIsGuest(true)->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID)->setCustomerEmail($this->_quote->getBillingAddress()->getEmail());
     } elseif ($this->_quote->getCustomerId()) {
         if (!$this->_quote->getBillingAddress()->getCustomerAddressId()) {
             $billingAddress = Mage::getModel('customer/address');
             $billingAddress->setData($this->_quote->getBillingAddress()->getData())->setCustomerId($this->_quote->getCustomerId())->setSaveInAddressBook('0');
             //->setIsDefaultBilling('1');
             if ($this->_quote->getShippingAddress()->getData('same_as_billing')) {
                 $billingAddress->setIsDefaultShipping('0');
             } else {
                 $shippingAddress = Mage::getModel('customer/address');
                 $shippingAddress->setData($this->_quote->getShippingAddress()->getData())->setCustomerId($this->_quote->getCustomerId())->setSaveInAddressBook('0')->setIsDefaultShipping('0');
                 $shippingAddress->save();
             }
             $billingAddress->save();
         } else {
             if ($this->_quote->getBillingAddress()->getSaveInAddressBook()) {
                 $newAddress = Mage::getModel('customer/address');
                 $newAddress->setData($this->_quote->getBillingAddress()->getData())->setCustomerId($this->_quote->getCustomerId())->setSaveInAddressBook('1')->save();
             }
             if ($this->_quote->getShippingAddress()->getSaveInAddressBook() && !$this->_quote->getShippingAddress()->getData('same_as_billing')) {
                 $newAddress = Mage::getModel('customer/address');
                 $newAddress->setData($this->_quote->getShippingAddress()->getData())->setCustomerId($this->_quote->getCustomerId())->setSaveInAddressBook('1')->save();
             }
         }
     }
     $this->_ignoreAddressValidation();
     $this->_quote->collectTotals();
     //set payment method as paypal
     $this->_quote->getPayment()->setMethod("sagepaypaypal");
     // commence redirecting to finish payment
     $rs = Mage::getModel('sagepaysuite/sagePayDirectPro')->completePayPalTransaction(Mage::getSingleton('sagepaysuite/session')->getSagepaypaypalRqpost(), $this->_quote);
     $service = Mage::getModel('sales/service_quote', $this->_quote);
     $service->submitAll();
     $this->_quote->save();
     if ($isNewCustomer) {
         try {
             $this->_involveNewCustomer();
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     $order = $service->getOrder();
     if (!$order) {
         $dbtrn = Mage::getModel('sagepaysuite2/sagepaysuite_paypaltransaction')->loadByVendorTxCode(Mage::getSingleton('sagepaysuite/session')->getLastVendorTxCode());
         if ($dbtrn->getId()) {
             $dbtrn->setStatus('MAGE_ERROR')->setStatusDetail("Could not save order. " . $dbtrn->getStatusDetail())->save();
         }
         Mage::throwException('Could not save order. Please try again.');
         return;
     }
     //Dispatching event, some modules need this to complete processing.
     Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order' => $order, 'quote' => $this->_quote));
     try {
         $order->sendNewOrderEmail();
     } catch (Exception $ex) {
         Mage::logException($ex);
     }
     $this->_order = $order;
 }
开发者ID:GaynorH,项目名称:prestigedrinks,代码行数:69,代码来源:Checkout.php

示例15: setCouponCode

 /**
  * Set the coupon code on the quote
  *
  * @param Mage_Sales_Model_Quote
  * @param $couponCode
  */
 public function setCouponCode(Mage_Sales_Model_Quote $quote, $couponCode)
 {
     $quote->setCouponCode($couponCode);
     $quote->setTotalsCollectedFlag(false)->collectTotals();
     $quote->save();
 }
开发者ID:danlins,项目名称:magento-multi-coupons,代码行数:12,代码来源:Service.php


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