Magento Expert Forum - Improve your Magento experience

Results 1 to 2 of 2

How can I redirect to particular page after login in checkout process?

  1. #1
    New member Kishore's Avatar
    Join Date
    Dec 2015
    Thanked 0 Times in 0 Posts

    Question How can I redirect to particular page after login in checkout process?

    I have two themes e.g. mobile and desktop.
    For mobile theme I have separated the first step of the checkout process i.e. Login step to different page.
    page no.1-from basket page a person goto the login page(login or checkout as guest option).
    page no.2-The next step is to calculate delivery method and delivery options in a page.
    page no.3-Then the payment method page and finally the checkout process.

    So I want when a person go to the page no. 1 (i.e. login page) and give the email and password and click the login button , then the person will redirected to the page no.2(delivery method and options).

    But it Redirects to the account dashboard page.
    Below is the code for the login and redirect which is located at .. core/Mage/Customer/controller/AccountContorller.php

    public function loginPostAction()
    if ($this->_getSession()->isLoggedIn()) {
    $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 = Mage::helper('customer')->getEmailConfirmationUrl($login['username']);
    $message = Mage::helper('customer')->__('This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value);
    case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EM AIL_OR_PASSWORD:
    $message = $e->getMessage();
    $message = $e->getMessage();
    } 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.'));


    * Define target URL and redirect customer after logging in
    protected 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()) {echo "gone";exit;
    if (!Mage::getStoreConfigFlag(
    )) {
    $referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY _PARAM_NAME);
    if ($referer) {
    // Rebuild referer URL to handle the case when SID was changed
    $referer = Mage::getModel('core/url')
    if ($this->_isUrlInternal($referer)) {
    } else if ($session->getAfterAuthUrl()) {
    } else {echo "go";exit;
    } else if ($session->getBeforeAuthUrl() == Mage::helper('customer')->getLogoutUrl()) {
    } else {
    if (!$session->getAfterAuthUrl()) {
    if ($session->isLoggedIn()) {


    How can I change the redirection to a particular page after login step for mobile theme only ?
    Is it possible to redirect to different url for different theme in a single store from the same method ?
    Is it required to override the customer module ?

    View more threads in the same category:

  2. #2
    Junior Member
    Join Date
    Sep 2018
    Oman, Muscat
    Thanked 4 Times in 4 Posts


    Through redirection you can actually divert your user after submitting form to land to particular page of your choice in order to perform certain actions.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts