Jump to content

Redirect to same page after login (no previous page)


seog

Recommended Posts

Hello friends
 
I read much solutions to redirect after login to contact page, index, cms, previous page but I need redirect to same page.
 
Example:
 
If customer is in product page then after log in I need that customers back to same product page. (no previous page)
If customer is in category page then after log in I need that customers back to same category page. (no previous page).
 
The login in my web is a dropdown localized in displaynav (in all pages of my web)
 
I know that code to modify is in AuthController.php around line 337:
Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : $back));

Best regards

PS 1.6.1.1

Edited by seog (see edit history)
Link to comment
Share on other sites

Hello vekia

 

I tried with Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : $_SERVER['HTTP_REFERER']));  but the url redirect to error page after of login.

 

Also tried in blockmyaccountpremiun changing this code:

{if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'html':'UTF-8'}" />{/if}

to:

<input type="hidden" class="hidden" name="back" value="{$smarty.server.HTTP_REFERER}" />

but if I am in product page then after the redirection is to previous visited page (category)

 

I understand that "Referer" is previous page and I try back to same page

 

Thank you very much for your contribution

BR

Edited by seog (see edit history)
Link to comment
Share on other sites

  • 11 months later...

Hello,

i guess i have similar problem..

What i want to achieve is redirect (not logged user) to the page he was directed to (eg. using link to the specific product page from a newsletter)?

 

To be more specific:

I have a web store, which not logged users can not browse.

My goal is, that all (registered) customers, who subscribe to newsletter, would be able to be redirected to the specific products they have clicked in the newsletter.

At the moment (while i'm not logged in) when i open a newsletter and click on a link to the product, it directs me to the login page. After being logged in, i'm redirected to the last visited page. What to do, to be redirected to the product page i've clicked before log in?

 

Any help would be appreciated...

 

 

you have to replace back param with referer url

$_SERVER['HTTP_REFERER'];
Link to comment
Share on other sites

  • 3 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...