Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage
  • Mage_Adminhtml_Block_Html_Date
  • Mage_Adminhtml_Block_Html_Select
  • Mage_Api_Model_Wsdl_Config_Element
  • Mage_Captcha_Adminhtml_RefreshController
  • Mage_Captcha_RefreshController
  • Mage_Core_AjaxController
  • Mage_Core_Block_Abstract
  • Mage_Core_Block_Flush
  • Mage_Core_Block_Html_Calendar
  • Mage_Core_Block_Html_Date
  • Mage_Core_Block_Html_Link
  • Mage_Core_Block_Html_Select
  • Mage_Core_Block_Messages
  • Mage_Core_Block_Profiler
  • Mage_Core_Block_Store_Switcher
  • Mage_Core_Block_Template
  • Mage_Core_Block_Template_Facade
  • Mage_Core_Block_Template_Smarty
  • Mage_Core_Block_Template_Zend
  • Mage_Core_Block_Text
  • Mage_Core_Block_Text_List
  • Mage_Core_Block_Text_List_Item
  • Mage_Core_Block_Text_List_Link
  • Mage_Core_Block_Text_Tag
  • Mage_Core_Block_Text_Tag_Css
  • Mage_Core_Block_Text_Tag_Css_Admin
  • Mage_Core_Block_Text_Tag_Debug
  • Mage_Core_Block_Text_Tag_Js
  • Mage_Core_Block_Text_Tag_Meta
  • Mage_Core_Controller_Front_Action
  • Mage_Core_Controller_Front_Router
  • Mage_Core_Controller_Request_Http
  • Mage_Core_Controller_Response_Http
  • Mage_Core_Controller_Varien_Action
  • Mage_Core_Controller_Varien_Front
  • Mage_Core_Controller_Varien_Router_Abstract
  • Mage_Core_Controller_Varien_Router_Admin
  • Mage_Core_Controller_Varien_Router_Default
  • Mage_Core_Controller_Varien_Router_Standard
  • Mage_Core_Helper_Abstract
  • Mage_Core_Helper_Cookie
  • Mage_Core_Helper_Data
  • Mage_Core_Helper_File_Storage
  • Mage_Core_Helper_File_Storage_Database
  • Mage_Core_Helper_Hint
  • Mage_Core_Helper_Http
  • Mage_Core_Helper_Js
  • Mage_Core_Helper_String
  • Mage_Core_Helper_Translate
  • Mage_Core_Helper_Url
  • Mage_Core_Helper_Url_Rewrite
  • Mage_Core_IndexController
  • Mage_Core_Model_Abstract
  • Mage_Core_Model_App
  • Mage_Core_Model_App_Area
  • Mage_Core_Model_App_Emulation
  • Mage_Core_Model_Cache
  • Mage_Core_Model_Calculator
  • Mage_Core_Model_Config
  • Mage_Core_Model_Config_Base
  • Mage_Core_Model_Config_Data
  • Mage_Core_Model_Config_Element
  • Mage_Core_Model_Config_Options
  • Mage_Core_Model_Config_System
  • Mage_Core_Model_Cookie
  • Mage_Core_Model_Date
  • Mage_Core_Model_Design
  • Mage_Core_Model_Design_Package
  • Mage_Core_Model_Design_Source_Design
  • Mage_Core_Model_Email
  • Mage_Core_Model_Email_Info
  • Mage_Core_Model_Email_Template
  • Mage_Core_Model_Email_Template_Filter
  • Mage_Core_Model_Email_Template_Mailer
  • Mage_Core_Model_Email_Transport
  • Mage_Core_Model_Encryption
  • Mage_Core_Model_File_Storage
  • Mage_Core_Model_File_Storage_Abstract
  • Mage_Core_Model_File_Storage_Database
  • Mage_Core_Model_File_Storage_Database_Abstract
  • Mage_Core_Model_File_Storage_Directory_Database
  • Mage_Core_Model_File_Storage_File
  • Mage_Core_Model_File_Storage_Flag
  • Mage_Core_Model_File_Uploader
  • Mage_Core_Model_File_Validator_AvailablePath
  • Mage_Core_Model_File_Validator_NotProtectedExtension
  • Mage_Core_Model_Flag
  • Mage_Core_Model_Input_Filter
  • Mage_Core_Model_Input_Filter_MaliciousCode
  • Mage_Core_Model_Language
  • Mage_Core_Model_Layout
  • Mage_Core_Model_Layout_Data
  • Mage_Core_Model_Layout_Element
  • Mage_Core_Model_Layout_Update
  • Mage_Core_Model_Locale
  • Mage_Core_Model_Locale_Config
  • Mage_Core_Model_Log_Adapter
  • Mage_Core_Model_Magento_Api
  • Mage_Core_Model_Magento_Api_V2
  • Mage_Core_Model_Message
  • Mage_Core_Model_Message_Abstract
  • Mage_Core_Model_Message_Collection
  • Mage_Core_Model_Message_Error
  • Mage_Core_Model_Message_Notice
  • Mage_Core_Model_Message_Success
  • Mage_Core_Model_Message_Warning
  • Mage_Core_Model_Mysql4_Abstract
  • Mage_Core_Model_Mysql4_Cache
  • Mage_Core_Model_Mysql4_Collection_Abstract
  • Mage_Core_Model_Mysql4_Config
  • Mage_Core_Model_Mysql4_Config_Data
  • Mage_Core_Model_Mysql4_Config_Data_Collection
  • Mage_Core_Model_Mysql4_Design
  • Mage_Core_Model_Mysql4_Design_Collection
  • Mage_Core_Model_Mysql4_Design_Package_Collection
  • Mage_Core_Model_Mysql4_Design_Theme
  • Mage_Core_Model_Mysql4_Email_Template
  • Mage_Core_Model_Mysql4_Email_Template_Collection
  • Mage_Core_Model_Mysql4_File_Storage_Abstract
  • Mage_Core_Model_Mysql4_File_Storage_Database
  • Mage_Core_Model_Mysql4_File_Storage_Directory_Database
  • Mage_Core_Model_Mysql4_File_Storage_File
  • Mage_Core_Model_Mysql4_Flag
  • Mage_Core_Model_Mysql4_Language
  • Mage_Core_Model_Mysql4_Language_Collection
  • Mage_Core_Model_Mysql4_Layout
  • Mage_Core_Model_Mysql4_Resource
  • Mage_Core_Model_Mysql4_Session
  • Mage_Core_Model_Mysql4_Store
  • Mage_Core_Model_Mysql4_Store_Collection
  • Mage_Core_Model_Mysql4_Store_Group
  • Mage_Core_Model_Mysql4_Store_Group_Collection
  • Mage_Core_Model_Mysql4_Translate
  • Mage_Core_Model_Mysql4_Translate_String
  • Mage_Core_Model_Mysql4_Url_Rewrite
  • Mage_Core_Model_Mysql4_Url_Rewrite_Collection
  • Mage_Core_Model_Mysql4_Variable
  • Mage_Core_Model_Mysql4_Variable_Collection
  • Mage_Core_Model_Mysql4_Website
  • Mage_Core_Model_Mysql4_Website_Collection
  • Mage_Core_Model_Observer
  • Mage_Core_Model_Resource
  • Mage_Core_Model_Resource_Abstract
  • Mage_Core_Model_Resource_Cache
  • Mage_Core_Model_Resource_Config
  • Mage_Core_Model_Resource_Config_Data
  • Mage_Core_Model_Resource_Config_Data_Collection
  • Mage_Core_Model_Resource_Db_Abstract
  • Mage_Core_Model_Resource_Db_Collection_Abstract
  • Mage_Core_Model_Resource_Design
  • Mage_Core_Model_Resource_Design_Collection
  • Mage_Core_Model_Resource_Design_Package_Collection
  • Mage_Core_Model_Resource_Email_Template
  • Mage_Core_Model_Resource_Email_Template_Collection
  • Mage_Core_Model_Resource_Entity_Abstract
  • Mage_Core_Model_Resource_Entity_Table
  • Mage_Core_Model_Resource_File_Storage_Abstract
  • Mage_Core_Model_Resource_File_Storage_Database
  • Mage_Core_Model_Resource_File_Storage_Directory_Database
  • Mage_Core_Model_Resource_File_Storage_File
  • Mage_Core_Model_Resource_Flag
  • Mage_Core_Model_Resource_Helper_Abstract
  • Mage_Core_Model_Resource_Helper_Mysql4
  • Mage_Core_Model_Resource_Iterator
  • Mage_Core_Model_Resource_Language
  • Mage_Core_Model_Resource_Language_Collection
  • Mage_Core_Model_Resource_Layout
  • Mage_Core_Model_Resource_Resource
  • Mage_Core_Model_Resource_Session
  • Mage_Core_Model_Resource_Setup
  • Mage_Core_Model_Resource_Setup_Query_Modifier
  • Mage_Core_Model_Resource_Store
  • Mage_Core_Model_Resource_Store_Collection
  • Mage_Core_Model_Resource_Store_Group
  • Mage_Core_Model_Resource_Store_Group_Collection
  • Mage_Core_Model_Resource_Transaction
  • Mage_Core_Model_Resource_Translate
  • Mage_Core_Model_Resource_Translate_String
  • Mage_Core_Model_Resource_Type_Abstract
  • Mage_Core_Model_Resource_Type_Db
  • Mage_Core_Model_Resource_Type_Db_Mysqli
  • Mage_Core_Model_Resource_Type_Db_Mysqli_Setup
  • Mage_Core_Model_Resource_Type_Db_Pdo_Mysql
  • Mage_Core_Model_Resource_Url_Rewrite
  • Mage_Core_Model_Resource_Url_Rewrite_Collection
  • Mage_Core_Model_Resource_Variable
  • Mage_Core_Model_Resource_Variable_Collection
  • Mage_Core_Model_Resource_Website
  • Mage_Core_Model_Resource_Website_Collection
  • Mage_Core_Model_Session
  • Mage_Core_Model_Session_Abstract
  • Mage_Core_Model_Session_Abstract_Varien
  • Mage_Core_Model_Session_Abstract_Zend
  • Mage_Core_Model_Source_Email_Variables
  • Mage_Core_Model_Store
  • Mage_Core_Model_Store_Api
  • Mage_Core_Model_Store_Api_V2
  • Mage_Core_Model_Store_Group
  • Mage_Core_Model_Template
  • Mage_Core_Model_Translate
  • Mage_Core_Model_Translate_Expr
  • Mage_Core_Model_Translate_Inline
  • Mage_Core_Model_Translate_String
  • Mage_Core_Model_Url
  • Mage_Core_Model_Url_Rewrite
  • Mage_Core_Model_Url_Validator
  • Mage_Core_Model_Variable
  • Mage_Core_Model_Variable_Config
  • Mage_Core_Model_Variable_Observer
  • Mage_Core_Model_Website
  • Mage_Page_Block_Switch
  • Mage_Page_Block_Template_Container
  • Mage_Page_Block_Template_Links
  • Mage_Page_Block_Template_Links_Block
  • Mage_Sales_Model_Quote_Address_Total_Collector

Exceptions

  • Mage_Core_Controller_Varien_Exception
  • Mage_Core_Exception
  • Mage_Core_Model_Session_Exception
  • Mage_Core_Model_Store_Exception

Functions

  • destruct
  • is_dir_writeable
  • is_empty_date
  • mageCoreErrorHandler
  • mageDebugBacktrace
  • mageDelTree
  • mageFindClassFile
  • mageParseCsv
  • mageSendErrorFooter
  • mageSendErrorHeader
  • mageUndoMagicQuotes
  • now
  • sys_get_temp_dir
  • uc_words
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Core
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Store group model
 29:  *
 30:  * @method Mage_Core_Model_Resource_Store_Group _getResource()
 31:  * @method Mage_Core_Model_Resource_Store_Group getResource()
 32:  * @method Mage_Core_Model_Store_Group setWebsiteId(int $value)
 33:  * @method string getName()
 34:  * @method Mage_Core_Model_Store_Group setName(string $value)
 35:  * @method Mage_Core_Model_Store_Group setRootCategoryId(int $value)
 36:  * @method Mage_Core_Model_Store_Group setDefaultStoreId(int $value)
 37:  *
 38:  * @category    Mage
 39:  * @package     Mage_Core
 40:  * @author      Magento Core Team <core@magentocommerce.com>
 41:  */
 42: 
 43: class Mage_Core_Model_Store_Group extends Mage_Core_Model_Abstract
 44: {
 45:     const ENTITY         = 'store_group';
 46:     const CACHE_TAG      = 'store_group';
 47: 
 48:     protected $_cacheTag = true;
 49: 
 50:     /**
 51:      * @var string
 52:      */
 53:     protected $_eventPrefix = 'store_group';
 54: 
 55:     /**
 56:      * @var string
 57:      */
 58:     protected $_eventObject = 'store_group';
 59: 
 60:     /**
 61:      * Group Store collection array
 62:      *
 63:      * @var array
 64:      */
 65:     protected $_stores;
 66: 
 67:     /**
 68:      * Group store ids array
 69:      *
 70:      * @var array
 71:      */
 72:     protected $_storeIds = array();
 73: 
 74:     /**
 75:      * Group store codes array
 76:      *
 77:      * @var array
 78:      */
 79:     protected $_storeCodes = array();
 80: 
 81:     /**
 82:      * The number of stores in a group
 83:      *
 84:      * @var int
 85:      */
 86:     protected $_storesCount = 0;
 87: 
 88:     /**
 89:      * Group default store
 90:      *
 91:      * @var Mage_Core_Model_Store
 92:      */
 93:     protected $_defaultStore;
 94: 
 95:     /**
 96:      * Website model
 97:      *
 98:      * @var Mage_Core_Model_Website
 99:      */
100:     protected $_website;
101: 
102:     /**
103:      * @var bool
104:      */
105:     private $_isReadOnly = false;
106: 
107:     /**
108:      * init model
109:      *
110:      */
111:     protected function _construct()
112:     {
113:         $this->_init('core/store_group');
114:     }
115: 
116:     /**
117:      * Load store collection and set internal data
118:      *
119:      */
120:     protected function _loadStores()
121:     {
122:         $this->_stores = array();
123:         $this->_storesCount = 0;
124:         foreach ($this->getStoreCollection() as $store) {
125:             $this->_stores[$store->getId()] = $store;
126:             $this->_storeIds[$store->getId()] = $store->getId();
127:             $this->_storeCodes[$store->getId()] = $store->getCode();
128:             if ($this->getDefaultStoreId() == $store->getId()) {
129:                 $this->_defaultStore = $store;
130:             }
131:             $this->_storesCount ++;
132:         }
133:     }
134: 
135:     /**
136:      * Set website stores
137:      *
138:      * @param array $stores
139:      */
140:     public function setStores($stores)
141:     {
142:         $this->_stores = array();
143:         $this->_storesCount = 0;
144:         foreach ($stores as $store) {
145:             $this->_stores[$store->getId()] = $store;
146:             $this->_storeIds[$store->getId()] = $store->getId();
147:             $this->_storeCodes[$store->getId()] = $store->getCode();
148:             if ($this->getDefaultStoreId() == $store->getId()) {
149:                 $this->_defaultStore = $store;
150:             }
151:             $this->_storesCount ++;
152:         }
153:     }
154: 
155:     /**
156:      * Retrieve new (not loaded) Store collection object with group filter
157:      *
158:      * @return Mage_Core_Model_Mysql4_Store_Collection
159:      */
160:     public function getStoreCollection()
161:     {
162:         return Mage::getModel('core/store')
163:             ->getCollection()
164:             ->addGroupFilter($this->getId());
165:     }
166: 
167:     /**
168:      * Retrieve wersite store objects
169:      *
170:      * @return array
171:      */
172:     public function getStores()
173:     {
174:         if (is_null($this->_stores)) {
175:             $this->_loadStores();
176:         }
177:         return $this->_stores;
178:     }
179: 
180:     /**
181:      * Retrieve website store ids
182:      *
183:      * @return array
184:      */
185:     public function getStoreIds()
186:     {
187:         if (is_null($this->_stores)) {
188:             $this->_loadStores();
189:         }
190:         return $this->_storeIds;
191:     }
192: 
193:     /**
194:      * Retrieve website store codes
195:      *
196:      * @return array
197:      */
198:     public function getStoreCodes()
199:     {
200:         if (is_null($this->_stores)) {
201:             $this->_loadStores();
202:         }
203:         return $this->_storeCodes;
204:     }
205: 
206:     public function getStoresCount()
207:     {
208:         if (is_null($this->_stores)) {
209:             $this->_loadStores();
210:         }
211:         return $this->_storesCount;
212:     }
213: 
214:     /**
215:      * Retrieve default store model
216:      *
217:      * @return Mage_Core_Model_Store
218:      */
219:     public function getDefaultStore()
220:     {
221:         if (!$this->hasDefaultStoreId()) {
222:             return false;
223:         }
224:         if (is_null($this->_stores)) {
225:             $this->_loadStores();
226:         }
227:         return $this->_defaultStore;
228:     }
229: 
230:     /**
231:      * Get most suitable store by locale
232:      * If no store with given locale is found - default store is returned
233:      * If group has no stores - null is returned
234:      *
235:      * @param string $locale
236:      * @return Mage_Core_Model_Store|null
237:      */
238:     public function getDefaultStoreByLocale($locale)
239:     {
240:         if ($this->getDefaultStore() && $this->getDefaultStore()->getLocaleCode() == $locale) {
241:             return $this->getDefaultStore();
242:         } else {
243:             $stores = $this->getStoresByLocale($locale);
244:             if (count($stores)) {
245:                 return $stores[0];
246:             } else {
247:                 return $this->getDefaultStore() ? $this->getDefaultStore() : null;
248:             }
249:         }
250:     }
251: 
252:     /**
253:      * Retrieve list of stores with given locale
254:      *
255:      * @param $locale
256:      * @return array
257:      */
258:     public function getStoresByLocale($locale)
259:     {
260:         $stores = array();
261:         foreach ($this->getStores() as $store) {
262:             /* @var $store Mage_Core_Model_Store */
263:             if ($store->getLocaleCode() == $locale) {
264:                 array_push($stores, $store);
265:             }
266:         }
267:         return $stores;
268:     }
269: 
270:     /**
271:      * Set website model
272:      *
273:      * @param Mage_Core_Model_Website $website
274:      */
275:     public function setWebsite(Mage_Core_Model_Website $website)
276:     {
277:         $this->_website = $website;
278:     }
279: 
280:     /**
281:      * Retrieve website model
282:      *
283:      * @return Mage_Core_Model_Website
284:      */
285:     public function getWebsite()
286:     {
287:         if (is_null($this->getWebsiteId())) {
288:             return false;
289:         }
290:         if (is_null($this->_website)) {
291:             $this->_website = Mage::app()->getWebsite($this->getWebsiteId());
292:         }
293:         return $this->_website;
294:     }
295: 
296:     /**
297:      * Is can delete group
298:      *
299:      * @return bool
300:      */
301:     public function isCanDelete()
302:     {
303:         if (!$this->getId()) {
304:             return false;
305:         }
306: 
307:         return $this->getWebsite()->getDefaultGroupId() != $this->getId();
308:     }
309: 
310:     public function getDefaultStoreId()
311:     {
312:         return $this->_getData('default_store_id');
313:     }
314: 
315:     public function getRootCategoryId()
316:     {
317:         return $this->_getData('root_category_id');
318:     }
319: 
320:     public function getWebsiteId()
321:     {
322:         return $this->_getData('website_id');
323:     }
324: 
325:     protected function _beforeDelete()
326:     {
327:         $this->_protectFromNonAdmin();
328:         return parent::_beforeDelete();
329:     }
330: 
331:     /**
332:      * Get/Set isReadOnly flag
333:      *
334:      * @param bool $value
335:      * @return bool
336:      */
337:     public function isReadOnly($value = null)
338:     {
339:         if (null !== $value) {
340:             $this->_isReadOnly = (bool)$value;
341:         }
342:         return $this->_isReadOnly;
343:     }
344: }
345: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0