shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

currency.php (1124B)


      1 <?php
      2 class ModelLocalisationCurrency extends Model {
      3 	public function getCurrencyByCode($currency) {
      4 		$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "currency WHERE code = '" . $this->db->escape($currency) . "'");
      5 
      6 		return $query->row;
      7 	}
      8 
      9 	public function getCurrencies() {
     10 		$currency_data = $this->cache->get('currency');
     11 
     12 		if (!$currency_data) {
     13 			$currency_data = array();
     14 
     15 			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency ORDER BY title ASC");
     16 
     17 			foreach ($query->rows as $result) {
     18 				$currency_data[$result['code']] = array(
     19 					'currency_id'   => $result['currency_id'],
     20 					'title'         => $result['title'],
     21 					'code'          => $result['code'],
     22 					'symbol_left'   => $result['symbol_left'],
     23 					'symbol_right'  => $result['symbol_right'],
     24 					'decimal_place' => $result['decimal_place'],
     25 					'value'         => $result['value'],
     26 					'status'        => $result['status'],
     27 					'date_modified' => $result['date_modified']
     28 				);
     29 			}
     30 
     31 			$this->cache->set('currency', $currency_data);
     32 		}
     33 
     34 		return $currency_data;
     35 	}
     36 }