Jump to content

Adrecord affiliates for WHMCS or linking to external site after payment


denully

Recommended Posts

Does anyone have any experience in using adrecord ( http://adrecord.com/ ) with sales through WHMCS ?

 

or if its possible to link to a website outside of whmcs when a payment is complete?

 

The problem i'm facing is that i need to put in a tracking code on the "payment complete" page, so adrecord is able to record once an order has been completed, which has come through them. But it seems no matter where i place it in WHMCS, it doesn't work.

Link to comment
Share on other sites

very helpful indeed.

however it seems to be failing if i try to place a javascript in there, which adrecord has provided me.

 

<script type="text/javascript">
(function() {
adrecord = {
'programID': ZZZZZZ,
'orderID': 'XXXXXX',
'orderValue': YYYYYY,
'couponCode': ''
}
var e=document.createElement('script');
e.src=document.location.protocol + '//track.adrecord.com/track.js';
var s=document.getElementsByTagName('body')[0]; s.appendChild(e);
})();
</script>

 

thats what i needed in there and i place it as below. ( XXX YYY ZZZ is just me covering some date )

 

<?php
function hook_insideInvoice($vars){
   # Place Your Code In This Variable
   $myCode = "<script type="text/javascript">
(function() {
adrecord = {
'programID': ZZZZZZ,
'orderID': 'XXXXXX',
'orderValue': YYYYYY,
'couponCode': ''
}
var e=document.createElement('script');
e.src=document.location.protocol + '//track.adrecord.com/track.js';
var s=document.getElementsByTagName('body')[0]; s.appendChild(e);
})();
</script>";

   if ($vars['filename']=="viewinvoice"){
       if (isset($vars['status']) && $vars['status']=="Paid"){
           return array("mycodepaidinvoice" => $myCode);
       }
   }
}
add_hook("ClientAreaPage", 1, "hook_insideInvoice");
?>

Link to comment
Share on other sites

That worked :)

I appreciate your help here and hate to ask you even more, but when a payment is done the invoice still state unpaid due to the paypal IPN delay there is sometimes. ( have been fighting a year with paypal on this matter ).

would you know if there is a way to make the code you wrote if (isset($vars['status']) && $vars['status']=="Paid"){ work for registering if the invoice states paymentsuccess=true in the link or Thank You! Your payment was successful. on the invoice ? that way i could bypass the IPN issue.

Link to comment
Share on other sites

i think this will help you better, inside any order templates there is a place to add the conversion tracking code, for example open this template file: "templates/orderforms/cart/complete.tpl" you will find this part almost at the end

{if $ispaid}
<!-- Enter any HTML code which needs to be displayed once a user has completed the checkout of their order here - for example conversion tracking and affiliate tracking scripts -->
{/if}

 

add your tracking code inside the IF Statement and in each Cart Template (templatename/complete.tpl)

 

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

or you can do the following and it'll be more easy and stable:

Modify hook action to work like that:

<?php 
function hook_insideInvoice($vars){ 
   # Place Your Code In This Variable 
   $myCode = "<script type='text/javascript'> 
(function() { 
adrecord = { 
'programID': ZZZZZZ, 
'orderID': 'XXXXXX', 
'orderValue': YYYYYY, 
'couponCode': '' 
} 
var e=document.createElement('script'); 
e.src=document.location.protocol + '//track.adrecord.com/track.js'; 
var s=document.getElementsByTagName('body')[0]; s.appendChild(e); 
})(); 
</script>"; 

return $myCode;
} 
add_hook("ShoppingCartCheckoutCompletePage", 1, "hook_insideInvoice"); 
?>

this will output your tracking code inside Order Completed page without the need to modify each template also whenever you update your system..

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.

×
×
  • 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