當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StoreManager::getStores方法代碼示例

本文整理匯總了PHP中Magento\Store\Model\StoreManager::getStores方法的典型用法代碼示例。如果您正苦於以下問題:PHP StoreManager::getStores方法的具體用法?PHP StoreManager::getStores怎麽用?PHP StoreManager::getStores使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Store\Model\StoreManager的用法示例。


在下文中一共展示了StoreManager::getStores方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: cleanAbandonedCartExpiredCoupons

 public function cleanAbandonedCartExpiredCoupons()
 {
     $allStores = $this->_storeManager->getStores();
     foreach ($allStores as $storeId => $val) {
         if ($this->_helper->getConfig(Ebizmarts_AbandonedCart_Model_Config::ACTIVE, $storeId)) {
             $this->_cleanCoupons($storeId);
         }
     }
 }
開發者ID:lazyguru,項目名稱:magento2-abandonedcart,代碼行數:9,代碼來源:Cron.php

示例2: process

 /**
  *
  */
 public function process()
 {
     foreach ($this->_storeManager->getStores() as $storeId => $val) {
         $this->_storeManager->setCurrentStore($storeId);
         if ($this->_helper->getConfig(Config::ACTIVE, $storeId)) {
             $this->_processStore($storeId);
         }
     }
 }
開發者ID:ebizmarts,項目名稱:magento2-autoresponder,代碼行數:12,代碼來源:Cron.php

示例3: getAllUrls

 /**
  * Get urls of all the stores in the magento install.
  *
  * @return array
  */
 public function getAllUrls()
 {
     $urls = [];
     $stores = $this->storeManager->getStores(false);
     foreach ($stores as $store) {
         $urls[] = $store->getBaseUrl();
     }
     return $urls;
 }
開發者ID:eonsequeira,項目名稱:HS_All,代碼行數:14,代碼來源:Data.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption('remove')) {
         $store = $input->getOption('store');
         $collection = $this->synonymFactory->create()->getCollection();
         if ($store) {
             $collection->addFieldToFilter('store_id', $store);
         }
         $cnt = 0;
         foreach ($collection as $item) {
             $item->delete();
             $cnt++;
             if ($cnt % 1000 == 0) {
                 $output->writeln("<info>{$cnt} synonyms are removed...</info>");
             }
         }
         $output->writeln("<info>{$cnt} synonyms are removed.</info>");
         return;
     }
     if ($input->getOption('file') && $input->getOption('store')) {
         $file = $this->config->getSynonymDirectoryPath() . DIRECTORY_SEPARATOR . $input->getOption('file');
         $store = $input->getOption('store');
         $result = $this->synonymFactory->create()->import($file, $store);
         $output->writeln("<info>Imported {$result['synonyms']} synonyms</info>");
     } else {
         $output->writeln('<info>Available files:</info>');
         foreach ($this->synonymFactory->create()->getAvailableFiles() as $file) {
             $info = pathinfo($file);
             $output->writeln("    {$info['basename']}");
         }
         $output->writeln('<info>Available stores:</info>');
         foreach ($this->storeManager->getStores(true) as $store) {
             $output->writeln("    {$store->getId()} [{$store->getCode()}]");
         }
     }
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:39,代碼來源:SynonymCommand.php

示例5: getStores

 /**
  * {@inheritdoc}
  */
 public function getStores($withDefault = false, $codeKey = false)
 {
     $result = $this->decoratedStoreManager->getStores($withDefault, $codeKey);
     $this->dispatchInitCurrentStoreAfterEvent();
     return $result;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:9,代碼來源:StoreManager.php

示例6: testGetStores

 /**
  * @dataProvider getStoresDataProvider
  */
 public function testGetStores($storesList, $withDefault, $codeKey, $expectedStores)
 {
     $this->storeRepositoryMock->expects($this->any())->method('getList')->willReturn($storesList);
     $this->assertEquals($expectedStores, $this->model->getStores($withDefault, $codeKey));
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:8,代碼來源:StoreManagerTest.php


注:本文中的Magento\Store\Model\StoreManager::getStores方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。