Eduardo G. Posted August 2, 2012 Share Posted August 2, 2012 Hi all, I have a (maybe silly) question about formatCurrency() function as I want to use it from a custom addon. I've configured my only currecy euro as shown on attachment. When I run this code: $value = '4.40'; echo "value is: " . formatCurrency($value) . "<br>\n"; $value = '4,40'; echo "value is: " . formatCurrency($value) . "<br>\n"; $value = '4'; echo "value is: " . formatCurrency($value) . "<br>\n"; I get this output: value is: 4 value is: 4 value is: 4 I'm using it from a custom function inside a custom addon. What am I doing wrong with this function? P.S. using latest 5.1.2 Thanks. 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted August 2, 2012 Share Posted August 2, 2012 Before making the first formatCurrency call, add this line which gets the current users currency and see if that helps at all. $currency = getCurrency($userid); 0 Quote Link to comment Share on other sites More sharing options...
Eduardo G. Posted August 2, 2012 Author Share Posted August 2, 2012 Thanks. I get nothing new :-( As documentation says: "You must call the first function first unless you are only wanting to display a value in the default system currency." and that's exactly what I want. Even using that line above, I get exactly same input. I don't know where the mistake is :-( 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted August 3, 2012 Share Posted August 3, 2012 I did some quick tests and it looks like this function only works properly in the client area but if you try and call this function and your outputting data to the admin area it doesn't work. I would recommend opening a ticket with WHMCS and see if this is a workaround or if they can fix it. 0 Quote Link to comment Share on other sites More sharing options...
webadpro Posted February 10, 2013 Share Posted February 10, 2013 Hi, Do the following: --- global $currency; $currency = getCurrency(); formatCurrency($value) --- That should fix it. Enjoy. 0 Quote Link to comment Share on other sites More sharing options...
U2Pas Posted January 2, 2014 Share Posted January 2, 2014 thanks - did the trick 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.