Public Member Functions | |
toOptionArray () | |
setFirstStoreFlag ($flag=false) | |
addStoreFilter ($store, $withAdmin=true) | |
Protected Member Functions | |
_construct () | |
_afterLoad () | |
Protected Attributes | |
$_previewFlag |
Definition at line 35 of file Collection.php.
_afterLoad | ( | ) | [protected] |
Reimplemented from Varien_Data_Collection_Db.
Definition at line 55 of file Collection.php.
00056 { 00057 if ($this->_previewFlag) { 00058 $items = $this->getColumnValues('page_id'); 00059 if (count($items)) { 00060 $select = $this->getConnection()->select() 00061 ->from($this->getTable('cms/page_store')) 00062 ->where($this->getTable('cms/page_store').'.page_id IN (?)', $items); 00063 if ($result = $this->getConnection()->fetchPairs($select)) { 00064 foreach ($this as $item) { 00065 if (!isset($result[$item->getData('page_id')])) { 00066 continue; 00067 } 00068 if ($result[$item->getData('page_id')] == 0) { 00069 $stores = Mage::app()->getStores(false, true); 00070 $storeId = current($stores)->getId(); 00071 $storeCode = key($stores); 00072 } else { 00073 $storeId = $result[$item->getData('page_id')]; 00074 $storeCode = Mage::app()->getStore($storeId)->getCode(); 00075 } 00076 $item->setData('_first_store_id', $storeId); 00077 $item->setData('store_code', $storeCode); 00078 } 00079 } 00080 } 00081 } 00082 00083 parent::_afterLoad(); 00084 }
_construct | ( | ) | [protected] |
Initialization here
Reimplemented from Mage_Core_Model_Mysql4_Collection_Abstract.
Definition at line 39 of file Collection.php.
00040 { 00041 $this->_init('cms/page'); 00042 }
addStoreFilter | ( | $ | store, | |
$ | withAdmin = true | |||
) |
Add Filter by store
int|Mage_Core_Model_Store | $store |
Definition at line 92 of file Collection.php.
00093 { 00094 if ($store instanceof Mage_Core_Model_Store) { 00095 $store = array($store->getId()); 00096 } 00097 00098 $this->getSelect()->join( 00099 array('store_table' => $this->getTable('cms/page_store')), 00100 'main_table.page_id = store_table.page_id', 00101 array() 00102 ) 00103 ->where('store_table.store_id in (?)', ($withAdmin ? array(0, $store) : $store)) 00104 ->group('main_table.page_id'); 00105 00106 return $this; 00107 }
setFirstStoreFlag | ( | $ | flag = false |
) |
toOptionArray | ( | ) |
Reimplemented from Varien_Data_Collection.
Definition at line 44 of file Collection.php.
00045 { 00046 return $this->_toOptionArray('identifier', 'title'); 00047 }
$_previewFlag [protected] |
Definition at line 37 of file Collection.php.