Mage_Core_Model_Store_Group Class Reference

Inheritance diagram for Mage_Core_Model_Store_Group:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 setStores ($stores)
 getStoreCollection ()
 getStores ()
 getStoreIds ()
 getStoreCodes ()
 getStoresCount ()
 getDefaultStore ()
 setWebsite (Mage_Core_Model_Website $website)
 getWebsite ()
 isCanDelete ()
 getDefaultStoreId ()
 getRootCategoryId ()
 getWebsiteId ()
 isReadOnly ($value=null)

Public Attributes

const CACHE_TAG = 'store_group'

Protected Member Functions

 _construct ()
 _loadStores ()
 _beforeDelete ()

Protected Attributes

 $_cacheTag = true
 $_eventPrefix = 'store_group'
 $_eventObject = 'store_group'
 $_stores
 $_storeIds = array()
 $_storeCodes = array()
 $_storesCount = 0
 $_defaultStore
 $_website


Detailed Description

Definition at line 35 of file Group.php.


Member Function Documentation

_beforeDelete (  )  [protected]

Processing object before delete data

Returns:
Mage_Core_Model_Abstract

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 276 of file Group.php.

00277     {
00278         $this->_protectFromNonAdmin();
00279         return parent::_beforeDelete();
00280     }

_construct (  )  [protected]

init model

Reimplemented from Varien_Object.

Definition at line 102 of file Group.php.

00103     {
00104         $this->_init('core/store_group');
00105     }

_loadStores (  )  [protected]

Load store collection and set internal data

Definition at line 111 of file Group.php.

00112     {
00113         $this->_stores = array();
00114         $this->_storesCount = 0;
00115         foreach ($this->getStoreCollection() as $store) {
00116             $this->_stores[$store->getId()] = $store;
00117             $this->_storeIds[$store->getId()] = $store->getId();
00118             $this->_storeCodes[$store->getId()] = $store->getCode();
00119             if ($this->getDefaultStoreId() == $store->getId()) {
00120                 $this->_defaultStore = $store;
00121             }
00122             $this->_storesCount ++;
00123         }
00124     }

getDefaultStore (  ) 

Retrieve default store model

Returns:
Mage_Core_Model_Store

Definition at line 210 of file Group.php.

00211     {
00212         if (!$this->getDefaultStoreId()) {
00213             return false;
00214         }
00215         if (is_null($this->_stores)) {
00216             $this->_loadStores();
00217         }
00218         return $this->_defaultStore;
00219     }

getDefaultStoreId (  ) 

Definition at line 261 of file Group.php.

00262     {
00263         return $this->_getData('default_store_id');
00264     }

getRootCategoryId (  ) 

Definition at line 266 of file Group.php.

00267     {
00268         return $this->_getData('root_category_id');
00269     }

getStoreCodes (  ) 

Retrieve website store codes

Returns:
array

Definition at line 189 of file Group.php.

00190     {
00191         if (is_null($this->_stores)) {
00192             $this->_loadStores();
00193         }
00194         return $this->_storeCodes;
00195     }

getStoreCollection (  ) 

Retrieve new (not loaded) Store collection object with group filter

Returns:
Mage_Core_Model_Mysql4_Store_Collection

Definition at line 151 of file Group.php.

00152     {
00153         return Mage::getModel('core/store')
00154             ->getCollection()
00155             ->addGroupFilter($this->getId());
00156     }

getStoreIds (  ) 

Retrieve website store ids

Returns:
array

Definition at line 176 of file Group.php.

00177     {
00178         if (is_null($this->_stores)) {
00179             $this->_loadStores();
00180         }
00181         return $this->_storeIds;
00182     }

getStores (  ) 

Retrieve wersite store objects

Returns:
array

Definition at line 163 of file Group.php.

00164     {
00165         if (is_null($this->_stores)) {
00166             $this->_loadStores();
00167         }
00168         return $this->_stores;
00169     }

getStoresCount (  ) 

Definition at line 197 of file Group.php.

00198     {
00199         if (is_null($this->_stores)) {
00200             $this->_loadStores();
00201         }
00202         return $this->_storesCount;
00203     }

getWebsite (  ) 

Retrieve website model

Returns:
Mage_Core_Model_Website

Definition at line 236 of file Group.php.

00237     {
00238         if (is_null($this->getWebsiteId())) {
00239             return false;
00240         }
00241         if (is_null($this->_website)) {
00242             $this->_website = Mage::app()->getWebsite($this->getWebsiteId());
00243         }
00244         return $this->_website;
00245     }

getWebsiteId (  ) 

Definition at line 271 of file Group.php.

00272     {
00273         return $this->_getData('website_id');
00274     }

isCanDelete (  ) 

Is can delete group

Returns:
bool

Definition at line 252 of file Group.php.

00253     {
00254         if (!$this->getId()) {
00255             return false;
00256         }
00257 
00258         return $this->getWebsite()->getDefaultGroupId() != $this->getId();
00259     }

isReadOnly ( value = null  ) 

Get/Set isReadOnly flag

Parameters:
bool $value
Returns:
bool

Definition at line 288 of file Group.php.

00289     {
00290         if (null !== $value) {
00291             $this->_isReadOnly = (bool)$value;
00292         }
00293         return $this->_isReadOnly;
00294     }

setStores ( stores  ) 

Set website stores

Parameters:
array $stores

Definition at line 131 of file Group.php.

00132     {
00133         $this->_stores = array();
00134         $this->_storesCount = 0;
00135         foreach ($stores as $store) {
00136             $this->_stores[$store->getId()] = $store;
00137             $this->_storeIds[$store->getId()] = $store->getId();
00138             $this->_storeCodes[$store->getId()] = $store->getCode();
00139             if ($this->getDefaultStoreId() == $store->getId()) {
00140                 $this->_defaultStore = $store;
00141             }
00142             $this->_storesCount ++;
00143         }
00144     }

setWebsite ( Mage_Core_Model_Website website  ) 

Set website model

Parameters:
Mage_Core_Model_Website $website

Definition at line 226 of file Group.php.

00227     {
00228         $this->_website = $website;
00229     }


Member Data Documentation

$_cacheTag = true [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 39 of file Group.php.

$_defaultStore [protected]

Definition at line 84 of file Group.php.

$_eventObject = 'store_group' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 49 of file Group.php.

$_eventPrefix = 'store_group' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 44 of file Group.php.

$_storeCodes = array() [protected]

Definition at line 70 of file Group.php.

$_storeIds = array() [protected]

Definition at line 63 of file Group.php.

$_stores [protected]

Definition at line 56 of file Group.php.

$_storesCount = 0 [protected]

Definition at line 77 of file Group.php.

$_website [protected]

Definition at line 91 of file Group.php.

const CACHE_TAG = 'store_group'

Definition at line 37 of file Group.php.


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

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