phpsymfonysyliussymfony-routing

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


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

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.


Solution

  • 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.