Jump to content

Tools:redirect or Tools:redirectLink not working as expected


Recommended Posts

Hello everyone! I'm a little bit burnedout today so i thought that asking the community was a good idea.

So, i'm having some trouble when trying to redirect the user after registration.

I'm using the hook 'actionCustomerAccountAdd' to do some stuff like generating email verification tokens and sending the emails. After all that processing i'm generating a link to a Custom  FrontController:

$registrationRedirectUrl = $this->context->link->getModuleLink($this->name, 'Registration');

which results in:

http://127.0.0.1/prestashop/es/module/<module_name>/Registration

Now, i have verified that the link is correct as it displays the custom template i've made for this.

After this i just call(last line of the hook's function code):

Tools::redirect($registrationRedirectUrl);

When i register a new user everything works okey but when the time comes to redirect it just goes to 127.0.0.1(no, not to 127.0.0.1/prestashop).

I've searched but couldn't find anything that pointed me to the solution. I've tried using Tools:redirectLink() with the same result.

Any help would be greatly appreciated!!

Link to comment
Share on other sites

1 hour ago, Amantha Bill said:

Try this:

Tools::redirect('$registrationRedirectUrl');

But in my module, I am using differently (for example):

Tools::redirectLink('https://domain.com/connexion?create_account=1');

 

Hey, thank you for the reply!

I'm afraid it didn't worked in my case, i'm starting to think is has somthing to do with my Apache's config but i don't know.

Anyway, again, thanks!

Link to comment
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
×
×
  • Create New...