foreach ($crossSellings as $crossSelling) { $clone =
clone $criteria;
if ($this->
useProductStream($crossSelling)) { $element =
$this->
loadByStream($crossSelling,
$context,
$clone);
} else { $element =
$this->
loadByIds($crossSelling,
$context,
$clone);
} $elements->
add($element);
} $this->eventDispatcher->
dispatch(new ProductCrossSellingsLoadedEvent($elements,
$context));
return new ProductCrossSellingRouteResponse($elements);
} private function loadCrossSellings(string
$productId, SalesChannelContext
$context): ProductCrossSellingCollection
{ $criteria =
new Criteria();
$criteria->
setTitle('product-cross-selling-route'
);
$criteria ->
addAssociation('assignedProducts'
) ->
addFilter(new EqualsFilter('product.id',
$productId))