0

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

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.

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.