Skip to content

Commit

Permalink
fix: correct check for existing elements in ProductListingResult
Browse files Browse the repository at this point in the history
  • Loading branch information
tinect committed Sep 9, 2023
1 parent cef16f2 commit 1589cf1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Subscriber/FroshCrossSellingProductListingSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ public function handleCrossSellingLoadedEvent(ProductCrossSellingsLoadedEvent $e

private function getProductCollection(ProductListingResult $productWithComparableData): ProductCollection
{
if ($productWithComparableData->getTotal() === 0) {
return new ProductCollection();
}

/** @var array<ProductEntity> $elements */
$elements = $productWithComparableData->getElements();

if (count($elements) === 0) {
return new ProductCollection();
}

return new ProductCollection($elements);
}

Expand Down

0 comments on commit 1589cf1

Please sign in to comment.