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


PHP Mage_Sales_Model_Quote::getCheckoutMethod方法代码示例

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


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

示例1: getCheckoutMethod

 /**
  * Get checkout method
  *
  * @return string
  */
 public function getCheckoutMethod()
 {
     if ($this->_getCustomerSession()->isLoggedIn()) {
         return Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER;
     }
     if (!$this->_quote->getCheckoutMethod()) {
         if (Mage::helper('checkout')->isAllowedGuestCheckout($this->_quote)) {
             $this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
         } else {
             $this->_quote->setCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER);
         }
     }
     return $this->_quote->getCheckoutMethod();
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:19,代码来源:Checkout.php

示例2: prepareCustomerForQuote

 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function prepareCustomerForQuote(Mage_Sales_Model_Quote $quote)
 {
     $isNewCustomer = false;
     switch ($quote->getCheckoutMethod()) {
         case self::MODE_GUEST:
             $this->_prepareGuestQuote($quote);
             break;
         case self::MODE_REGISTER:
             $this->_prepareNewCustomerQuote($quote);
             $isNewCustomer = true;
             break;
         default:
             $this->_prepareCustomerQuote($quote);
             break;
     }
     return $isNewCustomer;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:21,代码来源:Customer.php

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

示例4: 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') {
         $this->_prepareNewCustomerQuote();
         $isNewCustomer = true;
     } 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('1')->setIsDefaultBilling('1');
             if ($this->_quote->getShippingAddress()->getData('same_as_billing')) {
                 $billingAddress->setIsDefaultShipping('1');
             } else {
                 $shippingAddress = Mage::getModel('customer/address');
                 $shippingAddress->setData($this->_quote->getShippingAddress()->getData())->setCustomerId($this->_quote->getCustomerId())->setSaveInAddressBook('1')->setIsDefaultShipping('1');
                 $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();
     // 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) {
         return;
     }
     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:CherylMuniz,项目名称:fashion,代码行数:68,代码来源:Checkout.php


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