本文整理匯總了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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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()}]");
}
}
}
示例5: getStores
/**
* {@inheritdoc}
*/
public function getStores($withDefault = false, $codeKey = false)
{
$result = $this->decoratedStoreManager->getStores($withDefault, $codeKey);
$this->dispatchInitCurrentStoreAfterEvent();
return $result;
}
示例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));
}