Shopware 6 add custom controller to /navigation/{navigationId}

101 views Asked by At

I have a simple questions and cannot find a good answer. However i coded a custom controller for my shopware 6 plugin and this is my code

<?php declare(strict_types=1);

namespace wbnKartonfinder\Controller;

use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @Route(defaults={"_routeScope"={"storefront"}})
 */
class KartonfinderController extends StorefrontController
{

    /**
     * @Route("/navigation/d5e949e2ecdb4797bea2928abeb68a01", name="frontend.kartonfinderplugin.test", methods={"GET"})
     */
    public function showExample(): Response
    {
        return $this->renderStorefront('@SwagBasicExample/storefront/page/example.html.twig', [
            'example' => 'Hello world'
        ]);
    }
}

But somehow the route is not effected by my controller. I am extending on the NavigationController which extends from storefrontController, basically this route @Route("/navigation/{navigationId}" I thought the only thing i have to do is find out the correct navigationId and pass it to my route but that does not change anything.

0

There are 0 answers