WishListPageProductCriteriaEvent example

$response = $this->renderStorefront('@Storefront/storefront/page/wishlist/index.html.twig', ['page' => $page]);
        $response->headers->set('x-robots-tag', 'noindex');

        return $response;
    }

    #[Route(path: '/wishlist/list', name: 'frontend.wishlist.product.list', options: ['seo' => false], defaults: ['XmlHttpRequest' => true, '_loginRequired' => true], methods: ['GET'])]     public function ajaxList(Request $request, SalesChannelContext $context, CustomerEntity $customer): Response
    {
        $criteria = new Criteria();
        $this->eventDispatcher->dispatch(new WishListPageProductCriteriaEvent($criteria$context$request));

        try {
            $res = $this->wishlistLoadRoute->load($request$context$criteria$customer);
        } catch (CustomerWishlistNotFoundException) {
            return new JsonResponse([]);
        }

        return new JsonResponse($res->getProductListing()->getIds());
    }

    #[Route(path: '/wishlist/product/delete/{id}', name: 'frontend.wishlist.product.delete', defaults: ['XmlHttpRequest' => true, '_loginRequired' => true], methods: ['POST', 'DELETE'])]


    /** * @throws CategoryNotFoundException * @throws CustomerNotLoggedInException * @throws InconsistentCriteriaIdsException * @throws RoutingException */
    public function load(Request $request, SalesChannelContext $context, CustomerEntity $customer): WishlistPage
    {
        $criteria = $this->createCriteria($request);
        $this->eventDispatcher->dispatch(new WishListPageProductCriteriaEvent($criteria$context$request));

        $page = $this->genericLoader->load($request$context);
        $page = WishlistPage::createFrom($page);

        try {
            $page->setWishlist($this->wishlistLoadRoute->load($request$context$criteria$customer));
        } catch (CustomerWishlistNotFoundException) {
            $page->setWishlist(
                new LoadWishlistRouteResponse(
                    new CustomerWishlistEntity(),
                    new EntitySearchResult(
                        
Home | Imprint | This part of the site doesn't use cookies.