Remitur Posted April 1, 2016 Share Posted April 1, 2016 How do I get the currency exchange rate used by WHMCS? I need the value which is automatically updated daily, used to update service prices in Setup => Payments => currencies ... does exist any system variables to get it, or do I have to read it from the db ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 1, 2016 Share Posted April 1, 2016 I think you'll have to read it from the database. if it helps, I can share a cut-down version of an action hook I wrote for a client - they had two currencies in their setup and wanted access to the exchange rate... <?php use Illuminate\Database\Capsule\Manager as Capsule; function hook_currency_exchange_rates($vars) { $exchangerate = Capsule::table('tblcurrencies') ->where('default', '0') ->get(); return array("exchangerate" => $exchangerate[0]->rate); } add_hook("ClientAreaPage", 1, "hook_currency_exchange_rates"); ?> that will create a Smarty variable, {$exchangerate}, which you can use in the client area. if you have more than two currencies and require the rate of a specific currency, then you can simply change the where statement to look at the 'id' or 'code' values instead. 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted April 1, 2016 Author Share Posted April 1, 2016 Thank you! It's exactly what I was looking for! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.