Skip to content

Commit

Permalink
NEXT-36102 - Fix cms product slider
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasrump committed Jul 30, 2024
1 parent fa64d77 commit 6c39fa1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Fix product slider not displaying products from dynamic product groups
issue: NEXT-36102
author: Lukas Rump
---
# Core
* Changed `Shopware\Core\Content\Product\Cms\ProductSliderCmsElementResolver::handleProductStream` to add products with empty variant config.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private function handleProductStream(ProductCollection $streamResult): ProductCo
foreach ($streamResult as $product) {
$variantConfig = $product->getVariantListingConfig();

if (!$variantConfig) {
if (!$variantConfig || ($variantConfig->getMainVariantId() === null && $variantConfig->getDisplayParent() === null)) {
$finalProducts->add($product);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ public static function streamProductDataProvider(): \Generator
self::createProduct($parentId, null, new VariantListingConfig(false, $nonExistentId, [])),
],
];

yield 'empty variantListingConfig' => [
'expectedProductIds' => [$parentId],
'streamProducts' => [
self::createProduct($parentId, null, new VariantListingConfig(null, null, [])),
],
];
}

private static function createProduct(string $id, ?string $parentId, ?VariantListingConfig $config = null): SalesChannelProductEntity
Expand Down

0 comments on commit 6c39fa1

Please sign in to comment.