try { $this->addWishlistRoute->
add($productId,
$context,
$customer);
$this->
addFlash(self::SUCCESS,
$this->
trans('wishlist.itemAddedSuccess'
));
} catch (DuplicateWishlistProductException
) { $this->
addFlash(self::WARNING,
$this->
trans('wishlist.duplicateItemError'
));
} catch (\Throwable
) { $this->
addFlash(self::DANGER,
$this->
trans('error.message-default'
));
} return $this->
redirectToRoute('frontend.home.page'
);
} #[Route(path: '/wishlist/merge', name: 'frontend.wishlist.product.merge', options: ['seo' => false], defaults: ['XmlHttpRequest' => true, '_loginRequired' => true], methods: ['POST'])]
public function ajaxMerge(RequestDataBag
$requestDataBag, Request
$request, SalesChannelContext
$context, CustomerEntity
$customer): Response
{ try { $this->mergeWishlistProductRoute->
merge($requestDataBag,
$context,
$customer);
return $this->
renderStorefront('@Storefront/storefront/utilities/alert.html.twig',
[ 'type' => 'info', 'content' =>
$this->
trans('wishlist.wishlistMergeHint'
),
]);
}