0
if(isset($quoteId) && $quoteId!="" && is_numeric($quoteId)){
    $quote = Mage::getModel('sales/quote')->load($quoteId);
    Mage::getSingleton('checkout/session')->setQuote($quote);
    Mage::getModel('sales/quote_item')->setQuote($quote);
    $cart = Mage::getSingleton('checkout/cart')->setQuote($quote)->getQuote();
} else {
    $cart = $this->_getCart();
}

if ($cart->getQuote()->getItemsCount()) {
    $cart->init();
    $cart->save();
    if (!$this->_getQuote()->validateMinimumAmount()) {
        $minimumAmount = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
            ->toCurrency(Mage::getStoreConfig('sales/minimum_order/amount'));
        $warning = Mage::getStoreConfig('sales/minimum_order/description')
            ? Mage::getStoreConfig('sales/minimum_order/description')
            : Mage::helper('checkout')->__('Minimum order amount is %s', $minimumAmount);
        $cart->getCheckoutSession()->addNotice($warning);
    }
}
  • Fatal error: Uncaught Error: Call to a member function getItemsCount() on null in Checkout/controllers/CartController.php:28 – Pradeep Rai Jun 5 '18 at 7:04
0

Try the below code this works for me:

$quote = Mage::getModel('sales/quote')->load($quoteId);
         $quote->setIsActive(true)->save();

Hope this helps!

  • Fatal error: Uncaught Error: Call to a member function getItemsCount() – Pradeep Rai Jun 5 '18 at 8:07
  • You have use getQuote() on $cart and also $cart->getQuote()->getItemsCount(). Remove the getQuote() from second line. – Sukumar Gorai Jun 5 '18 at 8:58
  • if(isset($quoteId) && $quoteId!="" && is_numeric($quoteId)){ $quote = Mage::getModel('sales/quote')->load($quoteId); $quote->setIsActive(true)->save(); $cart = $this->_getCart(); } else{ $cart = $this->_getCart(); } if ($cart->getQuote()->getItemsCount()) { } – Pradeep Rai Jun 5 '18 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.