Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Awarding Commission via HTTP GET or POST – Problems to make it work

by

Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › Awarding Commission via HTTP GET or POST – Problems to make it work

Tagged: HTTP Get, HTTP Post

  • This topic has 4 replies, 2 voices, and was last updated 13 years, 10 months ago by mreddie.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 30, 2011 at 10:19 am #3692
    mreddie
    Member

    Hi,

    I have problems to make WP Affiliate Platform work on my blog. My wordpress version is 3.0.5 and the WP Affiliate Platform is 4.7.1. My shoping cart system is WP Shop Germany (a popular German WP shopping system) written in PHP. Her’s an example product page of my blog: http://www.driediger.de/menowin-froehlich-biografie-ich-musste-verlieren-um-zu-gewinnen/

    I’ve followed your instructions from this documentation page:

    http://www.tipsandtricks-hq.com/wordpress-affiliate/awarding-commission-via-http-get-or-post-189

    I’ve integrated the mentioned PHP-example code as instructed on the thank you page of the shopping cart and performed some tests. The affiliate platform just counts the clicks, but there is no commission awarding and the sales count is always “0”.

    I’m really frustrated especially because I don’t know what I’m doing wrong. It would be nice if you could give me some additional instructions to make it work.

    To make it clearer what I’ve done here’s the exact code of my “Thank You page”. The “Thank You Page” (do.phtml) appears when the costumer clicks the order (bestellen) button on the checkout overview. The costumer makes the payment manually after recieving the product invoice. So here’s the code:

    <?php

    /*

    Dieses Template wird nach Abschluss einer Bestellung angezeigt. Es können folgende Platzhalter verwendet werden.

    <?php echo $this->order_id; ?> Returns the orderID

    <?php echo $this->k_id; ?> Returns the costumerID

    <?php echo $this->order_data; ?> Returns the sale amount

    Auf die bestellten Produkte können sie mittels $this->basket zugreifen.

    <?php echo sizeof($this->basket); ?> Returns the number of ordered products

    <?php echo $this->basket[1]; ?> Returns 1st productID

    <?php echo $this->basket[1]; ?> Returns the ordered amount of 1st product

    <?php echo $this->basket[1]; ?> Price of 1st product

    */

    ?>

    <div class=”wpshopgermany”>

    <h2><?php echo __(“Schritt 5 von 5: Abschluss der Bestellung”, “wpsg”); ?></h2>

    <?php if ($this->failed) { ?>

    <h2><?php echo __(“Die Bestellung konnte nicht durchgeführt werden.”, “wpsg”); ?></h2>

    <?php } else { ?>

    <h2><?php echo __(“Vielen Dank für Ihre Bestellung”, “wpsg”); ?></h2>

    <p><?php echo __(“Ihre Bestellung ist erfolgreich in unserem System eingegangen und wird bearbeitet. Vielen Dank für Ihr Vertrauen.”, “wpsg”); ?></p>

    <?php

    // The sale amount. You get this value from your payment gateway or the shopping cart

    $sale_amt = $this->order_data;

    echo $sale_amt;

    // The Post URL (Get this value from the settings menu of this plugin)

    $postURL = “http://www.driediger.de/wp-content/plugins/wp-affiliate-platform/api/post.php&#8221;;

    echo $postURL;

    // The Secret key (Get this value from the settings menu of this plugin)

    $secretKey = “4e09fc1de376d”;

    echo $secretKey;

    // Retrieve the value from the browser’s cookie to find out who the referrer was

    $affiliate_id = $_COOKIE;

    echo $affiliate_id;

    // Prepare the data

    $data = array ();

    $data = $secretKey;

    $data = $affiliate_id;

    $data = $sale_amt;

    // send data to post URL to award the commission

    $ch = curl_init ($postURL);

    curl_setopt ($ch, CURLOPT_POST, true);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);

    $returnValue = curl_exec ($ch);

    curl_close($ch);

    ?>

    <?php } ?>

    <?php foreach ($this->modText as $t) { echo $t; } ?>

    </div>

    Any ideas to solve this problem?

    Thx in advance for your support.

    Eddie

    July 1, 2011 at 12:22 am #33830
    amin007
    Participant

    We just need to debug it a little and find out what is missing.

    Can you please tell me the the output that you get from the lines of code where you added an “echo” statement?

    $sale_amt = $this->order_data['price_gesamt'];
    echo $sale_amt;
    // The Secret key (Get this value from the settings menu of this plugin)
    $secretKey = "4e09fc1de376d";
    echo $secretKey;
    // Retrieve the value from the browser's cookie to find out who the referrer was
    $affiliate_id = $_COOKIE['ap_id'];
    echo $affiliate_id;

    Also, pease add the following line immediately after the $returnValue = curl_exec ($ch); line which should print out some more details:

    print_r($returnValue);

    After the above modification please do a test and let me know what output you get from it.

    Also, if you enable the debug by checking the “Enable Debug” checkbox from the settings menu of the affiliate plugin it will write a log file (aff_commission_post_debug.log) that will have more info for as to what it did when it received the request from your thank you page.

    July 1, 2011 at 9:56 am #33831
    mreddie
    Member

    Thx for your quick reply.

    I’ve performed the above instructions. Here’s the “new” code of the “Thank You Page” after modification:

    <?php

    /*

    Dieses Template wird nach Abschluss einer Bestellung angezeigt. Es können folgende Platzhalter verwendet werden.

    <?php echo $this->order_id; ?> Returns the orderID

    <?php echo $this->k_id; ?> Returns the costumerID

    <?php echo $this->order_data; ?> Returns the sale amount

    Auf die bestellten Produkte können sie mittels $this->basket zugreifen.

    <?php echo sizeof($this->basket); ?> Returns the number of ordered products

    <?php echo $this->basket[1]; ?> Returns 1st productID

    <?php echo $this->basket[1]; ?> Returns the ordered amount of 1st product

    <?php echo $this->basket[1]; ?> Price of 1st product

    */

    ?>

    <div class=”wpshopgermany”>

    <h2><?php echo __(“Schritt 5 von 5: Abschluss der Bestellung”, “wpsg”); ?></h2>

    <?php if ($this->failed) { ?>

    <h2><?php echo __(“Die Bestellung konnte nicht durchgeführt werden.”, “wpsg”); ?></h2>

    <?php } else { ?>

    <h2><?php echo __(“Vielen Dank für Ihre Bestellung”, “wpsg”); ?></h2>

    <p><?php echo __(“Ihre Bestellung ist erfolgreich in unserem System eingegangen und wird bearbeitet. Vielen Dank für Ihr Vertrauen.”, “wpsg”); ?></p>

    <?php

    // The sale amount. You get this value from your payment gateway or the shopping cart

    $sale_amt = $this->order_data;

    echo $sale_amt;

    // The Post URL (Get this value from the settings menu of this plugin)

    $postURL = “http://www.driediger.de/wp-content/plugins/wp-affiliate-platform/api/post.php&#8221;;

    echo $postURL;

    // The Secret key (Get this value from the settings menu of this plugin)

    $secretKey = “4e09fc1de376d”;

    echo $secretKey;

    // Retrieve the value from the browser’s cookie to find out who the referrer was

    $affiliate_id = $_COOKIE;

    echo $affiliate_id;

    // Prepare the data

    $data = array ();

    $data = $secretKey;

    $data = $affiliate_id;

    $data = $sale_amt;

    // send data to post URL to award the commission

    $ch = curl_init ($postURL);

    curl_setopt ($ch, CURLOPT_POST, true);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);

    $returnValue = curl_exec ($ch);

    print_r($returnValue);

    curl_close($ch);

    ?>

    <?php } ?>

    <?php foreach ($this->modText as $t) { echo $t; } ?>

    </div>

    After a test-order (the sale amount was €12,90, the test-affiliateID is “mreddie”, the secretKey is “4e09fc1de376d”) I got this results:

    A screenshot of the “Thank You Page” after the test:

    http://www.driediger.de/files/scr_ThankYouPage.jpg

    This is the output of the “aff_commission_post_debug.log”-file after the test:

    [06/29/2011 5:51 PM] – SUCCESS :Start Processing…

    [06/29/2011 5:51 PM] – SUCCESS :Request does not have any GET or POST data.. cannot process request

    [06/29/2011 5:56 PM] – SUCCESS :Start Processing…

    [06/29/2011 5:56 PM] – SUCCESS :Request does not have any GET or POST data.. cannot process request

    [06/30/2011 11:56 PM] – SUCCESS :Start Processing…

    [06/30/2011 11:56 PM] – SUCCESS :Request does not have any GET or POST data.. cannot process request

    [07/01/2011 12:00 AM] – SUCCESS :Start Processing…

    [07/01/2011 12:00 AM] – SUCCESS :Request does not have any GET or POST data.. cannot process request

    [07/01/2011 9:31 AM] – SUCCESS :Start Processing…

    [07/01/2011 9:31 AM] – SUCCESS :Request does not have any GET or POST data.. cannot process request

    July 1, 2011 at 11:59 pm #33832
    amin007
    Participant

    Thank you for the debug info. I can see the issue now. The mistake is in the following line:

    $data['secret_key'] = $secretKey;

    Please change it to the following and that should do it:

    $data['secret'] = $secretKey;

    July 2, 2011 at 3:06 pm #33833
    mreddie
    Member

    Thank you for your quick support. You saved my day!!!

    Everything’s fine now!!!

    Regards,

    Eddie

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ