wpa2 Posted August 2, 2013 Share Posted August 2, 2013 (edited) Hi! I have one problem: When customer log on front end and go to product categories and then click log out customers is redirected to index page. I need to log out button redirected directly to login (authorization) page. My default index page also redirects to log in page. Prestashop 1.5.4.1 with modified default theme. Thanks! Edited August 2, 2013 by wpa2 (see edit history) Link to comment Share on other sites More sharing options...
wpa2 Posted August 2, 2013 Author Share Posted August 2, 2013 SOLVED! I change FrontController.php lines [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3]if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned((int)$cookie->id_customer)))[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] {[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] $cookie->logout();[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] }[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] elseif (isset($_GET['mylogout']))[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] {[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] $cookie->mylogout();[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);[/size][/font][/color] [color=#245D98][font=Courier, Tahoma, serif, Simsun][size=3] }[/size][/font][/color] TO if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) { $this->context->customer->logout(); Tools::redirect('index.php?controller=authentication?back=my-account'); } elseif (isset($_GET['mylogout'])) { $this->context->customer->mylogout(); Tools::redirect('index.php?controller=authentication?back=my-account'); 1 Link to comment Share on other sites More sharing options...
inseok Posted October 3, 2013 Share Posted October 3, 2013 perfect. it works thank you. Link to comment Share on other sites More sharing options...
julezstone Posted March 16, 2014 Share Posted March 16, 2014 Hi there, does anybody know how to do this in prestashop version 1.5.6.2? As i cant locate a frontcontroller.php Many Thanks Link to comment Share on other sites More sharing options...
vekia Posted March 16, 2014 Share Posted March 16, 2014 hello this guide is based on 1.5.x engine, it will work in your ps version. file is located herE: classes/controllers/frontController.php Link to comment Share on other sites More sharing options...
julezstone Posted March 17, 2014 Share Posted March 17, 2014 Works 100% Thanks for the file route! Link to comment Share on other sites More sharing options...
nikmagnus Posted April 16, 2014 Share Posted April 16, 2014 Thanks, I really appreciate this. I don't know how i'd manage without you guys posting on the forums. THAAAAAAANKS. Link to comment Share on other sites More sharing options...
DrGren Posted June 17, 2014 Share Posted June 17, 2014 Great work! I had to redirect to an external url after logout and this guide solved it for me. Thank you very much! Link to comment Share on other sites More sharing options...
sancoLgates Posted January 23, 2015 Share Posted January 23, 2015 Great Helpt, thanks Link to comment Share on other sites More sharing options...
YanK Posted March 19, 2015 Share Posted March 19, 2015 (edited) I think override is best. override > classes > controller > FrontController.php <?php class FrontController extends FrontControllerCore { public function init() { if (isset($_GET['logout']) || ($this->context->customer->logged && Customer::isBanned($this->context->customer->id))) { $_SERVER['HTTP_REFERER'] = _PS_BASE_URL_; } elseif (isset($_GET['mylogout'])) { $_SERVER['HTTP_REFERER'] = _PS_BASE_URL_; } parent::init(); } } Edited April 20, 2015 by YanK (see edit history) 1 Link to comment Share on other sites More sharing options...
damian_pm Posted January 31, 2022 Share Posted January 31, 2022 More easy way to redirect is use hook, without override: public function hookActionCustomerLogoutAfter($params) { $back = Tools::getValue('back'); Tools::redirect('index.php?back='.$back); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now