Skip to content

Commit

Permalink
Add fix for channel when Findo is inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
Radomir98 committed Mar 11, 2024
1 parent eb6b8f8 commit 1bc3f27
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ public function load(
);

if (!$shouldHandleRequest) {
return $this->decorated->load($request, $context, $criteria);
$result = $this->decorated->load($request, $context, $criteria)->getListingResult();
}

$query = $request->query->get('search');
$result = $this->doSearch($criteria, $context, $query);
$result = ProductListingResult::createFrom($result);

if (!isset($result)) {
$result = $this->doSearch($criteria, $context, $query);
$result = ProductListingResult::createFrom($result);
}
$result->addCurrentFilter('search', $query);

$this->eventDispatcher->dispatch(
Expand Down
12 changes: 12 additions & 0 deletions src/Storefront/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ private function buildSearchPageLoader(?SearchPageLoader $searchPageLoader): Sea
*/
public function search(SalesChannelContext $context, Request $request): Response
{
$this->config->initializeBySalesChannel($context);
if (
!Utils::shouldHandleRequest(
$request,
$context->getContext(),
$this->serviceConfigResource,
$this->config
)
) {
return $this->decorated->search($context, $request);
}

if ($redirectResponse = $this->handleFindologicSearchParams($request)) {
return $redirectResponse;
}
Expand Down

0 comments on commit 1bc3f27

Please sign in to comment.