Example #1
0
 /**
  * Reinitialize cart quote state
  *
  * @return $this
  */
 protected function reinitializeState()
 {
     $quote = $this->getQuote()->setCheckoutMethod('');
     $this->_checkoutSession->setCartWasUpdated(true);
     // TODO: Move this logic to Multishipping module as plug-in.
     // reset for multiple address checkout
     if ($this->_checkoutSession->getCheckoutState() !== Session::CHECKOUT_STATE_BEGIN && $this->_checkoutSession->getCheckoutState() !== null) {
         $quote->removeAllAddresses()->removePayment();
         $this->_checkoutSession->resetCheckout();
     }
     return $this;
 }
Example #2
0
 /**
  * Initialize cart quote state to be able use it on cart page
  *
  * @return $this
  */
 public function init()
 {
     $quote = $this->getQuote()->setCheckoutMethod('');
     if ($this->_checkoutSession->getCheckoutState() !== Session::CHECKOUT_STATE_BEGIN) {
         $quote->removeAllAddresses()->removePayment();
         $this->_checkoutSession->resetCheckout();
     }
     if (!$quote->hasItems()) {
         $quote->getShippingAddress()->setCollectShippingRates(false)->removeAllShippingRates();
     }
     return $this;
 }