当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_App::getStores方法代码示例

本文整理汇总了PHP中Mage_Core_Model_App::getStores方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::getStores方法的具体用法?PHP Mage_Core_Model_App::getStores怎么用?PHP Mage_Core_Model_App::getStores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_App的用法示例。


在下文中一共展示了Mage_Core_Model_App::getStores方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _rewriteDb

 /**
  * Implement logic of custom rewrites
  *
  * @return bool
  */
 protected function _rewriteDb()
 {
     if (null === $this->_rewrite->getStoreId() || false === $this->_rewrite->getStoreId()) {
         $this->_rewrite->setStoreId($this->_app->getStore()->getId());
     }
     $requestCases = $this->_getRequestCases();
     $this->_rewrite->loadByRequestPath($requestCases);
     $fromStore = $this->_request->getQuery('___from_store');
     if (!$this->_rewrite->getId() && $fromStore) {
         $stores = $this->_app->getStores(false, true);
         if (!empty($stores[$fromStore])) {
             /** @var $store Mage_Core_Model_Store */
             $store = $stores[$fromStore];
             $fromStoreId = $store->getId();
         } else {
             return false;
         }
         $this->_rewrite->setStoreId($fromStoreId)->loadByRequestPath($requestCases);
         if (!$this->_rewrite->getId()) {
             return false;
         }
         // Load rewrite by id_path
         $currentStore = $this->_app->getStore();
         $this->_rewrite->setStoreId($currentStore->getId())->loadByIdPath($this->_rewrite->getIdPath());
         $this->_setStoreCodeCookie($currentStore->getCode());
         $targetUrl = $currentStore->getBaseUrl() . $this->_rewrite->getRequestPath();
         $this->_sendRedirectHeaders($targetUrl, true);
     }
     if (!$this->_rewrite->getId()) {
         return false;
     }
     $this->_request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $this->_rewrite->getRequestPath());
     $this->_processRedirectOptions();
     return true;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:40,代码来源:Request.php

示例2: getStoresInfo

 /**
  * 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;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:42,代码来源:Crawler.php

示例3: _initStores

 /**
  * Initialize stores data
  *
  * @param bool $withDefault
  * @return Mage_ImportExport_Model_Import_Entity_EavAbstract
  */
 protected function _initStores($withDefault = false)
 {
     /** @var $store Mage_Core_Model_Store */
     foreach ($this->_storeManager->getStores($withDefault) as $store) {
         $this->_storeCodeToId[$store->getCode()] = $store->getId();
     }
     return $this;
 }
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: insertRuleData

 /**
  * Inserts rule data into catalogrule/rule_product table
  *
  * @param Mage_CatalogRule_Model_Rule $rule
  * @param array $websiteIds
  * @param array $productIds
  */
 public function insertRuleData(Mage_CatalogRule_Model_Rule $rule, array $websiteIds, array $productIds = array())
 {
     /** @var $write Varien_Db_Adapter_Interface */
     $write = $this->_getWriteAdapter();
     $customerGroupIds = $rule->getCustomerGroupIds();
     $fromTime = (int) strtotime($rule->getFromDate());
     $toTime = (int) strtotime($rule->getToDate());
     $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
     $sortOrder = (int) $rule->getSortOrder();
     $actionOperator = $rule->getSimpleAction();
     $actionAmount = (double) $rule->getDiscountAmount();
     $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
     $subActionAmount = (double) $rule->getSubDiscountAmount();
     $actionStop = (int) $rule->getStopRulesProcessing();
     /** @var $helper Mage_Catalog_Helper_Product_Flat */
     $helper = $this->_factory->getHelper('catalog/product_flat');
     if ($helper->isEnabled() && $helper->isBuiltAllStores()) {
         /** @var $store Mage_Core_Model_Store */
         foreach ($this->_app->getStores(false) as $store) {
             if (in_array($store->getWebsiteId(), $websiteIds)) {
                 /** @var $selectByStore Varien_Db_Select */
                 $selectByStore = $rule->getProductFlatSelect($store->getId())->joinLeft(array('cg' => $this->getTable('customer/customer_group')), $write->quoteInto('cg.customer_group_id IN (?)', $customerGroupIds), array('cg.customer_group_id'))->reset(Varien_Db_Select::COLUMNS)->columns(array(new Zend_Db_Expr($store->getWebsiteId()), 'cg.customer_group_id', 'p.entity_id', new Zend_Db_Expr($rule->getId()), new Zend_Db_Expr($fromTime), new Zend_Db_Expr($toTime), new Zend_Db_Expr("'" . $actionOperator . "'"), new Zend_Db_Expr($actionAmount), new Zend_Db_Expr($actionStop), new Zend_Db_Expr($sortOrder), new Zend_Db_Expr("'" . $subActionOperator . "'"), new Zend_Db_Expr($subActionAmount)));
                 if (count($productIds) > 0) {
                     $selectByStore->where('p.entity_id IN (?)', array_keys($productIds));
                 }
                 $selects = $write->selectsByRange('entity_id', $selectByStore, self::RANGE_PRODUCT_STEP);
                 foreach ($selects as $select) {
                     $write->query($write->insertFromSelect($select, $this->getTable('catalogrule/rule_product'), array('website_id', 'customer_group_id', 'product_id', 'rule_id', 'from_time', 'to_time', 'action_operator', 'action_amount', 'action_stop', 'sort_order', 'sub_simple_action', 'sub_discount_amount'), Varien_Db_Adapter_Interface::INSERT_IGNORE));
                 }
             }
         }
     } else {
         if (count($productIds) == 0) {
             Varien_Profiler::start('__MATCH_PRODUCTS__');
             $productIds = $rule->getMatchingProductIds();
             Varien_Profiler::stop('__MATCH_PRODUCTS__');
         }
         $rows = array();
         foreach ($productIds as $productId => $validationByWebsite) {
             foreach ($websiteIds as $websiteId) {
                 foreach ($customerGroupIds as $customerGroupId) {
                     if (empty($validationByWebsite[$websiteId])) {
                         continue;
                     }
                     $rows[] = array('rule_id' => $rule->getId(), 'from_time' => $fromTime, 'to_time' => $toTime, 'website_id' => $websiteId, 'customer_group_id' => $customerGroupId, 'product_id' => $productId, 'action_operator' => $actionOperator, 'action_amount' => $actionAmount, 'action_stop' => $actionStop, 'sort_order' => $sortOrder, 'sub_simple_action' => $subActionOperator, 'sub_discount_amount' => $subActionAmount);
                     if (count($rows) == 1000) {
                         $write->insertMultiple($this->getTable('catalogrule/rule_product'), $rows);
                         $rows = array();
                     }
                 }
             }
         }
         if (!empty($rows)) {
             $write->insertMultiple($this->getTable('catalogrule/rule_product'), $rows);
         }
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:64,代码来源:Rule.php

示例5: _initStores

 /**
  * Initialize stores hash
  *
  * @return Mage_ImportExport_Model_Export_EntityAbstract
  */
 protected function _initStores()
 {
     /** @var $store Mage_Core_Model_Store */
     foreach ($this->_storeManager->getStores(true) as $store) {
         $this->_storeIdToCode[$store->getId()] = $store->getCode();
     }
     ksort($this->_storeIdToCode);
     // to ensure that 'admin' store (ID is zero) goes first
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:15,代码来源:EntityAbstract.php

示例6: getStoresByThemes

 /**
  * Return stores grouped by assigned themes
  *
  * @return array
  */
 public function getStoresByThemes()
 {
     $storesByThemes = array();
     $stores = $this->_app->getStores();
     /** @var $store Mage_Core_Model_Store */
     foreach ($stores as $store) {
         $themeId = $this->_design->getConfigurationDesignTheme(Mage_Core_Model_App_Area::AREA_FRONTEND, array('store' => $store));
         if (!isset($storesByThemes[$themeId])) {
             $storesByThemes[$themeId] = array();
         }
         $storesByThemes[$themeId][] = $store;
     }
     return $storesByThemes;
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例7: getWebsitesWithWrongDiscountSettings

 /**
  * Return list of store names where tax discount settings are compatible.
  * Return true if settings are wrong for default store.
  *
  * @return bool|array
  */
 public function getWebsitesWithWrongDiscountSettings()
 {
     $defaultStoreId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
     //check default store first
     if (!$this->_factory->getSingleton('tax/config')->checkDiscountSettings($defaultStoreId)) {
         return true;
     }
     $storeNames = array();
     $stores = $this->_app->getStores();
     foreach ($stores as $store) {
         if (!$this->_factory->getSingleton('tax/config')->checkDiscountSettings($store)) {
             $website = $store->getWebsite();
             $storeNames[] = $website->getName() . '(' . $store->getName() . ')';
         }
     }
     return $storeNames;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:23,代码来源:Notifications.php

示例8: testGetStores

 public function testGetStores()
 {
     $this->assertNotEmpty($this->_mageModel->getStores());
     $this->assertNotContains(Mage_Core_Model_App::ADMIN_STORE_ID, array_keys($this->_mageModel->getStores()));
     $this->assertContains(Mage_Core_Model_App::ADMIN_STORE_ID, array_keys($this->_mageModel->getStores(true)));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:6,代码来源:AppTest.php

示例9: _rebuildIndex

 /**
  * @deprecated since version 1.13.2
  * Regenerate fulltext search index
  */
 protected function _rebuildIndex()
 {
     foreach ($this->_app->getStores() as $store) {
         /** @var $store Mage_Core_Model_Store */
         $this->_rebuildStoreIndex($store->getId());
     }
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:Refresh.php

示例10: _reindex

 /**
  * Reindex category/product index by store
  *
  * @return Enterprise_Catalog_Model_Index_Action_Catalog_Category_Product_Refresh
  */
 protected function _reindex()
 {
     $this->_beforeReindex();
     $this->_createTmpTable();
     $rootCatIds = array();
     foreach ($this->_app->getStores() as $store) {
         /** @var $store Mage_Core_Model_Store */
         $rootCatIds[] = $store->getRootCategoryId();
         if ($this->_getPathFromCategoryId($store->getRootCategoryId())) {
             $this->_reindexNonAnchorCategories($store);
             $this->_reindexAnchorCategories($store);
             $this->_reindexRootCategory($store);
         }
     }
     $this->_publishData();
     $this->_removeUnnecessaryData($rootCatIds);
     $this->_clearTmpData();
     $this->_afterReindex();
     return $this;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:25,代码来源:Refresh.php


注:本文中的Mage_Core_Model_App::getStores方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。