Mage_Directory_Block_Currency Class Reference

Inheritance diagram for Mage_Directory_Block_Currency:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getCurrencyCount ()
 getCurrencies ()
 getSwitchUrl ()
 getCurrentCurrencyCode ()


Detailed Description

Definition at line 34 of file Currency.php.


Member Function Documentation

getCurrencies (  ) 

Retrieve currencies array Return array: code => currency name Return empty array if only one currency

Returns:
array

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

Returns:
int

Definition at line 42 of file Currency.php.

00043     {
00044         return count($this->getCurrencies());
00045     }

getCurrentCurrencyCode (  ) 

Retrieve Current Currency code

Returns:
string

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

Returns:
string

Definition at line 84 of file Currency.php.

00085     {
00086         return $this->getUrl('directory/currency/switch');
00087     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:06 2009 for Magento by  doxygen 1.5.8