Home > database >  How can I change the routes for Taxons in sylius-standard?
How can I change the routes for Taxons in sylius-standard?

Time:06-29

I am trying to change the routes for my Taxons but cannot find a way to do it.

  • Current: {domain}/taxons/{taxon name}
  • Desired: {domain}/categories/{taxon name}

After searching Google/Stackoverflow I only could find a solution from 2018 that isn't working anymore.

I am using Sylius version 1.11.5.

CodePudding user response:

Found the answer after some messing with the Symfony Debug bar. Just put the following piece of code in config/routes/sylius_shop.yaml.

sylius_shop_product_index:
    path: /categories/{slug}
    methods: [ GET ]
    defaults:
        _controller: sylius.controller.product:indexAction
        _sylius:
            template: "@SyliusShop/Product/index.html.twig"
            grid: sylius_shop_product
    requirements:
        slug: . (?<!/)

This overrides the Route defined in vendor/sylius/sylius/src/Sylius/Bundle/ShopBundle/Resources/config/routing/product.yml.

  • Related