I have a store which is protected behind a login. So when a customer receives a wishlist email from other customer, when the customer clicks on "Add to cart" from email, since the store is protected behind authentication, the items are not being added to cart and after login the cart remains empty.
how to save this url/parameters and do the operation after login(auth).
I am using bubble require login to mandate authentication.
https://github.com/jreinke/magento-require-login
this is actually the code which I tried for capturing the url and trying to do the same operation after authentication using setAfterAuthUrl and setBeforeAuthUrl
code from extension which is doing the auth redirect:
class Bubble_RequireLogin_Model_Customer_Observer
{
public function requireLogin($observer)
{
$helper = Mage::helper('bubble_requirelogin');
$session = Mage::getSingleton('customer/session');
if (!$session->isLoggedIn() && $helper->isLoginRequired()) {
$controllerAction = $observer->getEvent()->getControllerAction();
/* @var $controllerAction Mage_Core_Controller_Front_Action */
$requestString = $controllerAction->getRequest()->getRequestString();
if (!preg_match($helper->getWhitelist(), $requestString)) {
/*$session->setBeforeAuthUrl($requestString); */
$session->setAfterAuthUrl(Mage::helper('core/url')->getCurrentUrl());
$session->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl());
$controllerAction->getResponse()->setRedirect(Mage::getUrl('customer/account/login'));
$controllerAction->getResponse()->sendResponse();
exit;
}
}
}
}