Display Price in two different sizes?
Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive - and you get a link from my homepage to your site. Cheers!
At the official osCommerce forum, Matt asked;
How can I get the prices to display with two different sized fonts ie $129.95
You can plainly see that he is trying to show the cents in a different way than the dollars. This is very easy to accomplish;
Open up /includes/classes/currencies.php
Find:
-
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'];
-
} 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'];
-
}
Change to:
-
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'];
-
$format_string = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . '<sup>' . $format_string[1] . '</sup>';
-
} 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 = $format_string[0] . $this->currencies[$currency_type]['decimal_point'] . '<sup>' . $format_string[1] . '</sup>';
-
}
You can style the "sup" appropriately using css, this would be done in the stylesheet.css file.
Easy as 123.


