コード例 #1
0
 /**
  * Get checkout method
  *
  * @param Quote $quote
  * @return string
  */
 private function getCheckoutMethod(Quote $quote)
 {
     if ($this->customerSession->isLoggedIn()) {
         return Onepage::METHOD_CUSTOMER;
     }
     if (!$quote->getCheckoutMethod()) {
         if ($this->checkoutHelper->isAllowedGuestCheckout($quote)) {
             $quote->setCheckoutMethod(Onepage::METHOD_GUEST);
         } else {
             $quote->setCheckoutMethod(Onepage::METHOD_REGISTER);
         }
     }
     return $quote->getCheckoutMethod();
 }
コード例 #2
0
ファイル: DataTest.php プロジェクト: nja78/magento2
 public function testIsAllowedGuestCheckoutWithoutStore()
 {
     $quoteMock = $this->getMock('\\Magento\\Quote\\Model\\Quote', [], [], '', false);
     $store = null;
     $quoteMock->expects($this->once())->method('getStoreId')->will($this->returnValue(1));
     $this->_scopeConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(true));
     $this->assertTrue($this->_helper->isAllowedGuestCheckout($quoteMock, $store));
 }
コード例 #3
0
ファイル: Onepage.php プロジェクト: nja78/magento2
 /**
  * Validate quote state to be integrated with one page checkout process
  *
  * @return void
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 protected function validate()
 {
     $quote = $this->getQuote();
     if ($quote->isMultipleShippingAddresses()) {
         throw new \Magento\Framework\Exception\LocalizedException(__('There are more than one shipping addresses.'));
     }
     if ($quote->getCheckoutMethod() == self::METHOD_GUEST && !$this->_helper->isAllowedGuestCheckout($quote)) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Sorry, guest checkout is not available.'));
     }
 }
コード例 #4
0
ファイル: Shortcut.php プロジェクト: pradeep-wagento/magento2
 /**
  * Don't display the shortcut button if customer is not logged in and guest mode is not allowed
  *
  * @return bool
  */
 public function skipShortcutForGuest()
 {
     if ($this->customerSession->isLoggedIn()) {
         return false;
     }
     if ($this->checkoutData->isAllowedGuestCheckout($this->checkoutSession->getQuote())) {
         return false;
     }
     return true;
 }
コード例 #5
0
ファイル: Start.php プロジェクト: wirecard/magento2-wcp
 /**
  * Get checkout method
  *
  * @return string
  */
 public function getCheckoutMethod()
 {
     if ($this->_cart->getCustomerSession()->isLoggedIn()) {
         return \Magento\Checkout\Model\Type\Onepage::METHOD_CUSTOMER;
     }
     if (!$this->_cart->getQuote()->getCheckoutMethod()) {
         if ($this->_checkoutData->isAllowedGuestCheckout($this->_cart->getQuote())) {
             $this->_cart->getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_GUEST);
         } else {
             $this->_cart->getQuote()->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER);
         }
     }
     return $this->_cart->getQuote()->getCheckoutMethod();
 }
コード例 #6
0
ファイル: Cart.php プロジェクト: pradeep-wagento/magento2
 /**
  * Check if guest checkout is allowed
  *
  * @return bool
  */
 public function isGuestCheckoutAllowed()
 {
     return $this->checkoutHelper->isAllowedGuestCheckout($this->checkoutSession->getQuote());
 }
コード例 #7
0
ファイル: Login.php プロジェクト: aiesh/magento2
 /**
  * Check if guests checkout is allowed
  *
  * @return bool
  */
 public function isAllowedGuestCheckout()
 {
     return $this->_checkoutData->isAllowedGuestCheckout($this->getQuote());
 }