Display Price in two different sizes?

By | June 1, 2009

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:
[php]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’];
}[/php]

Change to:
[php]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 = explode($this->currencies[$currency_type][‘decimal_point’], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type][‘decimal_point’] . ‘‘ . $format_string[1] . ‘‘;
} 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 = explode($this->currencies[$currency_type][‘decimal_point’], $format_string);
$format_string = $format_string[0] . $this->currencies[$currency_type][‘decimal_point’] . ‘‘ . $format_string[1] . ‘‘;
}[/php]

You can style the “sup” appropriately using css, this would be done in the stylesheet.css file.

Easy as 123.

Leave a Reply

Your email address will not be published.