$sorting = $sortings->getByKey($key);
if ($sorting !== null) {
return $sorting;
}
throw new ProductSortingNotFoundException($key);
}
private function getAvailableSortings(Request $request, Context $context): ProductSortingCollection
{
$criteria = new Criteria();
{
/** @var ProductSortingCollection $sortings */
$sortings = $criteria->getExtension('sortings') ?? new ProductSortingCollection();
$sortings->merge($this->getAvailableSortings($request, $context->getContext()));
$currentSorting = $this->getCurrentSorting($sortings, $request);
$criteria->addSorting(
...$currentSorting->createDalSorting()
);
$this->handlePagination($request, $criteria, $event->getSalesChannelContext());
$this->handleFilters($request, $criteria, $context);
$this->handleSorting($request, $criteria, $context);
}
public function handleSearchRequest(ProductSearchCriteriaEvent $event): void
{
$request = $event->getRequest();
$this->priority = $dispatcher->getListenerPriority($eventName, $this->listener);
$e = $this->stopwatch->start($this->name, 'event_listener');
try {
($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
foreach ($listeners as $listener) {
if ($stoppable && $event->isPropagationStopped()) {
break;
}
$listener($event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this->getListeners($eventName);
}
if ($listeners) {
$this->callListeners($listeners, $eventName, $event);
}
return $event;
}
*
* @return TEvent
*/
public function dispatch($event, ?string $eventName = null): object
{
$event = $this->dispatcher->dispatch($event, $eventName);
if (!$event instanceof FlowEventAware) {
return $event;
}
*
* @return TEvent
*/
public function dispatch($event, ?string $eventName = null): object
{
$event = $this->dispatcher->dispatch($event, $eventName);
if (EnvironmentHelper::getVariable('DISABLE_EXTENSIONS', false)) {
return $event;
}
$this->definitionRegistry = $definitionRegistry;
}
public function dispatch($event, ?string $eventName = null): object
{
$event = $this->dispatcher->dispatch($event, $eventName);
if (Feature::isActive('FEATURE_NEXT_17858')) {
return $event;
}
}
$this->dispatch($nested, $name);
}
}
return $this->dispatcher->dispatch($event, $eventName);
}
/**
* @param callable $listener can not use native type declaration @see https://github.com/symfony/symfony/issues/42283
*/
try {
$this->beforeDispatch($eventName, $event);
try {
$e = $this->stopwatch->start($eventName, 'section');
try {
$this->dispatcher->dispatch($event, $eventName);
} finally {
if ($e->isStarted()) {
$e->stop();
}
}
* @Route("/store-api/product-listing/{categoryId}", name="store-api.product.listing", methods={"POST"})
*/
public function load(string $categoryId, Request $request, SalesChannelContext $context, Criteria $criteria): ProductListingRouteResponse
{
$this->eventDispatcher->dispatch(
new ProductListingCriteriaEvent($request, $criteria, $context)
);
return $this->getDecorated()->load($categoryId, $request, $context, $criteria);
}
}
$criteria = new Criteria();
$criteria->setTitle('cms::product-listing');
$listing = $this->listingRoute
->load($navigationId, $request, $context, $criteria)
->getResult();
$data->setListing($listing);
}
$result = new ElementDataCollection();
$this->mapSearchResults($result, $slot, $slotCriteriaList, $searchResults);
$this->mapEntities($result, $slot, $slotCriteriaList, $entities);
$resolver->enrich($slot, $resolverContext, $result);
// replace with return value from enrich(), because it's allowed to change the entity type
$slots->set($slotId, $slot);
}
return $pages;
}
private function loadSlotData(CmsPageEntity $page, ResolverContext $resolverContext): void
{
$slots = $this->slotDataResolver->resolve($page->getSections()->getBlocks()->getSlots(), $resolverContext);
$page->getSections()->getBlocks()->setSlots($slots);
}
private function overwriteSlotConfig(CmsPageEntity $page, array $config): void
// step 4, overwrite slot config
$this->overwriteSlotConfig($page, $overwrite);
// step 5, resolve slot data
$this->loadSlotData($page, $resolverContext);
}
$this->eventDispatcher->dispatch(new CmsPageLoadedEvent($request, $pages->getEntities(), $context));
return $pages;
}
$resolverContext = new EntityResolverContext($context, $request, $this->categoryDefinition, $category);
$pages = $this->cmsPageLoader->load(
$request,
$this->createCriteria($pageId, $request),
$context,
$slotConfig,
$resolverContext
);
$value = $this->cache->get($key, function (ItemInterface $item) use ($navigationId, $request, $context) {
$name = self::buildName($navigationId);
$response = $this->tracer->trace($name, function () use ($navigationId, $request, $context) {
return $this->getDecorated()->load($navigationId, $request, $context);
});
$item->tag($this->generateTags($navigationId, $response, $request, $context));
return CacheValueCompressor::compress($response);
public function trace(string $key, \Closure $param)
{
$this->traces[$key] = [];
$this->keys[$key] = true;
$result = $param();
unset($this->keys[$key]);
return $result;
}
*/
public function trace(string $key, \Closure $param)
{
return $this->collection->trace($key, function () use ($key, $param) {
return $this->translator->trace($key, function () use ($key, $param) {
return $this->config->trace($key, $param);
});
});
}
public function get(string $key): array
public function trace(string $key, \Closure $param)
{
$this->traces[$key] = [];
$this->keys[$key] = true;
$result = $param();
unset($this->keys[$key]);
return $result;
}
public function trace(string $key, \Closure $param)
{
return $this->collection->trace($key, function () use ($key, $param) {
return $this->translator->trace($key, function () use ($key, $param) {
return $this->config->trace($key, $param);
});
});
}
public function get(string $key): array
{
public function trace(string $key, \Closure $param)
{
$this->traces[$key] = [];
$this->keys[$key] = true;
$result = $param();
unset($this->keys[$key]);
return $result;
}
{
return $this->collection->trace($key, function () use ($key, $param) {
return $this->translator->trace($key, function () use ($key, $param) {
return $this->config->trace($key, $param);
});
});
}
public function get(string $key): array
{
return array_merge(
}
public function trace(string $key, \Closure $param)
{
return $this->themeConfigAccessor->trace($key, function () use ($key, $param) {
return $this->getDecorated()->trace($key, $param);
});
}
public function get(string $key): array
{
public function trace(string $key, \Closure $param)
{
$this->traces[$key] = [];
$this->keys[$key] = true;
$result = $param();
unset($this->keys[$key]);
return $result;
}
public function trace(string $key, \Closure $param)
{
return $this->themeConfigAccessor->trace($key, function () use ($key, $param) {
return $this->getDecorated()->trace($key, $param);
});
}
public function get(string $key): array
{
return array_unique(array_merge(
$value = $this->cache->get($key, function (ItemInterface $item) use ($navigationId, $request, $context) {
$name = self::buildName($navigationId);
$response = $this->tracer->trace($name, function () use ($navigationId, $request, $context) {
return $this->getDecorated()->load($navigationId, $request, $context);
});
$item->tag($this->generateTags($navigationId, $response, $request, $context));
return CacheValueCompressor::compress($response);
});
}
}
if ($recompute) {
$save = true;
$item->set($callback($item, $save));
if ($save) {
$pool->save($item);
}
}
*
* @return mixed
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
return $this->doGet($this, $key, $callback, $beta, $metadata);
}
/**
* {@inheritdoc}
*/
});
$item->tag($this->generateTags($navigationId, $response, $request, $context));
return CacheValueCompressor::compress($response);
});
return CacheValueCompressor::uncompress($value);
});
}
try {
foreach (self::$profilers as $profiler) {
$profiler->start($name, $category, $tags);
}
$result = $closure();
} finally {
foreach (self::$profilers as $profiler) {
$profiler->stop($name);
}
}
return CacheValueCompressor::compress($response);
});
return CacheValueCompressor::uncompress($value);
});
}
private function generateKey(string $navigationId, Request $request, SalesChannelContext $context): ?string
{
$parts = array_merge(
*
* @Route("/store-api/category/{navigationId}", name="store-api.category.detail", methods={"GET","POST"})
*/
public function load(string $navigationId, Request $request, SalesChannelContext $context): CategoryRouteResponse
{
$response = $this->inner->load($navigationId, $request, $context);
$route = $request->attributes->get('_route');
if (!\is_string($route) || empty($route)) {
return $response;
$page = NavigationPage::createFrom($page);
$navigationId = $request->get('navigationId', $context->getSalesChannel()->getNavigationCategoryId());
$category = $this->cmsPageRoute
->load($navigationId, $request, $context)
->getCategory();
if (!$category->getActive()) {
throw new CategoryNotFoundException($category->getId());
}
* @HttpCache()
* @Route("/navigation/{navigationId}", name="frontend.navigation.page", options={"seo"=true}, methods={"GET"})
*/
public function index(SalesChannelContext $context, Request $request): Response
{
$page = $this->navigationPageLoader->load($request, $context);
$this->hook(new NavigationPageLoadedHook($page, $context));
return $this->renderStorefront('@Storefront/storefront/page/content/index.html.twig', ['page' => $page]);
}
$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);
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
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::MAIN_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
// avoid that the backend sends no content
$subRequest->headers->remove('If-Modified-Since');
$subRequest->headers->remove('If-None-Match');
$response = $this->forward($subRequest, $catch);
if ($response->isCacheable()) {
$this->store($request, $response);
}
}
if (null === $entry) {
$this->record($request, 'miss');
return $this->fetch($request, $catch);
}
if (!$this->isFreshEnough($request, $entry)) {
$this->record($request, 'stale');
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::MAIN_REQUEST === $type) {
&& $container->getParameter('shopware.http.cache.enabled');
if ($enabled && $container->has(CacheStore::class)) {
$kernel = new static::$httpCacheClass($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);
if (!\is_bool($catch)) {
Feature::triggerDeprecationOrThrow('v6.5.0.0', 'The third parameter `$catch` of `HttpKernel->handle()` will be typed to `bool`');
}
try {
return $this->doHandle($request, (int) $type, (bool) $catch);
} catch (Exception $e) {
/** @var Params|array{url?: string} $connectionParams */
$connectionParams = self::getConnection()->getParams();
$message = str_replace([$connectionParams['url'] ?? null, $connectionParams['password'] ?? null, $connectionParams['user'] ?? null], '******', $e->getMessage());
}
} else {
$kernel = new InstallerKernel($appEnv, $debug);
}
$result = $kernel->handle($request);
if ($result instanceof Response) {
$result->send();
$kernel->terminate($request, $result);
} else {
No log messages
ProductSortingNotFoundException
|
---|
Shopware\Core\Content\Product\SalesChannel\Exception\ProductSortingNotFoundException: Product sorting with key price not found. at vendor/shopware/core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php:297 at Shopware\Core\Content\Product\SalesChannel\Listing\ProductListingFeaturesSubscriber->getCurrentSorting() (vendor/shopware/core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php:279) at Shopware\Core\Content\Product\SalesChannel\Listing\ProductListingFeaturesSubscriber->handleSorting() (vendor/shopware/core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php:142) at Shopware\Core\Content\Product\SalesChannel\Listing\ProductListingFeaturesSubscriber->handleListingRequest() (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:118) at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() (vendor/symfony/event-dispatcher/EventDispatcher.php:230) at Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (vendor/symfony/event-dispatcher/EventDispatcher.php:59) at Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (vendor/shopware/core/Content/Flow/Dispatching/FlowDispatcher.php:56) at Shopware\Core\Content\Flow\Dispatching\FlowDispatcher->dispatch() (vendor/shopware/core/Framework/Webhook/WebhookDispatcher.php:98) at Shopware\Core\Framework\Webhook\WebhookDispatcher->dispatch() (vendor/shopware/core/Framework/Event/BusinessEventDispatcher.php:55) at Shopware\Core\Framework\Event\BusinessEventDispatcher->dispatch() (vendor/shopware/core/Framework/Event/NestedEventDispatcher.php:37) at Shopware\Core\Framework\Event\NestedEventDispatcher->dispatch() (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:154) at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch() (vendor/shopware/core/Content/Product/SalesChannel/Listing/ResolveCriteriaProductListingRoute.php:48) at Shopware\Core\Content\Product\SalesChannel\Listing\ResolveCriteriaProductListingRoute->load() (vendor/shopware/core/Content/Product/Cms/ProductListingCmsElementResolver.php:62) at Shopware\Core\Content\Product\Cms\ProductListingCmsElementResolver->enrich() (vendor/shopware/core/Content/Cms/DataResolver/CmsSlotsDataResolver.php:99) at Shopware\Core\Content\Cms\DataResolver\CmsSlotsDataResolver->resolve() (vendor/shopware/core/Content/Cms/SalesChannel/SalesChannelCmsPageLoader.php:104) at Shopware\Core\Content\Cms\SalesChannel\SalesChannelCmsPageLoader->loadSlotData() (vendor/shopware/core/Content/Cms/SalesChannel/SalesChannelCmsPageLoader.php:94) at Shopware\Core\Content\Cms\SalesChannel\SalesChannelCmsPageLoader->load() (vendor/shopware/core/Content/Category/SalesChannel/CategoryRoute.php:102) at Shopware\Core\Content\Category\SalesChannel\CategoryRoute->load() (vendor/shopware/core/Content/Category/SalesChannel/CachedCategoryRoute.php:103) at Shopware\Core\Content\Category\SalesChannel\CachedCategoryRoute->Shopware\Core\Content\Category\SalesChannel\{closure}() (vendor/shopware/core/System/SystemConfig/SystemConfigService.php:350) at Shopware\Core\System\SystemConfig\SystemConfigService->trace() (vendor/shopware/core/Framework/Adapter/Cache/CacheTracer.php:44) at Shopware\Core\Framework\Adapter\Cache\CacheTracer->Shopware\Core\Framework\Adapter\Cache\{closure}() (vendor/shopware/core/Framework/Adapter/Translation/Translator.php:120) at Shopware\Core\Framework\Adapter\Translation\Translator->trace() (vendor/shopware/core/Framework/Adapter/Cache/CacheTracer.php:45) at Shopware\Core\Framework\Adapter\Cache\CacheTracer->Shopware\Core\Framework\Adapter\Cache\{closure}() (vendor/shopware/core/Framework/Adapter/Cache/CacheTagCollection.php:46) at Shopware\Core\Framework\Adapter\Cache\CacheTagCollection->trace() (vendor/shopware/core/Framework/Adapter/Cache/CacheTracer.php:46) at Shopware\Core\Framework\Adapter\Cache\CacheTracer->trace() (vendor/shopware/storefront/Framework/Cache/CacheTracer.php:41) at Shopware\Storefront\Framework\Cache\CacheTracer->Shopware\Storefront\Framework\Cache\{closure}() (vendor/shopware/storefront/Theme/ThemeConfigValueAccessor.php:59) at Shopware\Storefront\Theme\ThemeConfigValueAccessor->trace() (vendor/shopware/storefront/Framework/Cache/CacheTracer.php:42) at Shopware\Storefront\Framework\Cache\CacheTracer->trace() (vendor/shopware/core/Content/Category/SalesChannel/CachedCategoryRoute.php:104) at Shopware\Core\Content\Category\SalesChannel\CachedCategoryRoute->Shopware\Core\Content\Category\SalesChannel\{closure}() (vendor/symfony/cache-contracts/CacheTrait.php:72) at Shopware\Core\Framework\Adapter\Cache\CacheDecorator->doGet() (vendor/symfony/cache-contracts/CacheTrait.php:35) at Shopware\Core\Framework\Adapter\Cache\CacheDecorator->get() (vendor/shopware/core/Content/Category/SalesChannel/CachedCategoryRoute.php:109) at Shopware\Core\Content\Category\SalesChannel\CachedCategoryRoute->Shopware\Core\Content\Category\SalesChannel\{closure}() (vendor/shopware/core/Profiling/Profiler.php:59) at Shopware\Core\Profiling\Profiler::trace() (vendor/shopware/core/Content/Category/SalesChannel/CachedCategoryRoute.php:112) at Shopware\Core\Content\Category\SalesChannel\CachedCategoryRoute->load() (custom/plugins/SwagPayPal/src/Checkout/ExpressCheckout/SalesChannel/ExpressCategoryRoute.php:103) at Swag\PayPal\Checkout\ExpressCheckout\SalesChannel\ExpressCategoryRoute->load() (vendor/shopware/storefront/Page/Navigation/NavigationPageLoader.php:66) at Shopware\Storefront\Page\Navigation\NavigationPageLoader->load() (vendor/shopware/storefront/Controller/NavigationController.php:62) at Shopware\Storefront\Controller\NavigationController->index() (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:75) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle() (vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php:86) at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle() (vendor/symfony/http-kernel/HttpCache/HttpCache.php:481) at Symfony\Component\HttpKernel\HttpCache\HttpCache->forward() (vendor/symfony/http-kernel/HttpCache/HttpCache.php:454) at Symfony\Component\HttpKernel\HttpCache\HttpCache->fetch() (vendor/symfony/http-kernel/HttpCache/HttpCache.php:348) at Symfony\Component\HttpKernel\HttpCache\HttpCache->lookup() (vendor/symfony/http-kernel/HttpCache/HttpCache.php:226) at Symfony\Component\HttpKernel\HttpCache\HttpCache->handle() (vendor/shopware/core/HttpKernel.php:156) at Shopware\Core\HttpKernel->doHandle() (vendor/shopware/core/HttpKernel.php:81) at Shopware\Core\HttpKernel->handle() (public/index.php:85) |