Public Member Functions | |
__construct () | |
joinRates ($currency) | |
addLanguageFilter ($lang=null) | |
addCodeFilter ($code) | |
toOptionArray () | |
Protected Attributes | |
$_currencyTable | |
$_currencyNameTable | |
$_currencyRateTable |
Definition at line 34 of file Collection.php.
__construct | ( | ) |
Reimplemented from Varien_Data_Collection.
Definition at line 40 of file Collection.php.
00041 { 00042 $resource = Mage::getSingleton('core/resource'); 00043 parent::__construct($resource->getConnection('directory_read')); 00044 $this->_currencyTable = $resource->getTableName('directory/currency'); 00045 $this->_currencyNameTable = $resource->getTableName('directory/currency_name'); 00046 $this->_currencyRateTable = $resource->getTableName('directory/currency_rate'); 00047 00048 $this->_select->from(array('main_table'=>$this->_currencyNameTable)); 00049 /*$this->_select->join(array('name_table'=>$this->_currencyNameTable), 00050 "main_table.currency_code=name_table.currency_code");*/ 00051 00052 $this->setItemObjectClass(Mage::getConfig()->getModelClassName('directory/currency')); 00053 }
addCodeFilter | ( | $ | code | ) |
Add currency code condition
string | $code |
Definition at line 85 of file Collection.php.
00086 { 00087 if (is_array($code)) { 00088 $this->addFilter("codes", 00089 $this->getConnection()->quoteInto("main_table.currency_code IN (?)", $code), 00090 'string' 00091 ); 00092 } 00093 else { 00094 $this->addFilter("code_$code", "main_table.currency_code='$code'", 'string'); 00095 } 00096 return $this; 00097 }
addLanguageFilter | ( | $ | lang = null |
) |
Set language condition by name table
string | $lang |
Definition at line 70 of file Collection.php.
00071 { 00072 if (is_null($lang)) { 00073 $lang = Mage::app()->getStore()->getLanguageCode(); 00074 } 00075 $this->addFilter('language', "main_table.language_code='$lang'", 'string'); 00076 return $this; 00077 }
joinRates | ( | $ | currency | ) |
Definition at line 55 of file Collection.php.
00056 { 00057 $alias = $currency.'_rate'; 00058 $this->_select->joinLeft(array($alias=>$this->_currencyRateTable), 00059 $this->getConnection()->quoteInto("$alias.currency_to=main_table.currency_code AND $alias.currency_from=?", $currency), 00060 'rate'); 00061 return $this; 00062 }
toOptionArray | ( | ) |
Reimplemented from Varien_Data_Collection.
Definition at line 99 of file Collection.php.
00100 { 00101 return $this->_toOptionArray('currency_code', 'currency_name'); 00102 }
$_currencyNameTable [protected] |
Definition at line 37 of file Collection.php.
$_currencyRateTable [protected] |
Definition at line 38 of file Collection.php.
$_currencyTable [protected] |
Definition at line 36 of file Collection.php.