Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function process()
 {
     foreach ($this->_storeManager->getStores() as $storeId => $val) {
         $this->_storeManager->setCurrentStore($storeId);
         if ($this->_helper->getConfig(Config::ACTIVE, $storeId)) {
             $this->_processStore($storeId);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }
Ejemplo n.º 4
0
 /**
  * {@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()}]");
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function getStores($withDefault = false, $codeKey = false)
 {
     $result = $this->decoratedStoreManager->getStores($withDefault, $codeKey);
     $this->dispatchInitCurrentStoreAfterEvent();
     return $result;
 }
Ejemplo n.º 6
0
 /**
  * @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));
 }