naichunlei Posted December 18, 2007 Share Posted December 18, 2007 Hi, I'm trying to integrate WHMCS & JROX. I'm using Paypal to accept payment. I put the code for WHMCS & JROX integration found in JROX knowledge base in the checkout script. The problem I'm having is that I have multiple programs in JROX. I have 6 products with different commission rate and different recurring periods. (1) Monthly Payment Basic Package (1-tier:$10, 2-tier:$5) (2) Monthly Payment Business Package (1-tier:$15, 2-tier:$5) (3) Monthly Payment OnlineShop Package (1-tier:$20, 2-tier:$5) (4) Annually Payment Basic Package (1-tier:$100, 2-tier:$50) (5) Annually Payment Business Package (1-tier:$150, 2-tier:$50) (6) Annually Payment OnlineShop Package (1-tier:$200, 2-tier:$50) How do we know if different products purchased on WHMCS get traced correctly on JROX? Does the code on checkout script differentiate between different products? Anyone has any luck integrating these 2 application with multiple products? 0 Quote Link to comment Share on other sites More sharing options...
naichunlei Posted December 18, 2007 Author Share Posted December 18, 2007 WHMCS and JROX are installed on 2 different domain name. 0 Quote Link to comment Share on other sites More sharing options...
naichunlei Posted December 19, 2007 Author Share Posted December 19, 2007 I got replies from JROX folks: ==================================================================== If you can set some code that maps the products to the program ID, then you can do it. Here's a logical example (not code) If product A is purchased, then run this code for program ID 1: $JAMIntegrate = file_get_contents("http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$ordernumber."&custom_mid=".$_COOKIE['jrox']." &program_id=1"); If product B is purchased, then run trhis code for program ID 2: $JAMIntegrate = file_get_contents("http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$ordernumber."&custom_mid=".$_COOKIE['jrox']." &program_id=2"); If you notice the "&program_id=1", option in the integration code - this forces the commission to use the commission settings for that program in JAM. This might be how you can integrate it according to your preferences. However, you'll have to turn the logic here into some code for WHMCS integration. ==================================================================== 0 Quote Link to comment Share on other sites More sharing options...
naichunlei Posted December 19, 2007 Author Share Posted December 19, 2007 checkoutscript.php: <?php /* ************************************************** ************** WHMCS CheckOut Script ************* ************************************************** You may enter code here which will be run when a user checks out if you have enabled it in Configuration > General Configuration > Other of your WHMCS Admin Area. The following variables are available to you: ************************************************** Order ID: $orderid Order Number: $ordernumber Invoice ID: $invoiceid Product ID: $productid Domains Array: $domains Addons Array: $addons ************************************************** */ // You got mail! mail($emailto, $subject, $message, $headers); $result=mysql_query("SELECT * FROM tblorders WHERE ordernum = '$ordernumber' LIMIT 1"); $row = mysql_fetch_array($result); $amount = $row['amount']; ?> 0 Quote Link to comment Share on other sites More sharing options...
naichunlei Posted December 19, 2007 Author Share Posted December 19, 2007 So I think matching the program_id in JROX with $productid from WHMCS checkout script should do the trick. Am I correct? 0 Quote Link to comment Share on other sites More sharing options...
naichunlei Posted December 20, 2007 Author Share Posted December 20, 2007 Anybody using WHMCS and JROX? 0 Quote Link to comment Share on other sites More sharing options...
arcdigital Posted December 20, 2007 Share Posted December 20, 2007 So I think matching the program_id in JROX with $productid from WHMCS checkout script should do the trick.Am I correct? Yes, you are! That should work. 0 Quote Link to comment Share on other sites More sharing options...
BizGlobalSolutions Posted February 27, 2008 Share Posted February 27, 2008 Hi I have looked and do not see any checkout script so where do I put the code to intergrate jrox I looked in where it said it was and nothing there thx 0 Quote Link to comment Share on other sites More sharing options...
BizGlobalSolutions Posted February 28, 2008 Share Posted February 28, 2008 # Open up your whmcs/includes/checkoutscript.php file for editing. # Near the bottom of the file, add the following lines: // You got mail! mail($emailto, $subject, $message, $headers); $result=mysql_query("SELECT * FROM tblorders WHERE ordernum = '$ordernumber' LIMIT 1"); $row = mysql_fetch_array($result); $amount = $row['amount']; $JAMIntegrate = file_get_contents("http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$ordernumber."&custom_mid=".$_COOKIE['jrox'].""); ?> # Make sure to point http://www.domain.com/affiliates to your JAM installation URL Jrox tells me to do this there is no checkout.php helppppppppppp Andy 0 Quote Link to comment Share on other sites More sharing options...
BizGlobalSolutions Posted February 29, 2008 Share Posted February 29, 2008 no was there supose to be a check out script with the latest version or am I to use the actionhooks and how do I use that Cheers Andy 0 Quote Link to comment Share on other sites More sharing options...
mylove4life Posted February 29, 2008 Share Posted February 29, 2008 not sure, any word Matt/Adam. Is there a check out script or are we going to use something else? Thanks 0 Quote Link to comment Share on other sites More sharing options...
Brett Posted February 29, 2008 Share Posted February 29, 2008 The proper file to use now is includes/actionhooks.php You will want to put the code after function actionhook_ShoppingCartCheckout($vars) { # This function runs when the user checks out using the shopping cart # $vars["OrderID"] - Order ID Number # $vars["OrderNumber"] - 10 Digit Order Number # $vars["InvoiceID"] - Invoice ID Number # $vars["Products"] - Array of Product IDs from Order # $vars["Addons"] - Array of Addon IDs from Order # $vars["Domains"] - Array of Domain IDs from Order 0 Quote Link to comment Share on other sites More sharing options...
martymart Posted March 16, 2008 Share Posted March 16, 2008 Hi Brett, So you are saying I should include the code as follows: function actionhook_ShoppingCartCheckout($vars) { # This function runs when the user checks out using the shopping cart # $vars["OrderID"] - Order ID Number # $vars["OrderNumber"] - 10 Digit Order Number # $vars["InvoiceID"] - Invoice ID Number # $vars["Products"] - Array of Product IDs from Order # $vars["Addons"] - Array of Addon IDs from Order # $vars["Domains"] - Array of Domain IDs from Order // You got mail! mail($emailto, $subject, $message, $headers); $result=mysql_query("SELECT * FROM tblorders WHERE ordernum = '$ordernumber' LIMIT 1"); $row = mysql_fetch_array($result); $amount = $row['amount']; $JAMIntegrate = file_get_contents("http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$ordernumber."&custom_mid=".$_COOKIE['jrox'].""); ?> } Cheers, Marty 0 Quote Link to comment Share on other sites More sharing options...
BizGlobalSolutions Posted March 28, 2008 Share Posted March 28, 2008 Hi to all, can some one assist me on what happens next I have entered that code in to the action hooks in fact on the other post about intergration has a better code to input do I use just the one or both. What I need to know is how do I make sure the commissions are done how does it set off commissions is it with cookies Has any one here sone it and can assist me with it Thx Andy Biz Global Solutions 0 Quote Link to comment Share on other sites More sharing options...
brainstorm Posted November 7, 2008 Share Posted November 7, 2008 Hi, I am trying to integrate jrox I am not sure how to use the actionhooks, Is there any guidance? Erik 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted November 7, 2008 Share Posted November 7, 2008 Actionhooks are contained within the /includes/actionhooks.php file. Functions defined in here are called by WHMCS at the appropriate time so any PHP code contained within the functions will also execute at that time. Each function has a list of variables generated by WHMCS that you can access near the top of the function. 0 Quote Link to comment Share on other sites More sharing options...
JHostNZ Posted February 6, 2009 Share Posted February 6, 2009 I have posted on the Jrox forum but definative answer yet.. http://forums.jrox.com/index.php/topic,3232.0.html Latest version of WHMCS 3.8.1 Click are being tracked ok I tested the commission generation through the browser: http://www.domain.com/affiliates/sale.php?amount=20&trans_id=TEST and it's OK. Commission is showing in the JAM admin area. My code - ( I know there is no www - that how I set up JAM on this domain) Code: if (!empty($_COOKIE['jrox'])) { $result=mysql_query("SELECT * FROM tblorders WHERE id = '" . $vars["InvoiceID"] ."' LIMIT 1"); $row = mysql_fetch_array($result); $JAMIntegrate = file_get_contents("http://XXXXhost.com/partner/sale.php?amount=".$row['amount']."&trans_id=".$vars["InvoiceID"]."&custom_mid=".$_COOKIE['jrox']); } I tried under the InvoicePaid Hook - function actionhook_InvoicePaid($vars)( Yes I entered a payment in WHMCS) and also under the shopping cart checkout hook - function actionhook_ShoppingCartCheckout($vars) Nothing... then tried the following with the same result. echo "http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$orderid."&custom_mid=".$_COOKIE['jrox'].""; exit();and i tried to place an order in WHMCS shopping cart. When i completed the order it appears a page with the following line: http://www.domain.com/affiliates/sale.php?amount=&trans_id=&custom_mid=1%23%23%231%23%23%230%23%23%230%23%23%23Unknown but i don't find a pending commission in the JAM admin area. JRoxAdmin response: the issue here is that the amount and trans_id variables are not showing up. since we dont have a copy of WHMCS, we suggest asking the folks there what variable name we can use to be able to get the sale and transaction amounts. Can someone confirm that this should work and how please. 0 Quote Link to comment Share on other sites More sharing options...
JHostNZ Posted February 6, 2009 Share Posted February 6, 2009 I am still trying to get Jrox Jam integrated with WHMCS Has any one succesfully done this and will to share solution? This was my post on the Jrox forum a couple of days ago and the answer from Jroxadmin. Latest version of WHMCS 3.8.1 Click are being tracked ok I tested the commission generation through the browser: http://www.domain.com/affiliates/sale.php?amount=20&trans_id=TEST and it's OK. Commission is showing in the JAM admin area. My code - ( I know there is no www - that how I set up JAM on this domain) Code: if (!empty($_COOKIE['jrox'])) { $result=mysql_query("SELECT * FROM tblorders WHERE id = '" . $vars["InvoiceID"] ."' LIMIT 1"); $row = mysql_fetch_array($result); $JAMIntegrate = file_get_contents("http://XXXXhost.com/partner/sale.php?amount=".$row['amount']."&trans_id=".$vars["InvoiceID"]."&custom_mid=".$_COOKIE['jrox']); } I tried under the InvoicePaid Hook - function actionhook_InvoicePaid($vars)( Yes I entered a payment in WHMCS) and also under the shopping cart checkout hook - function actionhook_ShoppingCartCheckout($vars) Nothing... then tried the following with the same result. echo "http://www.domain.com/affiliates/sale.php?amount=".$amount."&trans_id=".$orderid."&custom_mid=".$_COOKIE['jrox'].""; exit(); and i tried to place an order in WHMCS shopping cart. When i completed the order it appears a page with the following line: http://www.domain.com/affiliates/sale.php?amount=&trans_id=&custom_mid=1%23%23%231%23%23%230%23%23%230%23%23%23Unknown but i don't find a pending commission in the JAM admin area. Answer from Jroxadmin: the issue here is that the amount and trans_id variables are not showing up. since we dont have a copy of WHMCS, we suggest asking the folks there what variable name we can use to be able to get the sale and transaction amounts. Help anyone? 0 Quote Link to comment Share on other sites More sharing options...
Idealws Posted February 26, 2009 Share Posted February 26, 2009 (edited) Yes, I have a solution to your problem. The problem is in the integration code. JRox is using the wrong variables to check the table in WHMCS to get the amount. Here is the proper code to make it work: if (!empty($_COOKIE['jrox'])){ $result=mysql_query("SELECT * FROM tblorders WHERE invoiceid = '" . $vars["InvoiceID"] ."' LIMIT 1"); $row = mysql_fetch_array($result); $JAMIntegrate = file_get_contents("http://www.yourdomain.com/affiliates/sale.php?amount=".$row['amount']."&trans_id=".$vars["InvoiceID"]."&custom_mid=".$_COOKIE['jrox']); } The reason for the problem is in the mysql_query(). You need to change the id = '" .$vars["InvoiceID"] ."' to invoiceid = '" . $vars["InvoiceID"] . "' And you are putting it in the right place function actionhook_InvoicePaid($vars) Sorry this solution took so long to get to you, I just started integrating JAM last night and was running into this same issue. Hope this helps. Regards, Ray Edited February 26, 2009 by Idealws 0 Quote Link to comment Share on other sites More sharing options...
FiFtHeLeMeNt Posted August 1, 2009 Share Posted August 1, 2009 For whmcs 4.x read the following article : http://www.adminsehow.com/2009/08/whcms-4-x-integration-with-jrox-affiliate-management-system-jam/ 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.