throw new MissingRequestParameterException('productId', '/productId');
}
$productId = $this->findBestVariant($productId, $salesChannelContext);
$product = $this->productLoader->load($productId, $salesChannelContext);
$page->setProduct($product);
$request->request->set('parentId', $product->getParentId());
$reviews = $this->productReviewLoader->load($request, $salesChannelContext);
$reviews->setParentId($product->getParentId() ?? $product->getId());
* @HttpCache()
* @Route("/detail/{productId}", name="frontend.detail.page", methods={"GET"})
*/
public function index(SalesChannelContext $context, Request $request): Response
{
$page = $this->productPageLoader->load($request, $context);
$ratingSuccess = $request->get('success');
return $this->renderStorefront('@Storefront/storefront/page/product-detail/index.html.twig', ['page' => $page, 'ratingSuccess' => $ratingSuccess]);
}
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) {
Request::setTrustedProxies(array_merge($trustedProxies, ['127.0.0.1']), Request::getTrustedHeaderSet());
}
try {
return $kernel->handle($request, $type, $catch);
} finally {
// restore global state
Request::setTrustedProxies($trustedProxies, $trustedHeaderSet);
}
}
if ($this->surrogate) {
$this->surrogate->addSurrogateCapability($request);
}
// always a "master" request (as the real master request can be in cache)
$response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch);
/*
* Support stale-if-error given on Responses or as a config option.
* RFC 7234 summarizes in Section 4.2.4 (but also mentions with the individual
* Cache-Control directives) that
reload the cache by fetching a fresh response and caching it (if possible).
*/
$this->record($request, 'reload');
$response = $this->fetch($request, $catch);
} else {
$response = $this->lookup($request, $catch);
}
$this->restoreResponseBody($request, $response);
if (HttpKernelInterface::MASTER_REQUEST === $type) {
$enabled = $container->getParameter('shopware.http.cache.enabled');
if ($enabled) {
$kernel = new HttpCache($kernel, $container->get(CacheStore::class), null, ['debug' => $this->debug]);
}
$response = $kernel->handle($transformed, $type, $catch);
// fire event to trigger runtime events like seo url headers
$event = new BeforeSendResponseEvent($transformed, $response);
$container->get('event_dispatcher')->dispatch($event);
}
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): HttpKernelResult
{
try {
return $this->doHandle($request, (int) $type, (bool) $catch);
} catch (DBALException $e) {
$connectionParams = self::getConnection()->getParams();
$message = str_replace([$connectionParams['url'], $connectionParams['password'], $connectionParams['user']], '******', $e->getMessage());
No log messages
ProductNotFoundException |
---|
Shopware\Core\Content\Product\Exception\ProductNotFoundException: Product for id c72bdc9c66bceaddc4bc7f7700f82529 not found. at vendor/shopware/storefront/Page/Product/ProductLoader.php:91 at Shopware\Storefront\Page\Product\ProductLoader->load('c72bdc9c66bceaddc4bc7f7700f82529', object(SalesChannelContext)) (vendor/shopware/storefront/Page/Product/ProductPageLoader.php:122) at Shopware\Storefront\Page\Product\ProductPageLoader->load(object(Request), object(SalesChannelContext)) (vendor/shopware/storefront/Controller/ProductController.php:88) at Shopware\Storefront\Controller\ProductController->index(object(SalesChannelContext), object(Request)) (vendor/symfony/http-kernel/HttpKernel.php:146) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:68) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php:85) at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle(object(Kernel), object(Request), 1, true) (vendor/symfony/http-kernel/HttpCache/HttpCache.php:477) at Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(object(Request), true) (vendor/symfony/http-kernel/HttpCache/HttpCache.php:450) at Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch(object(Request), true) (vendor/symfony/http-kernel/HttpCache/HttpCache.php:344) at Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup(object(Request), true) (vendor/symfony/http-kernel/HttpCache/HttpCache.php:222) at Symfony\Component\HttpKernel\HttpCache\HttpCache->handle(object(Request), 1, true) (vendor/shopware/core/HttpKernel.php:148) at Shopware\Core\HttpKernel->doHandle(object(Request), 1, true) (vendor/shopware/core/HttpKernel.php:77) at Shopware\Core\HttpKernel->handle(object(Request)) (public/index.php:83) |