Skip to content

Commit 676a06e

Browse files
committed
Merge remote-tracking branch 'rogyar/graphql-add-parent-category-filter' into HB-PR-delivery-Nov
2 parents a91919e + a059c82 commit 676a06e

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ input ProductAttributeFilterInput @doc(description: "ProductAttributeFilterInput
326326
input CategoryFilterInput @doc(description: "CategoryFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.")
327327
{
328328
ids: FilterEqualTypeInput @doc(description: "Filter by category ID that uniquely identifies the category.")
329+
parent_id: FilterEqualTypeInput @doc(description: "Filter by parent category ID")
329330
url_key: FilterEqualTypeInput @doc(description: "Filter by the part of the URL that identifies the category.")
330331
name: FilterMatchTypeInput @doc(description: "Filter by the display name of the category.")
331332
url_path: FilterEqualTypeInput @doc(description: "Filter by the URL path for the category.")

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/CategoriesQuery/CategoriesFilterTest.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,20 @@ public function filterSingleCategoryDataProvider(): array
569569
'position' => '1'
570570
]
571571
],
572+
[
573+
'parent_id',
574+
'eq',
575+
'4',
576+
[
577+
'id' => '5',
578+
'name' => 'Category 1.1.1',
579+
'url_key' => 'category-1-1-1',
580+
'url_path' => 'category-1/category-1-1/category-1-1-1',
581+
'children_count' => '0',
582+
'path' => '1/2/3/4/5',
583+
'position' => '1'
584+
]
585+
],
572586
[
573587
'name',
574588
'match',
@@ -642,6 +656,41 @@ public function filterMultipleCategoriesDataProvider(): array
642656
]
643657
]
644658
],
659+
// Filter by multiple parent IDs
660+
[
661+
'parent_id',
662+
'in',
663+
'["3", "4"]',
664+
[
665+
[
666+
'id' => '4',
667+
'name' => 'Category 1.1',
668+
'url_key' => 'category-1-1',
669+
'url_path' => 'category-1/category-1-1',
670+
'children_count' => '0',
671+
'path' => '1/2/3/4',
672+
'position' => '1'
673+
],
674+
[
675+
'id' => '5',
676+
'name' => 'Category 1.1.1',
677+
'url_key' => 'category-1-1-1',
678+
'url_path' => 'category-1/category-1-1/category-1-1-1',
679+
'children_count' => '0',
680+
'path' => '1/2/3/4/5',
681+
'position' => '1'
682+
],
683+
[
684+
'id' => '13',
685+
'name' => 'Category 1.2',
686+
'url_key' => 'category-1-2',
687+
'url_path' => 'category-1/category-1-2',
688+
'children_count' => '0',
689+
'path' => '1/2/3/13',
690+
'position' => '2'
691+
]
692+
]
693+
],
645694
//Filter by multiple url keys
646695
[
647696
'url_key',

0 commit comments

Comments
 (0)