Public Member Functions | |
getCurrencyCount () | |
getCurrencies () | |
getSwitchUrl () | |
getCurrentCurrencyCode () |
Definition at line 34 of file Currency.php.
getCurrencies | ( | ) |
Retrieve currencies array Return array: code => currency name Return empty array if only one currency
Definition at line 54 of file Currency.php.
00055 { 00056 $currencies = $this->getData('currencies'); 00057 if (is_null($currencies)) { 00058 $currencies = array(); 00059 $codes = Mage::app()->getStore()->getAvailableCurrencyCodes(true); 00060 if (is_array($codes) && count($codes) > 1) { 00061 $rates = Mage::getModel('directory/currency')->getCurrencyRates( 00062 Mage::app()->getStore()->getBaseCurrency(), 00063 $codes 00064 ); 00065 00066 foreach ($codes as $code) { 00067 if (isset($rates[$code])) { 00068 $currencies[$code] = Mage::app()->getLocale() 00069 ->getTranslation($code, 'nametocurrency'); 00070 } 00071 } 00072 } 00073 00074 $this->setData('currencies', $currencies); 00075 } 00076 return $currencies; 00077 }
getCurrencyCount | ( | ) |
Retrieve count of currencies Return 0 if only one currency
Definition at line 42 of file Currency.php.
00043 { 00044 return count($this->getCurrencies()); 00045 }
getCurrentCurrencyCode | ( | ) |
Retrieve Current Currency code
Definition at line 94 of file Currency.php.
00095 { 00096 $code = $this->getData('current_currency_code'); 00097 if (is_null($code)) { 00098 $code = Mage::app()->getStore()->getCurrentCurrencyCode(); 00099 $this->setData('current_currency_code', $code); 00100 } 00101 return $code; 00102 }
getSwitchUrl | ( | ) |
Retrieve Currency Swith URL
Definition at line 84 of file Currency.php.
00085 { 00086 return $this->getUrl('directory/currency/switch'); 00087 }