Jump to content

Display external account balance on whmcs client area


TeleMagic

Recommended Posts

Hi Guys

 

I am wondering if it is possible to display the balance of a VOIP account on an external system in the client area.

 

So I would have ie

 

Account Credit Balance: $0.00 USD

Due Invoices Balance: $14.30 USD

Voip Account Balance: $12.95 USD

 

The voip accounts are created by WHMCS using a module I am writing and the table that stores the balance has the customerid from WHMCS in it so from a database perspective it would simply be a case of running a query to find out the balance of that customer, Im just not sure how and if it is possible to change the template to display this is client area?

 

Regards

Link to comment
Share on other sites

Well it's really easy. On your external system you have to store the key (client ID) too. Then on your custom page you can run the query below. I'm assuming that voip balance variable is stored on an external dababase so ConnectToExternalDB() should return the connection string to your external database.

$result = mysql_query("SELECT voipbalance FROM externalsystem WHERE id=".$ca->getUserID(),ConnectToExternalDB());

Edited by Kian
Link to comment
Share on other sites

Yes. If you need to display this value in a standard page of WHMCS (obfuscated) the only option you have is to add your script directly inside the tpl file between {php}{/php} tags or include an external file with {include_php file='yourscript.php'}. The cleanest way is to use the include and pass VoIP Balance variable to a Smarty variable. In this way you can refer to this value with something like {$voipbalance} instead of using {php}echo $voipbalance;{/php} in the tpl.

Link to comment
Share on other sites

  • 2 weeks later...

How would I convert my PHP variable into a smarty variable?

 

Ie if I included a php which did the database connection, and did a $result = mysql_query("mysuery");

 

How would I then convert the value of $result into a smarty variable $voipbalance?

 

Regards

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