Jump to content
dellwen!!@@

redirect after login - Prestashop 1.7

Recommended Posts

Hello use 1.7.1.2

I solved this. I spend many time searching but nothing after all I found a answer :lol:

  1. Go to: modules\ps_customersignin\ps_customersignin.php , after line 76
                'my_account_url' => $link->getPageLink('my-account', true),

    I create new url variable

                'login_url' => $link->getPageLink('authentication', true),

     

  2. Go to: themes\yourtheme\modules\ps_customersignin\ps_customersignin.tpl change this:
          <a
            href="{$my_account_url}"
            title="{l s='Log in to your customer account' d='Shop.Theme.Customeraccount'}"
            rel="nofollow"
          >

    for this with new variable
     

          <a
            href="{$login_url}"
            title="{l s='Log in to your customer account' d='Shop.Theme.Customeraccount'}"
            rel="nofollow"
          >

     

  This is all!!

Explanation:
When we are in 'authentication' after login by default redirect to  'base_url'  but when we are in 'my-account' the link have a parameter ...?back=my-account.

I hope that this solution can apply for you.

I only modified a module customersignin. Maybe in next time someone can fin the way to change the parameter in the ?back.

Regards from Colombia.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

after spending few days managed to redirect to address page as soon as new user register.

 

Share this post


Link to post
Share on other sites

Does'nt work. Other real solution ?

Thanks

Share this post


Link to post
Share on other sites
Posted (edited)

In controllers/front/AuthController.php  add this line :

$url = 'your-page-link'; // example 'my-account'
$back = $back ? $back : $url;

After 

$back = urldecode(Tools::getValue('back'));

 

    if ($should_redirect && !$this->ajax) {
            $back = urldecode(Tools::getValue('back'));
            $back = $back ? $back : 'my-account';
            if (Tools::urlBelongsToShop($back)) {
                // Checks to see if "back" is a fully qualified
                // URL that is on OUR domain, with the right protocol
                return $this->redirectWithNotifications($back);
            }
            // Well we're not redirecting to a URL,
            // so...
            if ($this->authRedirection) {
                // We may need to go there if defined
                return $this->redirectWithNotifications($this->authRedirection);
            }
            // go home
            return $this->redirectWithNotifications(__PS_BASE_URI__);
        }

 

Edited by idrissElbasrii (see edit history)

Share this post


Link to post
Share on other sites

check out below thread

https://www.prestashop.com/forums/topic/272089-redirect-to-internal-link/?tab=comments#comment-3049983

 

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

×

Important Information

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