Skip to content

Commit

Permalink
Merge pull request #55 from Nosto/SSP-86
Browse files Browse the repository at this point in the history
Ssp 86
  • Loading branch information
Bibarella authored Jul 17, 2024
2 parents 95ff769 + 0231f02 commit fcd4eb9
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Search/Request/Handler/NavigationRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,32 @@
class NavigationRequestHandler extends AbstractRequestHandler
{
public function __construct(
ConfigProvider $configProvider,
SortingHandlerService $sortingHandlerService,
Logger $logger,
ConfigProvider $configProvider,
SortingHandlerService $sortingHandlerService,
Logger $logger,
private readonly SalesChannelRepository $categoryRepository,
) {
)
{
parent::__construct($configProvider, $sortingHandlerService, $logger);
}

public function sendRequest(
Request $request,
Criteria $criteria,
Request $request,
Criteria $criteria,
SalesChannelContext $context,
?int $limit = null,
): SearchResult {
?int $limit = null,
): SearchResult
{
$searchOperation = $this->getSearchOperation($request, $criteria, $context, $limit);

$searchOperation->setCategoryPath(
$this->fetchCategoryPath($request->get('navigationId'), $context),
);

if ($searchOperation->getVariables()["query"] === "" && $searchOperation->getVariables()["sort"] === null) {
$searchOperation->setQuery(null);
}

return $searchOperation->execute();
}

Expand All @@ -63,7 +69,7 @@ private function fetchCategoryPath(string $categoryId, SalesChannelContext $cont

$categoryNames = array_map(function (string $categoryId) use ($mapping, $context, $navigationCategoryId) {
return $mapping[$categoryId];
}, array_filter($pathIds, fn ($id) => $id !== $navigationCategoryId));
}, array_filter($pathIds, fn($id) => $id !== $navigationCategoryId));

$categoryNames[] = $withId === CategoryNamingOptions::WITH_ID
? sprintf(
Expand Down

0 comments on commit fcd4eb9

Please sign in to comment.