Sunday, January 6, 2013

Redirect back to page after logged-in in Magento

If you need to go back to same page once it logged in ,
that is
your in list page and clicked to sign in link and then you logged in it has to go back to list page its self

Magento has default setting for not to redirect account page if you logged in from default page by defult it will redirect to account dash board

but you need to go page to list page
for that follow the below steps
Open header.phtml add this code at top of the file
 if(!Mage::helper('customer')->isLoggedIn()) {
 $check=strstr($loginback, 'customer/account/login');

override app\\code\\core\\Mage\\Customer\\controllers\\AccountController.php to you local or custom module and add this function
 public function _loginPostRedirect()
        $session = $this->_getSession();

        if (!$session->getBeforeAuthUrl() || $session->getBeforeAuthUrl() == Mage::getBaseUrl()) {

            // Set default URL to redirect customer to
            // Redirect customer to the last page visited after logging in
            if ($session->isLoggedIn()) {
                if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) {
                    $referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME);
                    if ($referer) {
                        $referer = Mage::helper('core')->urlDecode($referer);
                        if ($this->_isUrlInternal($referer)) {
                } else if ($session->getAfterAuthUrl()) {
                } else if (strlen($backUrlcustom)) {
            } else {
        } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
        } else {
            if (!$session->getAfterAuthUrl()) {
            if ($session->isLoggedIn()) {

or check it this post

No comments:

Post a Comment