3

Is there a simple way to sovel redirect url customize in Magento?

I'v searched some articles mentions "controller".

But I have no idea about custom extensions.

How to override the base controller action with a extension?

13

Just change the option:

System > Config > Customer 
> Costumer Redirect Customer to Account Dashboard after Logging in > NO
  • hi @Fabian what we have to do redirect from customer register to shopping cart/previous page? – Baby in Magento May 28 '15 at 11:33
  • 1
    As I said in the answer, change the option to no, so you should be redirected to the page before the login form. – Fabian Blechschmidt May 29 '15 at 5:38
  • 1
    in magento 2 Stores > Configuration > Customers > Customer Configuration > Login Options – Xenocide8998 Nov 4 '16 at 4:18
  • But it's not working sir @FabianBlechschmidt – Amaresh Tiwari Jan 30 '17 at 6:42
  • @AmareshTiwari If it is no magentos default behaviour is to redirect you to the page you came from or (if the form contained another page with a parameter I don't know currently) to a page defined in the form. So check the form, the request and if this doesn'T help, xdebug is your friend. – Fabian Blechschmidt Jan 30 '17 at 10:58
3

Do not change core/ code. Use the following free extension: http://www.magentocommerce.com/magento-connect/customer-redirect-after-login-1.html

Take a look at this answer for more details on how to do it yourself: https://stackoverflow.com/a/16099279/3403171

1

You can also use the

For Magento1.9.* as a $this->_redirectReferer();.

0

For this the config setting should be -> System -> Configuration -> CUSTOMERS -> Customer Configuration -> Login Options Set: Redirect Customers to Account Dashboard after Log in = No.

But there is some more work for this to do. For this you dont need to change anything in any class.

Just add below codes in you login form phtml within <form> tag.

<?php if (!Mage::getStoreConfigFlag(
        Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
    )) { ?>
    <input name="referer" type="hidden" value="<?php echo Mage::helper('core')->urlEncode(Mage::getBaseUrl()); ?>" />
<?php } ?>

Example of a login form,

<form action="<?php echo $this->getPostActionUrl() ?>" method="post">
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
<?php if (!Mage::getStoreConfigFlag(
        Mage_Customer_Helper_Data::XML_PATH_CUSTOMER_STARTUP_REDIRECT_TO_DASHBOARD
    )) { ?>
    <input name="referer" type="hidden" value="<?php echo Mage::helper('core')->urlEncode(Mage::getBaseUrl()); ?>" />
<?php } ?>
<div class="block-content">
    <label for="mini-login"><?php echo $this->__('Email address:') ?></label><input type="text" name="login[username]" id="mini-login" class="input-text" />
    <label for="mini-password"><?php echo $this->__('Password:') ?></label><input type="password" name="login[password]" id="mini-password" class="input-text" />
    <div class="mini-actions">
        <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
        <button type="submit" class="button"><span><span><?php echo $this->__('Log in') ?></span></span></button>
    </div>
</div>

Hope it helps!! Please upvote and accept it if helps..!!

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.