Jump to content

3rd party affiliate script or network integration


tbhost

Recommended Posts

I have downloaded the trial version of your software, and imported all of my modernbill customers, and so far I really like your program. One thing that I cannot figure out how to do is trigger an affiliate commission from a 3rd party script, and I cannot find any detailed info in your manual, or the forums.

 

The only thing I saw is a note to use the checkout script - when I look at the checkout script it cannot be used, because it doesn't support order totals - so there's no way to calculate a commission.

 

I also looked at the order confirmation page in the templates/orderforms/ordercomplete.tpl - and I can't see where there are any order totals, or anything there that I can use to calculate commissions for affiliates using our in house system (groundbreak.com) or shareasale (our 3rd party network.) - both of these require an invisible gif be displayed, and a $ value be passed to them in order to award commissions. The only page in the order process that I see totals posted on is the page where the invoice is viewed. And I see that the viewinvoice.php is encrypted, so I can't put it there.

 

I really want to purchase your software, but having a billing system work with our affiliate networks is extremely important.

Thanks,

John

Link to comment
Share on other sites

This is the integration code for Modernbill and Shareasale, I can't find anything equivalent for whmcs???

 

----------------------------------

 

ModernBill Version 5.0 and higher

 

The file to modify is the shopping/CheckoutSuccess.tpl

 

Add the following code just above the last DIV HTML tag:<img src="htt**://shareasale.com/sale.cfm?amount={$invoiceInfo.invoiceAmount}&tracking={$invoiceInfo.invoiceNumber}&transtype=SALE&merchantID=XXXX" width="1" height="1">Where you replace XXXX with your merchant ID number.

 

ModernBill Versions lower than 5.0

 

The file to modify is wizard_submit_process.case.inc.php

 

Search for the code below in your file:

 

 

if ($z == 0) { ?>

!-- REMOVE THIS LINE WHEN ACTIVE<tr><td colspan="2"><?

// INSERT AFFILIATE CODE HERE

// $invoice_amount

// $invoice_id

// $order_totals['sub_total']

// $order_totals['pre_tax']

// $order_totals['tax_due']

// $order_totals['post_tax']

?></td></tr>

REMOVE THIS LINE WHEN ACTIVE --

<? }

 

 

 

Remove the line:!-- REMOVE THIS LINE WHEN ACTIVE

Remove the line:REMOVE THIS LINE WHEN ACTIVE --

Replace the line:// INSERT AFFILIATE CODE HERE

With the tracking code:echo '<img src="htt**://shareasale.com/sale.cfm?amount='.$order_totals['sub_total'].'&tracking='.$invoice_id.'&transtype=SALE&merchantID=XXXX" width="1" height="1">';Where you replace XXXX with your merchant ID number.

Link to comment
Share on other sites

OK, I've been messing with this darn thing for quite a while now.

If I add any code to the checkoutscript - even just the line:

---------

*/

?>

This is my checkoutscript

sale.cfm?amount={$totalrecurringmonthly}&tracking={$invoiceid}&transtype=SALE&merchantID=xxxx

--------

It displays :

---------

This is my checkout script.

---------

and in the source:

---------

src="htt**://shareasale.com/sale.cfm?amount={$totalrecurringmonthly}&tracking={$invoiceid}&transtype=SALE&merchantID=xxxx"

---------

So no amount get's passed to the affiliate script.

 

The checkout script says it only accepts the following:

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

 

So It doesn't look like there's a way in that script to pass on any useful data like recurring monthly, total, order, etc... to an affiliate tracking script.

Link to comment
Share on other sites

  • WHMCS CEO

You just need to enter your code in the checkoutscript.php file, but instead of using image code, just use a PHP file request such as file_get_contents or CURL to call the URL you require. You cannot output any code in the checkout script or you'll break the entire process. You can query the database with the order ID to find out the amounts to be paid.

 

Matt

Link to comment
Share on other sites

Thanks for the reply on a Saturday. I really appreciate it.

 

You just need to enter your code in the checkoutscript.php file, but instead of using image code, just use a PHP file request such as file_get_contents or CURL to call the URL you require. You cannot output any code in the checkout script or you'll break the entire process. You can query the database with the order ID to find out the amounts to be paid.

 

Can you point me to some documentation on exactly how to do this? I am not a programmer, so writing a script to query the database is way over my head unless you have an example script etc...

 

Also, I am confused on how to do this using curl, Shareasale is specific in that they need their script called an image tag displayed on the order success page - IE page displayed to the customer after a credit card is processed successfully and order is fully processed. This is because their tracking cookie originates from shareasale.com and not our website. So in order to track the cookie, the image has to be served to the browser from their site.

 

The simplest solution would be for the same variables which are available in the step4 template to be available on the ordercomplete.tpl - then this would have been a matter of a 2 minute template edit instead of major surgery.

Link to comment
Share on other sites

OK, just wanted anyone else with a similar question know that this is possible with WHMCS. It's just not documented well, and I hadn't seen any solutions in the forum.

 

Matt took a fair amount of time with me today (a Saturday) and finally came up with a solution that works for shareasale and should work for any 3rd party affiliate script that uses an image tag to trigger a commission. CJ, shareasale, Groundbreak, idevaffiliate, Google pay per action, ROI tracking etc... just modify your tracking code to work with your software.

 

Basically all that was needed was a php query in the order-complete.tpl to look up the order amount and place that in the image tag.

 

--- Basically, with any affiliate system, you need to be able to pass a dollar amount, and a unique order ID (to identify the sale in the affiliate tracking system)

for shareasale the link looks like:

b]&transtype=SALE&merchantID=xxxx

 

So to make it work properly the following code works:

------------------

<img src="htt**://shareasale.com/sale.cfm?amount={php}

$query = "SELECT amount FROM tblhosting WHERE id='".$_SESSION["orderdetails"]["ProductID"]."'";

$result=mysql_query($query);

$data = mysql_fetch_array($result);

echo $data["amount"];{/php}

&tracking={$ordernumber}&transtype=SALE&merchantID=xxxx" width="1" height="1">

------------------

 

I have tested the above, and it appears to be working properly. I shouldn't have any problem incorporating that into any of the other 3rd party tracking systems we use.

 

 

BTW, anyone evaluating this program should know, Matt posted several replies to this forum thread, as well as 5 additional posts in a private support ticket on a Saturday to help get this figured out - in a pre-sale phase. This is all while I'm still evaluating during the 14 day trial.

 

Definitely better service than I expected.

Thanks,

John Kaufman

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...
Hello,

 

I have been searching and searching for someone to post something that would remotely work for passing variables using whmcs to shareasale has anyone done this successfully using the cart (not the 5 step ordering processes)? I am in grave need for assistance on this matter. BTW, just in case someone states to use the php script that is above, i already have tried and it didn't work......

 

Well we finaly got it to work with the help of MATT and ADAM, the values that need to be used can be found using the {debug} and furthermore, make sure you set the Auto Redirect on Checkout to:

 

automatically redirect the user to the gateway - not automatically redirect and just show the order completed page

(this can be found going to General Settings >> Ordering Tab)

 

If you have it going to the other options, code in the {if $ispaid}{/if} section will not run as payment won't have been made.

Link to comment
Share on other sites

  • 3 years 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