/** * Get store groups for specified website * * @param Mage_Core_Model_Website|int $website * @return array */ public function getStoreGroups($website) { if (!$website instanceof Mage_Core_Model_Website) { $website = $this->_application->getWebsite($website); } return $website->getGroups(); }
/** * Get configuration for stores base urls. * * array( * $index => array( * 'store_id' => $storeId, * 'base_url' => $url, * 'cookie' => $cookie * ) * ) * * @return array */ public function getStoresInfo() { $baseUrls = array(); foreach ($this->_app->getStores() as $store) { /** @var $store Mage_Core_Model_Store */ $website = $this->_app->getWebsite($store->getWebsiteId()); if ($website->getIsStaging() || Mage::helper('enterprise_websiterestriction')->getIsRestrictionEnabled($store)) { continue; } $baseUrl = $this->_app->getStore($store)->getBaseUrl(); $defaultCurrency = $this->_app->getStore($store)->getDefaultCurrencyCode(); $defaultWebsiteStore = $website->getDefaultStore(); $defaultWebsiteBaseUrl = $defaultWebsiteStore->getBaseUrl(); $cookie = ''; if ($baseUrl == $defaultWebsiteBaseUrl && $defaultWebsiteStore->getId() != $store->getId()) { $cookie = 'store=' . $store->getCode() . ';'; } $baseUrls[] = array('store_id' => $store->getId(), 'base_url' => $baseUrl, 'cookie' => $cookie); if ($store->getConfig(self::XML_PATH_CRAWL_MULTICURRENCY) && $store->getConfig(Enterprise_PageCache_Model_Processor::XML_PATH_CACHE_MULTICURRENCY)) { $currencies = $store->getAvailableCurrencyCodes(true); foreach ($currencies as $currencyCode) { if ($currencyCode != $defaultCurrency) { $baseUrls[] = array('store_id' => $store->getId(), 'base_url' => $baseUrl, 'cookie' => $cookie . 'currency=' . $currencyCode . ';'); } } } } return $baseUrls; }
/** * Retrieve default currency for selected store, website or website group * * @param Mage_Core_Controller_Request_Http $request * @return string */ public function getDefaultCurrency(Mage_Core_Controller_Request_Http $request) { if ($request->getParam('store')) { $store = $request->getParam('store'); $currencyCode = $this->_app->getStore($store)->getBaseCurrencyCode(); } else { if ($request->getParam('website')) { $website = $request->getParam('website'); $currencyCode = $this->_app->getWebsite($website)->getBaseCurrencyCode(); } else { if ($request->getParam('group')) { $group = $request->getParam('group'); $currencyCode = $this->_app->getGroup($group)->getWebsite()->getBaseCurrencyCode(); } else { $currencyCode = $this->_app->getStore()->getBaseCurrencyCode(); } } } return $currencyCode; }
/** * @expectedException Mage_Core_Exception */ public function testGetWebsiteNonExisting() { $this->assertNotEmpty($this->_mageModel->getWebsite()->getId()); $this->_mageModel->getWebsite(100); }
/** * Get captcha image base URL * * @param mixed $website * @return string */ public function getImgUrl($website = null) { return $this->_app->getStore()->getBaseUrl('media') . 'captcha' . '/' . $this->_app->getWebsite($website)->getCode() . '/'; }