Google Currency Converter - How to change number of decimal places for the converted currency?
Written by kksou   
Friday, 04 May 2012

This is in response to asscore's question - How to change number of places after the decimal for the Google Currency Converter module.

By default, Google returns the converted currency in 4 decimal places. To change to 2 decimal places, all we need to do is to grab the value of the converted currency and use the standard PHP number_format() function to format it to 2 decimal places.


Solution

  1. Goto the folder: <Joomla_Root_Folder>/modules/mod_googlecurrencyconverter
  2. Edit the file: mod_googlecurrencyconverter_lib.php
  3. Goto line 52. You should see:
  4. $data = $app->process();

    The variable $data contains the value of the converted currency.

  5. Add one more line after this:
  6. $data = number_format($data, 2);

    This will format the output to 2 decimal places.

  7. Don't forget to save the file.

 
< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. kksou.com. All Rights Reserved