本文整理汇总了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));
}