Is there a simple/easy way to redirect the 'add to cart' button/action to the account login screen/page when a customer is not loged in. This to prevent not registered or not loged in customers to fill the shopping cart? I don't want to hide the 'add to cart' button.
1 Answer
Add this code to the top of the function: Mage_Checkout_CartController::indexAction()
$customerSession = Mage::getSingleton('customer/session');
if (!$customerSession->isLoggedIn()) {
$this->_redirect('customer/account/login');
return $this;
}
Of course you will need to extend the core class using the standard Magento practice for extending core functionality.