Jump to content

HOW TO: Configure Post Affiliate Pro 3.1.4 for WHMCS 3.5.1


Bitrain

Recommended Posts

Below is the correct step-by-step to integrate WHMCS with Post Affiliate Pro:

 

PS. I find what new version WHMCS 3.5.1 not have checkoutscript.php but have actionhooks.php I don't know why, but actionhooks.php not work for me. When I check box in "Configuration -> Other -> Run Script on CheckOut" and not make any changes in actionhooks.php I have on checkout a blank page.

 

Well, here is steps:

 

1. Login to your WHMCS admin panel and check box "Run Script on CheckOut" in Configuration -> Other.

 

2. In your PAP admin panel go to "Tools -> Integration Wizard -> Step 2. Clicks tracking"

 

3. In "Clicks tracking" choice "new style". In field "Complete URL to main site" type your main URL, for example: http://www.yourdomain.com/index.php and put "Clicks tracking code" to your index.php page.

 

4. Create empty file checkoutscript.php and put insaid your new file this code:

 


<?php

$pap_query = mysql_query("select amount from tblorders WHERE id='$orderid'");
$pap_query = mysql_fetch_array($pap_query);
$pap_saleamt = $pap_query['amount'];
$pap_ordernum = $orderid;
print "<img border=0 src=\"http://www.yourdomain.com/affiliate/scripts/sale.php?TotalCost=$pap_saleamt&OrderID=$pap_ordernum \"width=1 height=1 alt=\"affiliate-image\">";

?>

 

Change http://www.yourdomain.com/affiliate tou your location where PAP installed.

 

5. Upload your new checkoutscript.php to WHMCS_install_directory/includes

 

After that configure your PAP and campaigns. It work fine for me.

Hope this help you!

Link to comment
Share on other sites

PS. I find what new version WHMCS 3.5.1 not have checkoutscript.php but have actionhooks.php I don't know why, but actionhooks.php not work for me.

actionhooks is for the cart processing, checkouscript for the order processing - which methiod are you using ?

 

print "<img border=0 src=\"http://www.yourdomain.com/affiliate/scripts/sale.php?TotalCost=$pap_saleamt&OrderID=$pap_ordernum \"width=1 height=1 alt=\"affiliate-image\">";

A *VERY* bad idea as it will break the standard WHMCS processing :(

The checkoutscript.php should NOT output anything.

Link to comment
Share on other sites

othellotech

 

It was solution for order processing. Now for using cart processing.

 

1. Open in editor your WHMCS_install_directory/include/actionhooks.php

 

2. After function actionhook_ShoppingCartCheckout($vars) {

 

and before } add this code:

 


$orderid = $vars["OrderID"];
$ord_num = $vars["OrderNumber"];
$pap_query = mysql_query("select amount from tblorders WHERE id='$orderid'");
$pap_query = mysql_fetch_array($pap_query);
$pap_saleamt = $pap_query['amount'];
   $url = "http://www.yourdomain.com/affiliate/scripts/sale.php?TotalCost=$pap_saleamt&OrderID=$orderid&ProductID=$ord_num";

$ch = curl_init(); 
   curl_setopt($ch, CURLOPT_URL, $url); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
$result = curl_exec($ch);
curl_close($ch);

 

Change http://www.yourdomain.com/affiliate tou your location where PAP installed.

 

Hope this also helps integrate WHMCS with PAP ;)

Link to comment
Share on other sites

  • 2 weeks later...

This is good, I am not getting anything in the PAP, I look @ the web logs and do not see the curl calling? I ordered a product in the cart, paid, is actionhooks.php executed @ the completion of the order? Do I need to add anyting to the checkout script?

 

thanks

Link to comment
Share on other sites

  • 5 weeks later...
  • 2 weeks later...

After adding the code as suggested, PAP tracks BUT

 

othellotech

 

It was solution for order processing. Now for using cart processing.

 

1. Open in editor your WHMCS_install_directory/include/actionhooks.php

 

2. After function actionhook_ShoppingCartCheckout($vars) {

 

and before } add this code:

 


$orderid = $vars["OrderID"];
$ord_num = $vars["OrderNumber"];
$pap_query = mysql_query("select amount from tblorders WHERE id='$orderid'");
$pap_query = mysql_fetch_array($pap_query);
$pap_saleamt = $pap_query['amount'];
   $url = "http://www.yourdomain.com/affiliate/scripts/sale.php?TotalCost=$pap_saleamt&OrderID=$orderid&ProductID=$ord_num";

$ch = curl_init(); 
   curl_setopt($ch, CURLOPT_URL, $url); 
   curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
$result = curl_exec($ch);
curl_close($ch);

 

Change http://www.yourdomain.com/affiliate tou your location where PAP installed.

 

Hope this also helps integrate WHMCS with PAP ;)

 

The client sees a blank white screen instead of being sent to the appropriate gateway. Internally the order is being processes, but payment isn't.

 

Any suggestions?

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated