Once a user has added a product to the Shopping Cart , I want to restrict that specific user from shopping further during the particular session. If the user check out and visit again to the Website, he should be able to Shop again but the above rule must be considered.
Is this functionality available in Magento?Can anyone provide a solution for this?
Of course this is possible! Configure an observer for the controller_action_predispatch
event, grab the quote object from the session - if it contains items, set the redirect in your observer method and redirect them to the cart. Example (not tested):
public function restrictToCheckout(Varien_Event_Observer $observer)
{
$items = Mage::getSingleton('checkout/session')->getQuote()->getItemsCount();
if ($items) {
$observer->getControllerAction()->getResponse()
->setRedirect(Mage::getUrl('checkout/cart'));
Mage::throwException('You have items in your cart and must checkout'));
}
}
There may be nuances, but this is the meat of it.