Skip to content

Commit 31f13e5

Browse files
author
Roman Lytvynenko
committed
MC-30260: CatalogWidget products list doesn't display products from the children categories of 2nd level and up
1 parent de50d74 commit 31f13e5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ private function updateAnchorCategoryConditions(array $condition): array
373373
return $condition;
374374
}
375375

376-
if ($category->getIsAnchor() && $category->getChildren(true)) {
377-
$children = explode(',', $category->getChildren(true));
378-
376+
$children = $category->getIsAnchor() ? $category->getChildren(true) : [];
377+
if ($children) {
378+
$children = explode(',', $children);
379379
$condition['operator'] = "()";
380380
$condition['value'] = array_merge([$categoryId], $children);
381381
}

dev/tests/integration/testsuite/Magento/Catalog/_files/product_in_nested_anchor_categories.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
'id' => 445,
1717
'parentId' => 444,
1818
'level' => 3,
19-
'path' => '1/2/4'
19+
'path' => '1/2/3/4'
2020
],
2121
[
2222
'id' => 446,
2323
'parentId' => 445,
2424
'level' => 4,
25-
'path' => '1/2/5'
25+
'path' => '1/2/3/4/5'
2626
],
2727
];
2828

0 commit comments

Comments
 (0)