Jump to content

Reload CMS page with aditional POST parameters


cin

Recommended Posts

Hi, I have a problem I can't solve myself and I would appreciate some help.

 

Situation: I needed to add form with POST method to CMS page. I created custom hook and a module displaying the form successfuly. Then I need to react to user input errors eg. when he doesn't enter email address I need to detect it, display the whole page again with the form and with errors in user input clearly stated.

 

Problem: The problem is to display the WHOLE page again with connected information (eg. about errors etc.). In module PHP file when I add this kind of code,

return $this->display(__FILE__, 'modulename.tpl');

I (naturally) display ONLY the form, not the whole CMS page with the form.

In case of this code,

Tools::redirectLink('cms.php?id_cms=7');

I can't get to transfer any information by GET neither POST method.

$_POST['test'] = 1;
Tools::redirectLink('cms.php?id_cms=7&test');

I tried to assign to smarty variables too

$smarty->assign('test', '1');

(I need to use it in .tpl file where the form itself is created) but no way to get it work.

{if isset($test)}...,
{if isset($smarty.post.test)}...,
{if isset($_POST['test'])}...

Even assigning a GET parameter to url has no impact, because there is link rewriting to some kind of friendly url I guess, no matter I included other argument or not. (cms.php?id_cms=7&test -> content/7-cmspage-name)

 

So my question is: is there a way to "redirect" or "reload" current page (or any page generally) in prestashop together with my own data included?

 

I kind of explained the whole case so I'm open to hear a better overal solution than my (maybe I'm thinking about the case in a wrong way at all).

 

Thanks for sharing your knowledge/opinion in advance.

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...