1

I am new in magento.How can we check whether Guest User or Registered user buy any thing on current session of browser using programatically ? I want to make one analysis form based on that check . So please help me out. Any suggestion will guide me to my journey.

1

You can use the quote object for that. It has a method that returns the number of items in the quote (or cart).

echo Mage::getModel('checkout/cart')->getQuote()->getItemsCount(); // number of items in cart
2
  • What happen if user add to cart product but did not check out ? Feb 24 '14 at 4:06
  • As long as the cart is in the session it will display the right count. When the session no longer exists the count to will be 0
    – Sander Mangel
    Feb 24 '14 at 12:08

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.