Jump to content

WHMCS Module with Code Only


deezon

Recommended Posts

Hello Everyone,

 

We are trying to monitor conversions by adding a code to Invoice PAID page. Since every time an invoice generated, it's dynamically generated, so what's the best way to place code on Invoice PAID page?

 

I figured that we can create a WHMCS module with sole purpose of displaying a code on that page but still got no clue on what are the steps. I'm sure the steps are pretty basic, so if anyone has experience with modules etc., do give your suggestion.

 

Thanks in advance

Link to comment
Share on other sites

it can be done easily using action hooks, create new file inside " /includes/hooks/ " directory with any name e.g. "codeinsideinvoice.php" and place the following code inside it:

<?php
function hook_insideInvoice($vars){    # Place Your Code In This Variable    $myCode = "";        if ($vars['filename']=="viewinvoice"){        if (isset($vars['status']) && $vars['status']=="Paid"){            return array("mycodepaidinvoice" => $myCode);        }    }}add_hook("ClientAreaPage", 1, "hook_insideInvoice");?>

 

and inside viewinvoice.tpl you can place this tag {$mycodepaidinvoice} where you need your code to be displayed/printed

 

hope this is what you are looking for, let me know if miss understand anything

 

- - - Updated - - -

 

<?php
function hook_insideInvoice($vars){
   # Place Your Code In This Variable
   $myCode = "";

   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

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