createContentTypeUrls example

$context = $this->contextService->createShopContext(Shopware()->Shop()->getId());

        $this->sCreateRewriteTableCleanup();
        $this->sCreateRewriteTableStatic();
        $this->sCreateRewriteTableCategories();
        $this->sCreateRewriteTableBlog(null, null, $context);
        $this->sCreateRewriteTableCampaigns();
        $lastUpdate = $this->sCreateRewriteTableArticles($lastUpdate);
        $this->sCreateRewriteTableContent(null, null, $context);
        $this->createManufacturerUrls($context);
        $this->createContentTypeUrls($context);

        return $lastUpdate;
    }

    /** * Cleanup the rewrite table from non-existing resources. * * @throws Zend_Db_Adapter_Exception */
    public function sCreateRewriteTableCleanup()
    {
        
public function seoContentTypeAction(): void
    {
        @set_time_limit(1200);
        $shopId = (int) $this->Request()->getParam('shopId', 1);

        // Create shop         $this->SeoIndex()->registerShop($shopId);
        $context = $this->get(\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::class)->createShopContext($shopId);

        // Make sure a template is available         $this->RewriteTable()->baseSetup();
        $this->RewriteTable()->createContentTypeUrls($context);

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

    /** * Helper function which creates the seo urls for the * passed shop id. The offset and limit parameter are used * to update only an offset of article urls. * * @param int $offset * @param int $limit * @param \Shopware\Models\Shop\Shop $shop */
$this->SeoIndex()->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);

            $context = $this->get(ContextServiceInterface::class)->createShopContext($shopId);

            $this->RewriteTable()->sCreateRewriteTableCategories();
            $this->RewriteTable()->sCreateRewriteTableCampaigns();
            $this->RewriteTable()->sCreateRewriteTableContent();
            $this->RewriteTable()->sCreateRewriteTableBlog(null, null, $context);
            $this->RewriteTable()->createManufacturerUrls($context);
            $this->RewriteTable()->sCreateRewriteTableStatic();
            $this->RewriteTable()->createContentTypeUrls($context);

            Shopware()->Events()->notify(
                'Shopware_CronJob_RefreshSeoIndex_CreateRewriteTable',
                [
                    'shopContext' => $context,
                    'cachedTime' => $currentTime,
                ]
            );
        }

        return true;
    }
$this->seoIndex->setCachedTime($currentTime->format('Y-m-d H:i:s')$elementId$shopId);

            $context = $this->container->get(ContextServiceInterface::class)->createShopContext($shopId);

            $this->rewriteTable->sCreateRewriteTableCategories();
            $this->rewriteTable->sCreateRewriteTableCampaigns();
            $this->rewriteTable->sCreateRewriteTableContent();
            $this->rewriteTable->sCreateRewriteTableBlog(null, null, $context);
            $this->rewriteTable->createManufacturerUrls($context);
            $this->rewriteTable->sCreateRewriteTableStatic();
            $this->rewriteTable->createContentTypeUrls($context);

            $this->events->notify(
                'Shopware_Command_RebuildSeoIndexCommand_CreateRewriteTable',
                [
                    'shopContext' => $context,
                    'cachedTime' => $currentTime,
                ]
            );
        }

        $output->writeln('The SEO index was rebuild successfully.');

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