Page 1 of 1

Redirect to product or previous page after login

Posted: Tue Jul 24, 2012 11:26 pm
by RichMo
Hi,

I would like to be able to redirect my customer back to the page they were viewing when they clicked 'login'. For example, if they are viewing a product, or any other page on my website.

I have ubercheckout mod installed which does redirect the login to its own pages. I was thinking of changing the vqmod file for this so that it can capture a $_GET[] variable, but its not working. I think perhaps it is not picking up the $_GET value.

I changed the xml code that modifies catalog/controller/checkout/checkout.php

Code: Select all

// Uber checkout redirect
			if ($this->config->get('uber_checkout_status')) {
				if ($this->request->get['redir'] != "") {
					$url = "http://www.example.com/".$this->request->get['redir']."?p=".$this->request->get['p'];
					$this->redirect($url);
					} else {
						$this->redirect(HTTPS_SERVER . 'index.php?route=checkout/checkout_two');
					}
				}
I suppose I can not read the GET this way right? How might I do this?

Re: Redirect to product or previous page after login

Posted: Sun Mar 20, 2022 1:51 am
by boxaltcoin
You would need to edit catalog/controller/account/login.php

find for this

Code: Select all

if ($this->customer->isLogged()) {
        $this->response->redirect($this->url->link('account/account', '', true));
    }
and replace it by

Code: Select all

 if ($this->customer->isLogged()) {  
     $this->response->redirect($this->url->link('account/account', '', 'ture'));
}elseif(!isset($this->session->data['redirect']) && isset($_SERVER['HTTP_REFERER'])){
$this->session->data['redirect'] = $_SERVER['HTTP_REFERER'];
}
Hope this might help You

Re: Redirect to product or previous page after login

Posted: Sun Mar 20, 2022 3:34 am
by straightlight
boxaltcoin wrote:
Sun Mar 20, 2022 1:51 am
You would need to edit catalog/controller/account/login.php

find for this

Code: Select all

if ($this->customer->isLogged()) {
        $this->response->redirect($this->url->link('account/account', '', true));
    }
and replace it by

Code: Select all

 if ($this->customer->isLogged()) {  
     $this->response->redirect($this->url->link('account/account', '', 'ture'));
}elseif(!isset($this->session->data['redirect']) && isset($_SERVER['HTTP_REFERER'])){
$this->session->data['redirect'] = $_SERVER['HTTP_REFERER'];
}
Hope this might help You
viewtopic.php?f=20&t=86758#p839642