6

When I'm logging that time it redirects to the homepage but I don't want this.

I want to redirect that page in My account dashboard page.

In configuration System > Config > Customer > Customer Configuration > Login option > Redirect Customer to Account Dashboard after Logging is set as Yes. It is set to yes on all scopes

I don't know why this redirect to the homepage.

How to redirect page to my account.

How can I do this?

  • 1
    Make sure it is set to Yes on all scopes – Sander Mangel Dec 10 '15 at 12:01
  • yes it is set to yes on all scopes – Newbie Dec 10 '15 at 12:06
  • Did you clean the cache? – David Lambauer Nov 23 '17 at 7:50
3

You have to rewrite in local loginPostAction() from app/code/core/Mage/Customer/controllers/AccountController.php to app/code/local/Customer/controllers/AccountController.php Then you put this :

 public function loginPostAction(){

    if (!$this->_validateFormKey()) {
        $this->_redirect('*/*/');
        return;
    }

    if ($this->_getSession()->isLoggedIn()) {
        $this->_redirect('wlc_business');
        return;
    }
    $session = $this->_getSession();

    if ($this->getRequest()->isPost()) {
        $login = $this->getRequest()->getPost('login');
        if (!empty($login['username']) && !empty($login['password'])) {
            try {
                $session->login($login['username'], $login['password']);
                if ($session->getCustomer()->getIsJustConfirmed()) {
                    $this->_welcomeCustomer($session->getCustomer(), true);
                }
            } catch (Mage_Core_Exception $e) {
                switch ($e->getCode()) {
                    case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED:
                        $value = $this->_getHelper('customer')->getEmailConfirmationUrl($login['username']);
                        $message = $this->_getHelper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
                        break;
                    case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD:
                        $message = $e->getMessage();
                        break;
                    default:
                        $message = $e->getMessage();
                }
                $session->addError($message);
                $session->setUsername($login['username']);
            } catch (Exception $e) {
                // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
            }
        } else {
            $session->addError($this->__('Login and password are required.'));
        }
    }

    // The adding code here
    $this->_redirectReferer(); //redirect you to the previous page
    $this->_redirect('/'); // redirect you to the home page
    $this->_redirect('wishlist'); //redirect you to wishlist page for exemple
}
0

You can configure that in System > Configuration > Customer > Customer Configuration > Login options > Redirect Customer to Account Dashboard after Logging in = Yes

  • it is set as yes but its not redirect to dashboard – Newbie Dec 10 '15 at 12:08
0

use this code :

<?php echo $this->getUrl('customer/account/login').'referer/'.$urlencode->encode($this->getUrl('/customer/account/')); ?>

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.