Jump to content

Changing destination after login.


Mike O'Hara
 Share

Recommended Posts

Prestashop newb here.

 

I would like to have things so that when a user logs into the store, instead of directing to their My account page, I want them to drop back into the products, or another page.

 

Is there a module for that, or how can I make that modification?

Share this post


Link to post
Share on other sites

  • 2 years later...

sorry for not explain.

 

 

open authentication.tpl

 

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

 

change it to:

 

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

 

 

you will be back there, where you was before click on "login" button :)

Share this post


Link to post
Share on other sites

hmmm, well I followed your instructions but it still takes me to the My Account page

 

Here is what I have currently in that portion of the authentication.tpl file:

 

 

<div class="form_content clearfix">
                <p class="text">
                    <label for="email">{l s='Email address'}</label>
                    <span><input type="text" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email|stripslashes}{/if}" class="account_input" /></span>
                </p>
                <p class="text">
                    <label for="passwd">{l s='Password'}</label>
                    <span><input type="password" id="passwd" name="passwd" value="{if isset($smarty.post.passwd)}{$smarty.post.passwd|stripslashes}{/if}" class="account_input" /></span>
                </p>
                <p class="lost_password"><a href="{$link->getPageLink('password')|escape:'html'}" title="{l s='Recover your forgotten password'}" rel="nofollow">{l s='Forgot your password?'}</a></p>
                <p class="submit">
                    {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$smarty.server.HTTP_REFERER|escape:'htmlall':'UTF-8'}" />{/if}
                    <input type="submit" id="SubmitLogin" name="SubmitLogin" class="button" value="{l s='Welcome Back!'}" />
                </p>
            </div>

 

Thanks for looking at this.

 

Brian

Share this post


Link to post
Share on other sites

Hi surferboy,

 

You may need to (TEMPORARILY!!): 

- turn OFF your cache and

- 'Template cache' set to "Recompile templates if the files have been updated"

 

in Advanced Parameters->Performance

to see the changes.

(Don't forget to turn cache back ON afterwards!)

 

pascal

Share this post


Link to post
Share on other sites

After looking carefully at the code you provided and that I had pasted.  It essentially says return to the page from which the login request was made.

 

Okay, that makes it easier for me to comprehend. 

 

I tried logging in at several different pages and I was delighted to see that yes, I was returned to the page where I had activated the login.  I was confused because initially I was logging in FROM the login page itself, so it was returning to that same login page, which upon successful authentication, takes you to My Account.

 

So for others reading this and saying huh?, here is a good example: with @PascalIVG's code, I can visit an individual product page, and click the login.  Once the authentication is completed, I now return to that individual product page, but now logged in.

 

Hope that makes sense to folks.

 

Thank you Pascal.

 

Brian

Share this post


Link to post
Share on other sites

Hi Brian,

Just to put credit where credit belongs, I think it was Vekia who provided the code, not me :-)

 

Thanks Vekia!

pascal

 

N.B. The tpl file will not be overwritten as it is (please double check one more time) it's in your theme's folder.

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More