Jump to content

idev checkoutscript.php?


HostingBegins

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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