Google Currency Converter - How to change number of decimal places for the converted currency?

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.

Add comment


Security code
Refresh