Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
498 views
in Technique[技术] by (71.8m points)

Prestashop redirection after registration

I made a CustomerRedirection Module which is very simple. Whenever a user register I want him to be redirected to a template named validation which is just a page saying Successfully registered.

The validation page is located at 127.0.0.1/content/6-validation

Here is the code :

public function hookActionCustomerAccountAdd()
{
    Tools::redirectLink(__PS_BASE_URI__.'content/6-validation');
}

After the registration I'm redirect to the registration page once again.

question from:https://stackoverflow.com/questions/65886083/prestashop-redirection-after-registration

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Tools::redirectLink is expecting a path already containing PS_BASE_URI

I usually prefer using Tools::redirect instead, that can parse both external and internal URLs.

So you can either use :

Tools::redirect('https://full-url-here')

or

Tools::redirect('index.php?id_cms=6&controller=cms'); 

That will redirect to the same controller in a non-rewrited fashion.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...