currencies = array(); $currencies = $db->Execute("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES); while (!$currencies->EOF) { $this->currencies[$currencies->fields['code']] = array('title' => $currencies->fields['title'], 'symbol_left' => $currencies->fields['symbol_left'], 'symbol_right' => $currencies->fields['symbol_right'], 'decimal_point' => $currencies->fields['decimal_point'], 'thousands_point' => $currencies->fields['thousands_point'], 'decimal_places' => (int)$currencies->fields['decimal_places'], 'value' => $currencies->fields['value']); $currencies->MoveNext(); } } // class methods function format($number, $calculate_currency_value = true, $currency_type = DEFAULT_CURRENCY, $currency_value = '') { if ($calculate_currency_value) { $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value']; $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; // if the selected currency is in the european euro-conversion and the default currency is euro, // the currency will displayed in the national currency and euro currency if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) { $format_string .= ' [' . $this->format($number, true, 'EUR') . ']'; } } else { $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $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; } function get_value($code) { return $this->currencies[$code]['value']; } function get_decimal_places($code) { return $this->currencies[$code]['decimal_places']; } function display_price($products_price, $products_tax, $quantity = 1) { return $this->format(zen_add_tax($products_price, $products_tax) * $quantity); } }