Capturing 1ShoppingCart.com POST variables on Thank You Page

13 replies
Hello!

I am helping a friend set up a wordpress site and we're sending successful orders back to a "thank you" page on our local domain.

I know that 1ShoppingCart.com sends the order variables, (name, product name, etc) via POST method.

What is the easiest way for me to capture this POST data on the thank you page in order to customize it to personally thank the buyer?

IE: Thank you "PAUL" for ordering "PRODUCT NAME". It will be delivered to "BUYER ADDRESS" in approximately 5 business days.

I would also use this information on the autoresponder thank you page to say: Thank you "PAUL" for subscribing!

Any help (or online instructions) for completing this in wordpress would be very much appreciated!

Thanks in advance for all your help.

Paul
#1shoppingcartcom #capturing #page #post #variables
  • Profile picture of the author jimbo999
    Ok... here is a super easy way to capture the data to a text file. Add this to the top of your "thank you" page. This will capture all variables that are POST data, the time, and the IP address and writes them to a file called orders.txt

    <?php
    $stream = "";
    foreach($_POST as $key => $val){
    $stream = $stream."$key - $val \n";
    }
    $stream = $stream.date(DATE_RFC822)."\n".$_SERVER['REMOTE_HOST']."\n";
    file_put_contents("orders.txt", $stream, FILE_APPEND);
    ?>

    Can't show you how to customize the page without knowing what the variable names are that they are passing back.

    PS. You'll need the php-exec plugin to execute PHP on WP posts or pages. Search google and you'll find it easily.
    {{ DiscussionBoard.errors[1447533].message }}
    • Profile picture of the author thekeetch
      Originally Posted by jimbo999 View Post

      Can't show you how to customize the page without knowing what the variable names are that they are passing back.
      Thanks for this - I've installed exec-php, and tested that it is working. I obviously don't want the info written to a file, I want to include it in the page contents.

      I'm confirming with 1SC what the variable names are, but would the following work, in theory, if the "name" field was called 'name' and the "email" field called 'email'?

      Thanks for subscribing <?php echo $_POST["name"]; ?>! Your address <?php echo $_POST["email"]; ?> has been successfully added to our database.

      Thanks for all your help - I *really* appreciate it!

      Paul
      Signature

      Marketing Strategy Map + 10-Minute Tutorial Video. The best, most essential marketing strategy training you need. Grab it >> FREE << now!

      {{ DiscussionBoard.errors[1452423].message }}
  • Profile picture of the author dilqncho
    If you need this site as a shopping cart contact me on Skype and I can give you this website From there you can drawing source code :p. If you need course

    Good day!

    Sorry for bad English
    {{ DiscussionBoard.errors[1447717].message }}
  • Profile picture of the author jimbo999
    Paul.. your test code should work! Looks good to me.
    BTW: in "orders.txt" you can see what all of the POST variables are without talking to 1SC. The format is:
    VARIABLE - DATA
    VARIABLE - DATA

    You are on the right track my friend, glad I could help.
    {{ DiscussionBoard.errors[1452884].message }}
  • Profile picture of the author m4rx
    They most likely only pass on variables that would be usable for everyone.

    Im sure they keep some to themselves just for security.
    But you shouldn't have to do anything to your thank you URL, as all the variables passed should be available just by calling them with $_POST.
    And if you don't know all of them, forget writing them to a file, just do print_r($_POST) and you can see them.
    Unless it is on a production page ;]

    People don't need to see those.

    --m4rx
    Signature
    We are what we repeatedly do. Excellence, then, is not an act, but a HABIT. ~Aristotle
    Bored. Learn everything you need to know about Organic Gardening.
    {{ DiscussionBoard.errors[1732495].message }}
  • Profile picture of the author dhudiburg
    Thanks m4rx. I'll give it a test and see what happens. Unfortunately it is a production page, so I can't do the print thing, but I know how I can test for one of the variables.
    {{ DiscussionBoard.errors[1732554].message }}
    • Profile picture of the author Kev Roberts
      Found this post and thought others might be interested in the complete list of 1SC post variables to the Thank You Page below.

      Sadly they don't seem include the Client ID...

      Kev

      address1 First line of billing address (required).
      address2 Second line of billing address
      cardtype Type of credit card used for transaction
      city Billing address city (required).
      company Billing address company
      country Billing address country (required).
      email1 Email of customer purchasing the product (required).
      fax Fax number of customer
      grandTotal Total including product, shipping, and tax
      gst Country tax
      secondaryphone Home phone number of customer
      name Name listed in billing address (required).
      option1 The first option (option) for the first product (1). This variable would be referenced with option2 for the second product and so on.
      option11 The second option (option1) for the first product (1). This variable would be referenced with option12 for the second product and so on.
      option21 The third option (option2) for the first product (1). This variable would be referenced with option22 for the second product and so on.
      orderID Order number
      price1 Price (price) of first item (1) in cart. The price of the second item would be referenced using the variable price2 and so on.
      product1 The description (product) of the first product (1) in cart. The description of the second item would be referenced using the variable product2 and so on.
      quantity1 The quantity (quantity) ordered of the first product (1) in cart. The quantity ordered of the second item would be referenced using the variable quantity2 and so on.
      shipAddress1 The first line of the ship to address.
      shipAddress2 The second line of the ship to address.
      shipCity The city listed in the ship to address.
      shipCountry The country listed in the ship to address.
      shipname The name listed in the ship to address.
      shippingAmount The dollar amount of shipping for the order.
      shippingMethod The method of shipping selected.
      shipState The state listed in the ship to address.
      shipZip The zip code listed in the ship to address.
      sku1 The user defined SKU (sku) of the first product (1) in cart. The SKU of the second item would be referenced using the variable sku2 and so on.
      state The State listed in the billing address information (required).
      status The status of the order (Approved, Declined, Unknown, Offline) as well as accompanying transaction information such as Approval or Declined codes.
      tax Total State Tax for the order
      Total Subtotal for the order (before taxes and shipping)
      UserName1 The value entered for the first (1) custom/user defined (UserName) field. This is setup using custom fields and displaying them on the order form. Additional user fields can be referenced using the variable UserName along with the number of the custom field (1-10) (required if defined as such).
      phone Work (day) phone number of customer (required).
      zip Zip code listed on billing address (required).
      {{ DiscussionBoard.errors[2553454].message }}
      • Profile picture of the author DaveLindberg
        This is a great thread, addressing an issue I've been working on for a while.

        I've added Jimbo999's code to our custom thank you page (in Wordpress) as a test; it runs and generates the file orders.txt, but no variables are being passed -- the file only contains its creation date:

        Tue, 12 Oct 10 17:00:46 +0000

        I've run the tests for Exec-PHP and confirmed the plugin is operating correctly.

        Any thoughts on what I'm missing here?
        {{ DiscussionBoard.errors[2716227].message }}
        • Profile picture of the author WPC-advisor
          Thanks for a very useful thread.
          I did notice that 1SC claims to be using a separate set of variables for a 'single order' page (thankyou.aspx) than it uses for a "multiple orders" confirmation page (thanks.aspx). You can find these by going to the 1SC online user guide and looking under 'integrations.'

          I am currently doing the same thing that 'the Keetch' posted about above - inside wordpress with 1shoppingcart.

          But I am having the same problem as David Lindberg.

          One variable: I have used a table to display the data, ie putting the label in the first TD and then the php script that is supposed to post the variable in the next TD within a row. I don't know if that has any impact.

          Anyone know of any good, basic php tutorials that would help me make sure I'm using this php script right? I have php-exec installed (I've used it successfully before for other things in Wordpress)

          Thanks! I really appreciate any feedback.
          And, if any of you have got this working, maybe you wouldn't mind sharing how you finally got it to work?

          Jon
          P.S. if I figure it out (ok, not if, when -because I HAVE to get this working) I will post and let you all know if you want). The reason I'm doing this is to be able to get conversion tracking in google to work as described here: www (dot) roirevolution (dot) com/blog/2007/02/tracking_paypal_transactions_in_google_analytics_1 (dot) html.
          {{ DiscussionBoard.errors[2765426].message }}
          • Profile picture of the author WPC-advisor
            update:
            - Got php-exec working - tested and it works on my wordpress 'page'
            - used Jimbo's code to generate an orders.txt file, but when opened it, it was blank.
            - appears to still be same problem Dave described
            Note:
            - Found a sample confirmation page designed to work with 1SC (www(dot)idevkb (dot)com/questions/56/Creating+A+Custom+Thank+You+Page+For+1ShoppingCart ) and noted that the variables and php I'm using match this sample page to the tee.

            On a Quest
            Jon
            {{ DiscussionBoard.errors[2765978].message }}
  • Profile picture of the author cameltoe
    get a new notepad file and copy/paste what's between the lines below --- save file with a .php extension, upload to your server...

    /thankyou.php
    -------------------------------
    <html>
    <head>
    <title>Thank You!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body >
    <?php

    $message="";
    foreach($_POST as $key=>$value){
    $message .= $key . '=' . $value . "<br>\n";
    }
    echo ($message);
    ?>
    </div>
    Thanks for subscribing <?php echo $_POST["name"]; ?>! Your address <?php echo $_POST["email1"]; ?> has been successfully added to our database.
    </body>
    </html>
    ------------------------------
    bada bing - I know next to nothing about php - I called 1sc and one of the nice canucks there emailed me the php files.

    I have GoDaddy hosting and didn't have to use php exec...fyi
    {{ DiscussionBoard.errors[3244146].message }}
  • Profile picture of the author pacificfit
    I'm trying to figure out a way to get 1shoppingcart to send all order variables to an email address or FTP location of my choice - basically specifying which email address or FTP gets notified based on the specific SKU or SKU's of product(s) ordered.

    Basically, this is because most of my orders get dropshipped.

    Anyways, is there a piece of software that does this OR somebody who I could hire to do this that really knows their way around 1shoppingcart and could ensure no orders get "missed"? I'm willing to pay to have something developed, especially if it can also send notification when a recurring order is successfully processed...
    {{ DiscussionBoard.errors[7062109].message }}

Trending Topics