How To Redirect Users To Another Page After Login In Prestashop

The page, where a customer is redirected to after login, is determined by the function processSubmitAccount of the controller AuthController. In case we need to change the function behavior, we would need to rewrite it. It is also possible to use the hook actionCustomerAccountAdd, but this method is good for new customers only.

The function Tools::redirect(), which serves as a certain wrapper for the construction header(‘Location:’.$url); , is specifically responsible for the redirect. In this function it is used 7 times.

So, to redirect a customer to some other page you just need to change the argument of the function Tools::redirect.



6 comments

  1. Hi Alex, thank you for a very nice explanation of the redirect problem in Prestashop.

    I would like to ask about redirection after clicking the SubmitLogin and SubmitGuestAccount buttons (1.5.4.0) in case of errors (e.g. when a customer forgets to fill in a field). Where can this redirection be found? Thank you very much. Jana

  2. So the path where to do that shoud be… yourprestashop/controllers/front/AuthController.php :P

  3. Hi good article!

    But this is to redirect when you create a new account. To change redirections after login the function to search for is called “processSubmitLogin”.

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *