Rainbow Trade Posted July 2, 2013 Share Posted July 2, 2013 Hi, At the moment when a customer logins on the site they are sent to their account page. Is it possible for them to be sent to the previous page that they were viewing? Thanks, Jon Link to comment Share on other sites More sharing options...
vekia Posted July 2, 2013 Share Posted July 2, 2013 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. // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); //I advise not to change address here, because if a customer has any items in the cart Prestashop will redirect him to the checkout page. And if this will be some other page the customer can get upset. // else : redirection to the account else Tools::redirect('index.php?controller=my-account'); //here you can put the page which seems the most obvious to you. ….. if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) Tools::redirect('index.php?controller=address'); // if registration type is in two steps, we redirect to register address if ($back = Tools::getValue('back')) Tools::redirect($back); //this redirect works only if there is the parameter back Tools::redirect('index.php?controller=my-account'); if (count($this->context->cart->getProducts(true)) > 0) Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping')); // redirection: if cart is not empty : redirection to the cart else Tools::redirect('index.php?controller=my-account'); // else : redirection to the account copied from: http://blog.belvg.com/how-to-redirect-users-to-another-page-after-login-in-prestashop.html author: [moderator action] i changed the topic title to clarify the problem. Link to comment Share on other sites More sharing options...
Rainbow Trade Posted July 2, 2013 Author Share Posted July 2, 2013 Thanks mate, I will give that a go. Link to comment Share on other sites More sharing options...
Recommended Posts