HostingBegins Posted January 6, 2008 Share Posted January 6, 2008 Hi I found this by searching this forum: http://forum.whmcs.com/showthread.php?t=4205 But it says to edit includes/checkoutscript.php When I look for the file, I can not find it? I am using the lastest build of WHMCS, as that file changed its name ? Thanks for any help. Richy 0 Quote Link to comment Share on other sites More sharing options...
mm1250 Posted January 6, 2008 Share Posted January 6, 2008 DO you plan on using the shopping cart order system (cart.php) or do you plan on using th e legacy order.php ? 0 Quote Link to comment Share on other sites More sharing options...
HostingBegins Posted January 6, 2008 Author Share Posted January 6, 2008 Hi mm1250 Thank for your reply. Hmm good question, I think I am going for the cart system as it seems a little easier for end users to use. Thanks Richy 0 Quote Link to comment Share on other sites More sharing options...
mm1250 Posted January 6, 2008 Share Posted January 6, 2008 Than your not going to be using the checkoutscript file. You need to edit the file called actionhooks.php in the includes folder I think. You have to put the code in there. 0 Quote Link to comment Share on other sites More sharing options...
HostingBegins Posted January 7, 2008 Author Share Posted January 7, 2008 Hi Thanks for that. I have placed the following code to the actionhook.php file in the include folder. Should this create a new affiliate for any new orders ? I'm a little confused? This is the code I added. $idev_query = mysql_query("select amount from tblorders WHERE id='$orderid'"); $idev_query = mysql_fetch_array($idev_query); $idev_saleamt = $idev_query['amount']; $site_url = "http://www.yourdomain.com/affiliates/sale.php?idev_saleamt=$idev_saleamt&idev_ordernum=$orderid"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $site_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 100); $result = curl_exec($ch); curl_close($ch); - I editted yourdomain to my idev domain name. Thanks for any help. 0 Quote Link to comment Share on other sites More sharing options...
mm1250 Posted January 7, 2008 Share Posted January 7, 2008 Your actionhook file should have this code in. function actionhook_ShoppingCartCheckout($vars) { # This function runs when the user checks out using the shopping cart $orderid = $vars["OrderID"]; $idev_query = mysql_query("select amount from tblorders WHERE id='$orderid'"); $idev_query = mysql_fetch_array($idev_query); $idev_saleamt = $idev_query['amount']; $idev_ip = $_SERVER['REMOTE_ADDR']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.yourdomain.com/affiliates/sale.php?profile=33&idev_saleamt=$idev_saleamt&idev_ordernum=$orderid&ip_address=$idev_ip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); } Be sure to test it out just to make sure it works. I know this code works with mine. I must have tested it 5times or so 0 Quote Link to comment Share on other sites More sharing options...
HostingBegins Posted January 7, 2008 Author Share Posted January 7, 2008 Thanks mate, I will give this a try now. Appreciate this. Thanks Richy 0 Quote Link to comment Share on other sites More sharing options...
HostingBegins Posted January 7, 2008 Author Share Posted January 7, 2008 Hi I have tested this a couple of times, but get a blank page at the end of the checkout? This is the full code for the hook file. <?php /* ********************** Action Hooks ********************** * Action hooks allow you to write your own PHP code that * * will run when specific actions occur in WHMCS. There * * is a function for each action that supports hooks. The * * variables avaible in a specific function are listed in * * the comments for that function. Invalid code here will * * will cause WHMCS to fail so ensure your code is valid. * ********************************************************** */ define("ACTIONHOOKSINC",true); function actionhook_ClientSignup($vars) { # This function runs when a new user signs up through the shopping cart or registration page # $vars["ID"] # $vars["FirstName"] # $vars["LastName"] # $vars["CompanyName"] # $vars["Email"] # $vars["Address1"] # $vars["Address2"] # $vars["City"] # $vars["State"] # $vars["Postcode"] # $vars["Country"] # $vars["PhoneNumber"] # $vars["Password"] } 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 } function actionhook_InvoicePaid($vars) { # This function runs when an invoice is fully paid and therefore the services renewed # $vars["InvoiceID"] } function actionhook_ShoppingCartCheckout($vars) { # This function runs when the user checks out using the shopping cart $orderid = $vars["OrderID"]; $idev_query = mysql_query("select amount from tblorders WHERE id='$orderid'"); $idev_query = mysql_fetch_array($idev_query); $idev_saleamt = $idev_query['amount']; $idev_ip = $_SERVER['REMOTE_ADDR']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.hostingbegins.net/affiliates/sale.php?profile=33&idev_saleamt=$idev_saleamt&ide v_ordernum=$orderid&ip_address=$idev_ip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); } ?> Any ideas ? Thanks again Richy 0 Quote Link to comment Share on other sites More sharing options...
mm1250 Posted January 8, 2008 Share Posted January 8, 2008 Thats becuase you pasted the code at the bottom of the file. You need to look at the whole file. There is a section that has this: 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 Delete the above code and replace it with the new one. 0 Quote Link to comment Share on other sites More sharing options...
HostingBegins Posted January 9, 2008 Author Share Posted January 9, 2008 Hi Thanks for that, I no longer get a blank page. Ok can you explain what this code does? does it create a new affiliate in idev? or just reward ? Sorry little confused. Thanks again 0 Quote Link to comment Share on other sites More sharing options...
mm1250 Posted January 9, 2008 Share Posted January 9, 2008 This code placed is what tirggers the sale. Obviously the affiliate would already have the clickthrough cookie installed so once the order is made, it will check the client PC cookie to see if it's linked to an affiliate. 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.