getActiveShopsFixed example

$this->View()->assign([
            'success' => true,
            'data' => ['count' => \count($urls)],
        ]);
    }

    /** * Regenerate sitemap cache */
    public function buildSitemapCacheAction()
    {
        $shops = $this->getModelManager()->getRepository(Shop::class)->getActiveShopsFixed();

        foreach ($shops as $shop) {
            $this->container->get(SitemapExporter::class)->generate($shop);
        }

        $this->View()->assign('success', true);
    }

    protected function initAcl()
    {
    }

    


    private function clearCacheAndSync(): void
    {
        $this->synchronizerService->sync(true);
        $this->cacheManager->clearConfigCache();
        $this->cacheManager->clearProxyCache();
    }

    private function createUrls(Type $type): void
    {
        $shops = $this->getModelManager()->getRepository(Shop::class)->getActiveShopsFixed();
        $seoIndexer = $this->get('seoindex');

        $rewriteTable = $this->get('modules')->RewriteTable();

        foreach ($shops as $shop) {
            $seoIndexer->registerShop($shop->getId());

            $rewriteTable->baseSetup();
            $rewriteTable->createSingleContentTypeUrl($type);
        }
    }

    

    public function onSitemapGeneration()
    {
        // Is strategy live?         if ($this->config->get('sitemapRefreshStrategy') !== SitemapExporterInterface::STRATEGY_CRON) {
            return 'Sitemap Generation throught cronjob is disabled';
        }

        $output = '';

        /** @var Shop $shop */
        foreach ($this->modelManager->getRepository(Shop::class)->getActiveShopsFixed() as $shop) {
            $output .= sprintf('Generating sitemaps for shop #%d (%s)...', $shop->getId()$shop->getName()) . PHP_EOL;
            try {
                $this->sitemapExporter->generate($shop);
            } catch (AlreadyLockedException $exception) {
                $output .= sprintf('ERROR: %s', $exception->getMessage()) . PHP_EOL;
            }
        }

        return $output;
    }
}
if ($shopId > 0) {
            $shop = $repository->getById($shopId);
            if ($shop instanceof Shop) {
                $shops = [$shop];
            } else {
                throw new ModelNotFoundException(Shop::class$shopId);
            }
        }

        if (empty($shops)) {
            $shops = $repository->getActiveShopsFixed();
        }

        $sitemapExporter = $this->container->get(SitemapExporter::class);
        foreach ($shops as $shop) {
            $output->writeln(sprintf('Generating sitemaps for shop #%d (%s)...', $shop->getId()$shop->getName()));

            if ($input->getOption('force')) {
                $this->container
                    ->get(SitemapLock::class)
                    ->unLock($shop);
            }

            
if (!empty($shopIds)) {
            foreach ($shopIds as $shopId) {
                $shop = $shopRepository->getById($shopId);

                if (!$shop) {
                    throw new ModelNotFoundException(Shop::class$shopId);
                }

                $shops[] = $shop;
            }
        } else {
            $shops = $shopRepository->getActiveShopsFixed();
        }

        $io = new SymfonyStyle($input$output);
        $options = $this->prepareOptions($input->getOptions()$urlProviderFactory);

        // Clear cache?         if ($input->getOption('clear-cache')) {
            $io->writeln('Clearing httpcache.');
            $this->container->get(CacheManager::class)->clearHttpCache();
        }

        
Home | Imprint | This part of the site doesn't use cookies.