PDA

View Full Version : HOW TO: Configure Post Affiliate Pro 3.1.4 for WHMCS 3.5.1



Bitrain
12-24-07, 11:14 PM
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!

othellotech
12-25-07, 02:32 AM
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.

Bitrain
12-25-07, 07:06 PM
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 ;)

vitolim
01-03-08, 12:06 PM
Do u mean i just need to edit by follow your last post? or need to add your first post together?

Bitrain
01-04-08, 05:39 AM
Hi vitolim

If you use cart processing method, then follow only my last post.

rtartar
01-10-08, 02:03 AM
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

Bitrain
01-10-08, 09:27 PM
Hi rtartar
Depending on which processing method you have use, please follow my posts.
All things work fine.

PS. If you have a complexity you can PM me.

mysmallbizu
01-14-08, 07:38 PM
I"m using PAYPAL, and am wondering if the placement .... in checkout variables mean that the recurring sales are not triggered in PAP or cancelled for that matter?

rtartar
01-15-08, 05:41 PM
I don't know what my problem is? I can't seem to get this to work. I can get it to work with the client side javascript, but not the curl. I would really like to get the curl to work.

vitolim
01-16-08, 03:46 PM
hi Bitrain& guys,

where and how do i input the sales tracking code into whmcs? after i follow Bitrain last post?

thanks you

vitolim
01-23-08, 12:43 PM
Hi, I face some problem hope can help. I have done all implementation and created campain for it but, after try purchased, the affiliate cannot get commission but only click calculation. any idea?

vitolim
02-23-08, 07:43 AM
now i hear that v3.6 more easy to implement external affiallite program, but i log in to control panel where to add in? any one can help? and refer to my last post i still hving problem really dont know how to solve it.

anyone help pls..

mysmallbizu
03-07-08, 08:45 PM
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?

unitminer
04-06-09, 10:15 AM
Integration with latest version of Post Affiliate PRo 4 is described here: http://addons.qualityunit.com/integration-methods/_iwhmcs/