Sending form data to Post Affiliate Pro using post method.

  • customlogoshop
    Asked on July 19, 2016 at 2:11 PM

    Hello

    I am trying to integrate jotform with post affiliate pro. Here is the guide to set it up to track sales on my thank you page which currently is https://www.customlogoshop.com/order-confirmation 

     

    Here is there guide http://addons.qualityunit.com/integration-methods/_ijotform/?_ga=1.259304650.1362644497.1468951599

     

    I have enabled post form data from https://www.customlogoshop.com/order-test-checkout

    It goes from https://www.customlogoshop.com/order-test > order-test-checkout > order-confirmation (thank you page)

     

    Here is the code I tried using which is pasted into confirmation page

     

    <?php /********* Post Affiliate Pro integration snippet *******/ if (isset($_POST['orderid'])) { ?> <script type="text/javascript"> document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" + (("https:" == document.location.protocol) ? "https://" : "http://") + "customlogoshop.postaffiliatepro.com/scripts/j13l9o%27 type=%27text/javascript%27%3E%3C/script%3E")); </script> <script type="text/javascript"> PostAffTracker.setAccountId('default1'); var sale = PostAffTracker.createSale(); sale.setTotalCost('<?php echo $_POST['input50[2]']; ?>'); sale.setOrderID('<?php echo $_POST['orderid']; ?>'); sale.setProductID('<?php echo $_POST['formID']; ?>'); PostAffTracker.register(); </script> <?php } /******** Post Affiliate Pro integration snippet *******/ ?>



    and when I inspect my form after I have submitted the form here's what appears:

    script type="text/javascript">
      document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" +
      (("https:" == document.location.protocol) ? "https://" : "http://") +
      "customlogoshop.postaffiliatepro.com/scripts/j13l9o%27 type=%27text/javascript%27%3E%3C/script%3E"));
      </script>
      <script type="text/javascript">
      PostAffTracker.setAccountId('default1');
       
      var sale = PostAffTracker.createSale();
      sale.setTotalCost('<br />
      <b>Notice</b>: Undefined index: input50[2] in <b>/home/cls/public_html/order-confirmation.php</b> on line <b>61</b><br />
      ');
      sale.setOrderID('4');
      sale.setProductID('61984738873374');
      PostAffTracker.register();
      </script>
       

    Could really use some help to what is going on as I have no idea

    Thanks!

  • Kiran Support Team Lead
    Replied on July 19, 2016 at 3:09 PM

    I have cloned your JotForm and tried submitting the form. I see that the page is redirected to the following URL with the values posted correctly. 

    https://www.customlogoshop.com/order-checkout-test?input50[price]=124&input49=Total:%20%C2%A3124.00%20GBP

    Sending form data to Post Affiliate Pro using post method Screenshot 20

    From the code that you have provided, I see that you are calling a variable orderid which is not found in the form. Could you try redirecting the Thank you page to http://www.jotform.com/show-post-data/ to see what variables that you want to pass to the other page?

    Please check and let us know if you need any further assistance. We will be happy to assist. 

  • customlogoshop
    Replied on July 19, 2016 at 3:17 PM
    PHP Code:
    $_POST['submission_id'];
    $_POST['formID'];
    $_POST['ip'];
    $_POST['input49'];
    $_POST['input50']['0'];$_POST['input50']['1'];$_POST['input50']['2'];$_POST['input50']['3'];$_POST['input50']['4'];$_POST['input50']['5'];$_POST['input50']['6'];
    $_POST['orderid'];

    Im confused as it does say orderid?

    Am I adding it to PHP wrong? Please give me an example of how the php should inset the variables
  • Welvin Support Team Lead
    Replied on July 19, 2016 at 4:46 PM

    There is the Order ID in this form: http://www.jotformeu.com/form/61984738873374. It is a unique ID widget.

    I think you're doing it wrong. 

    Form 1 https://www.customlogoshop.com/order-checkout-test.

    Form 2 is redirected to https://www.customlogoshop.com/order-confirmation.

    Send Post Data is enabled in two forms. The redirection is correct as far as I could see. However, it seems that your page stripped off the scripts causing the integration to fail. Can you take a screenshot of the entire tracking scripts in your page, this while editing? We need to know if you have the correct tags. 

    Another thing, if you're getting the variables from form 2, you need to use the variables that are generated by the post data. 

    enteryour = Must be the full name in the payment fields so, ['input50']['1'] and ['input50']['2']

    enteryour4 = You do not have an email field in your form. You may consider adding one.

    selectyour = [input49] which is the calculation field or [orderid] which is the unique ID widget. 

     

    I hope that helps. Let us know if you need any further assistance.

  • customlogoshop
    Replied on July 19, 2016 at 5:13 PM

    It now works I got the code right finally :) 

    How can I pass over the email from form 1 to 2 but without displaying it in a field? just may look a bit odd having it on the form again

  • customlogoshop
    Replied on July 19, 2016 at 5:20 PM

    Also, when the user fills in part 1 but not part 2 (the checkout stage), how can I setup a notfication so they can carry it on from where they left off? so all their form data is saved and they can resume and hopefully then checkout? 

    Thanks!

  • Chriistian Jotform Support
    Replied on July 19, 2016 at 9:48 PM

    I am glad to know that it is now working. You can add an email field in Form 2, and pass the email there. Set it to Hidden so that it is not visible to the user. I checked your form 2 and it appears that you have already added a hidden email field.

    Sending form data to Post Affiliate Pro using post method Screenshot 20

    To better assist you, your other question has been moved to a new thread. Please follow this link to view it: https://www.jotform.com/answers/886451. Regards.