Redirecting to the last page after customer login magento

On a current project, I had a requirement to redirect to the homepage once a user successfully logs in to their account. I tried a few plugins to no avail, so had a go doing it myself. Obviously Magento by default, redirects to the customers Account page although there is a setting in the admin to turn this off. However, this resorts back to redirecting the user to the previous page, ie the referred page.

You should set to “NO on “System > Configuration > Customers > Customer Configuration > Login Options” and in yours “login.phtml” files (both, “persistent/customer/form” and “customer/form” on your template folder) you must change the action of your to:

    action="<?php echo str_replace('login', 'loginPost', $this->helper('customer')->getLoginUrl()) ?>"

 

Revisions

No comments yet.

Leave a Reply