Skip to content

Commit 6d8cda5

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.4-develop' into B2B-319
2 parents 254fa66 + 2fcb9cd commit 6d8cda5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,9 @@ private function getChildrenCategories(int $categoryId): array
21212121
if (in_array($category['parent_id'], $categoryIds)
21222122
&& in_array($category['parent_id'], $anchorCategory)) {
21232123
$categoryIds[] = (int)$category[$linkField];
2124-
if ($category['is_anchor'] == 1) {
2124+
// Storefront approach is to treat non-anchor children of anchor category as anchors.
2125+
// Adding their's IDs to $anchorCategory for consistency.
2126+
if ($category['is_anchor'] == 1 || in_array($category['parent_id'], $anchorCategory)) {
21252127
$anchorCategory[] = (int)$category[$linkField];
21262128
}
21272129
}

dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private static function getAddedFilesList($changedFilesBaseDir)
142142
function () {
143143
// if no list files, probably, this is the dev environment
144144
// phpcs:ignore Generic.PHP.NoSilencedErrors,Magento2.Security.InsecureFunction
145-
@exec('git diff --cached --name-only', $addedFiles);
145+
@exec('git diff --cached --name-only --diff-filter=A', $addedFiles);
146146
return $addedFiles;
147147
}
148148
);

0 commit comments

Comments
 (0)