Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to show more than 1 currency


Guest

Recommended Posts

Hi,

 

This may have been asked before so forgive a noobie lol

 

At present the prices in my store show as

 

£10.00

 

I would like to be able to show the price in dollars for example

 

£10.00 (US$ 19.74)

 

Can anyone point me in the right direction of what I need to change.

 

Thanks

 

Aran

Link to comment
Share on other sites

heh. yeah, as long as the place it prints it out uses the $currency->format(...) to print it, you can edit the includes/classes/currencies.php.

 

This section of the function format(...) in that file should be close to what you're looking for, just replace the EUR's with USD's:

 

	   if ($calculate_currency_value == true) {
	 $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
	 $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
	 $rate = $this->currencies['EUR']['value'];
	 $format_string .= " (" . $this->currencies['EUR']['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies['EUR']['decimal_places']), $this->currencies['EUR']['decimal_places'], $this->currencies['EUR']['decimal_point'], $this->currencies['EUR']['thousands_point']) . $this->currencies['EUR']['symbol_right'] . ")";
   } else {
	 $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
	 $format_string = " (" . $this->currencies['EUR']['symbol_left'] . number_format(tep_round($number, $this->currencies['EUR']['decimal_places']), $this->currencies['EUR']['decimal_places'], $this->currencies['EUR']['decimal_point'], $this->currencies['EUR']['thousands_point']) . $this->currencies['EUR']['symbol_right'] . ")";
   }

Link to comment
Share on other sites

heh. yeah, as long as the place it prints it out uses the $currency->format(...) to print it, you can edit the includes/classes/currencies.php.

 

This section of the function format(...) in that file should be close to what you're looking for, just replace the EUR's with USD's:

 

	   if ($calculate_currency_value == true) {
	 $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value'];
	 $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
	 $rate = $this->currencies['EUR']['value'];
	 $format_string .= " (" . $this->currencies['EUR']['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies['EUR']['decimal_places']), $this->currencies['EUR']['decimal_places'], $this->currencies['EUR']['decimal_point'], $this->currencies['EUR']['thousands_point']) . $this->currencies['EUR']['symbol_right'] . ")";
   } else {
	 $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
	 $format_string = " (" . $this->currencies['EUR']['symbol_left'] . number_format(tep_round($number, $this->currencies['EUR']['decimal_places']), $this->currencies['EUR']['decimal_places'], $this->currencies['EUR']['decimal_point'], $this->currencies['EUR']['thousands_point']) . $this->currencies['EUR']['symbol_right'] . ")";
   }

 

cheers matey that worked a treat :thumbsup:

 

Aran

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...