Results 1 to 8 of 8

Thread: How do you setup a personalised thank you page

  1. #1
    New user
    Join Date
    01-19-12.
    Location
    Oss, North-Brabant, The Netherlands, Earth
    Posts
    11

    Default How do you setup a personalised thank you page

    Ok All,

    I want to setup a personalised thank you page by using the data which is submitted through a form. But don't seem te get it done. I've search for a solution but could not find it.

    Is there anyone who has done this, and is eager to help me?

    Thanks in advance!

    Roger
    What's that? That can't be that necessary, I don't recognize it!

  2. #2
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: How do you setup a personalised thank you page

    The simplest way is to install the inputvar extension:
    http://www.contao.org/en/extension-list ... 09.en.html

    Once you do that you can access the posted data via insert tags in the content of your thank you page, i.e.

    {{post::firstname}}
    Brian

  3. #3
    New user
    Join Date
    01-19-12.
    Location
    Oss, North-Brabant, The Netherlands, Earth
    Posts
    11

    Default Re: How do you setup a personalised thank you page

    Hey Brain,

    Thanks for you're post about inputvars.. It will come in handy.
    I have one question though.

    Is there some way to use the form data with some php code, to calculate something and present that to the visitor?
    I tried to read $_POST and $this, but I can't find my data anywhere.

    Do you have a suggestion for me?

    Roger
    What's that? That can't be that necessary, I don't recognize it!

  4. #4
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: How do you setup a personalised thank you page

    Yeah, if you're doing this from a template file or some place where you can write PHP code, you should be able to access them this way:

    Code:
    <?php echo $this->Input->post('foo'); ?>
    Interesting that you can't see the $_POST variables, do you see anything when you do this:

    Code:
    <?php print_r($_POST); ?>
    Where are you placing your PHP code? And is your code on the same page as your thank you page that you defined in the form's redirect settings? It doesn't forward or redirect again from there?

    Also, is your form configured to send via post or via get?

    And is your code inside a Contao object (e.g. a template or some other class that is or extends a Contao class)? That's important only if you want to use $this->Input.
    Brian

  5. #5
    New user
    Join Date
    01-19-12.
    Location
    Oss, North-Brabant, The Netherlands, Earth
    Posts
    11

    Default Re: How do you setup a personalised thank you page

    Where are you placing your PHP code? And is your code on the same page as your thank you page that you defined in the form's redirect settings? It doesn't forward or redirect again from there?
    He Brian,

    Good questions. I think by reading my those I may have found my problem. I will give a full explanation of what I'm trying to achieve.
    I want to give a visitor the possibility to register as a member (front end user) with some extra fields for adding to member groups. On the success page of the registration I want to catch the post vars to calculate a price and give them an iDeal (dutch payment) button for paying for the chosen options.

    Now the answers to your questions...
    My code is now put in the page_template (fe_page) just for testing. And yes, the code is on the redirected page. It doesn't redirect or forward from there.

    Could it be that the post vars are lost before is redirected to my thank you page, maybe because isn't and ordinairy form but a form from the registration module?

    Also, is your form configured to send via post or via get?
    I can't choose this in the settings of the registration module. I have to assume that it's post.

    And is your code inside a Contao object (e.g. a template or some other class that is or extends a Contao class)? That's important only if you want to use $this->Input.
    The code is in fe_page template now. I'm thinking that the registration form isn't the right solution for what I want to accieve. I hope you have some idea's.

    Roger
    What's that? That can't be that necessary, I don't recognize it!

  6. #6
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: How do you setup a personalised thank you page

    Ahh -- I see.

    Yeah it's possible the registration form works differently -- never tried what you're doing.

    Try the "activeAccount" or "createNewUser" hooks:
    http://www.contao.org/en/hooks.html#activateAccount
    http://www.contao.org/en/hooks.html#createNewUser

    Registrations or activations will run through these hooks when they happen. You can intercept the data and do your own processing.

    Let me know if you're not sure how to use hooks.
    Brian

  7. #7
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: How do you setup a personalised thank you page

    Either form will "jump to or reload" after post data has been submitted. That means _POST var data will be dropped. The normal form stores the data in the session var (See $_SESSION['FORM_DATA']), the registration form doesn't.

    You could make the registration module save the data in the session, by adding a save_callback in the dca to each of the fields you'd require. If you require payment before the accounts can be activated, then neither of the two hooks Brian showed will help, if payment is not required to activate you can use either. After the hooks have fired the form will still redirect. That means you must store the data in the session var. The default form uses this code to do that:
    Code:
    // Store all values in the session
    foreach (array_keys($_POST) as $key)
    {
    	$_SESSION['FORM_DATA'][$key] = $this->allowTags ? $this->Input->postHtml($key, true) : $this->Input->post($key, true);
    }
    If you want to cancel activation before payment has been processed you should use the onload_callback because that is the only thing processed before activation happens. This will only apply for iDEAL variations with a secure status request (like Advanced or Professional).

  8. #8
    New user
    Join Date
    01-19-12.
    Location
    Oss, North-Brabant, The Netherlands, Earth
    Posts
    11

    Default Re: How do you setup a personalised thank you page

    He Brain and Ruud,

    Thanks for your help.

    After the registration is complete, the visitor is taken to the thank you page which has to contain some data from the registration form, and id from the user. The thank you page will also contain buttons to payment services like iDeal and PayPal. The visitor chooses a payment method and does the paying. The admin of the site will check regularly and enable the user when the payment is transferred. Maybe in the future this will be changed.

    I've never used hooks or the DCA before, but I think I will try the createNewUser approach first and save the submitted data from the form in the session.

    I'll keep you guys posted.

    Roger
    What's that? That can't be that necessary, I don't recognize it!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •