$categories =
new CategoryCollection();
if ($depth > 0
) { // Load the first two levels without using the activeId in the query
$categories =
$this->
loadLevels($rootId,
(int) $root['level'
],
$context,
clone $criteria,
$depth);
} // If the active category is part of the provided root id, we have to load the children and the parents of the active id
$categories =
$this->
loadChildren($activeId,
$context,
$rootId,
$metaInfo,
$categories,
clone $criteria);
return new NavigationRouteResponse($categories);
} /**
* @param string[] $ids
*/
private function loadCategories(array
$ids, SalesChannelContext
$context, Criteria
$criteria): CategoryCollection
{ $criteria->
setIds($ids);
$criteria->
addAssociation('media'
);
$criteria->
setTotalCountMode(Criteria::TOTAL_COUNT_MODE_NONE
);