Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding currency symbol to side infobox


ianric

Recommended Posts

Hi

 

I have modded my currencies box so that it displays the left currency symbol in the box heading which works but only on pages where a price is displayed. It doesn't display on info, help, privacy, empty shopping cart, my account etc pages.

 

Is there a way to force it to display no matter what page you are on. The flags still show but not the currency symbol.

 

In the currency class I have added 2 lines

 

// class methods
function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
  global $currency;

//added this global line, not sure why... seems to be needed
  global $cur_symb;

  if (empty($currency_type)) $currency_type = $currency;

//added this variable and tried different places
$cur_symb = $this->currencies[$currency_type]['symbol_left'];

  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'];
  }

  return $format_string;
}

 

In the currency box, I've modded

 

<?php
$info_box_contents = array();

//Added a few spaces to test. Also added a country flag symbol
If ($currency == GBP){
	$info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES . '    ' . $cur_symb . '  <img border="0" src="images/uk.gif">');

}	else if ($currency == EUR) {etc etc etc

 

I'm thinking that the variable in the currency class may need adding to other functions in the class but can't find which one. It still fails to display

 

Hope some kind person can help

 

Cheers

 

Ian

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...