Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 10912f2

Browse files
authored
GraphQL: Update product query output and add cms_block attribute (#5751)
* update example containing bucket in the output * break out cmsblocks object * add cms-block * review comments
1 parent b8df5ee commit 10912f2

File tree

5 files changed

+106
-116
lines changed

5 files changed

+106
-116
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The `CmsBlock` object can contain the following attributes:
2+
3+
Attribute | Data type | Description
4+
--- | --- | ---
5+
`content` | String | The content of the CMS block in raw HTML
6+
`identifier` | String | The CMS block identifier
7+
`title` | String | The title assigned to the CMS block

guides/v2.3/graphql/product/category-interface.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following table defines the `CategoryInterface` attributes and objects.
1212
Attribute | Type | Description
1313
--- | --- | ---
1414
`breadcrumbs` | [Breadcrumb] | A Breadcrumb object contains information the categories that comprise the breadcrumb trail for the specified category
15+
`cms_block` | CmsBlock | Contains a category CMS block. This attribute is defined in the `CatalogCmsGraphQl` module
1516
`created_at` | String | Timestamp indicating when the category was created
1617
`default_sort_by` | String | The attribute to use for sorting
1718
`description` | String | An optional description of the category
@@ -56,3 +57,7 @@ Attribute | Data type | Description
5657
`items` | [ProductInterface] | An array of products that are assigned to the category. See [ProductInterface]({{ page.baseurl }}/graphql/product/product-interface.html) for more information
5758
`page_info` | `SearchResultPageInfo` | An object that includes the `page_info` and `currentPage` values specified in the query
5859
`total_count` | Int | The number of products returned
60+
61+
### CmsBlock attributes
62+
63+
{% include graphql/cms-block-object.md %}

guides/v2.3/graphql/queries/category-list.md

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -313,63 +313,8 @@ Attribute | Data type | Description
313313

314314
## Output attributes {#Categories}
315315

316-
The query returns a `CategoryTree` object, which implements `CategoryInterface`. It can contain the following top-level attributes:
316+
The query returns a `CategoryTree` object, which implements [`CategoryInterface`]({{page.baseurl}}/graphql/product/category-interface.html). The `CategoryTree` object can contain the following attribute and all attributes defined in `CategoryInterface`:
317317

318318
Attribute | Data type | Description
319319
--- | --- | ---
320-
`breadcrumbs` | `Breadcrumb` | A `Breadcrumb` object contains information about the categories that comprise the breadcrumb trail for the specified category
321-
`children` | `CategoryTree` | A `CategoryTree` object that contains information about a child category. You can specify up to 10 levels of child categories
322-
`created_at`| String | Timestamp indicating when the category was created
323-
`default_sort_by`| String | The attribute to use for sorting
324-
`description`| String | An optional description of the category
325-
`id` | Int | An ID that uniquely identifies the category
326-
`level` | Int | Indicates the depth of the category within the tree
327-
`name`| String | The display name of the category
328-
`path_in_store`| String | The category path in the store
329-
`path`| String | The path to the category, as a string of category IDs, separated by slashes (/). For example, `1/2/20`
330-
`position`| Int | The position of the category relative to other categories at the same level in tree
331-
`product_count`| Int | The number of products in the category
332-
`products(<attributes>)` | `CategoryProducts` | The list of products assigned to the category
333-
`updated_at`| String | Timestamp indicating when the category was updated
334-
`url_key`| String | The URL key assigned to the category
335-
`url_path`| String | The URL path assigned to the category
336-
`url_suffix` | String | The part of the URL that is appended to the `url_key`, such as `.html`. This attribute is defined in the `CatalogUrlRewriteGraphQl` module
337-
338-
### CategoryProducts object
339-
340-
The `products` attribute can contain the following attributes:
341-
342-
Attribute | Data type | Description
343-
--- | --- | ---
344-
`currentPage` | Int | Specifies which page of results to return. The default value is 1
345-
`pageSize` | Int | Specifies the maximum number of results to return at once. This attribute is optional. The default value is 20
346-
`sort` | `ProductSortInput` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) describes sort orders
347-
348-
The `CategoryProducts` object contains the following attributes:
349-
350-
Attribute | Data type | Description
351-
--- | --- | ---
352-
`items` | [[ProductInterface]]({{ page.baseurl }}/graphql/product/product-interface.html) | An array of products that are assigned to the category
353-
`page_info` | `SearchResultPageInfo` | An object that includes the `page_info` and `currentPage` values specified in the query
354-
`total_count` | Int | The number of products returned
355-
356-
### Breadcrumb object
357-
358-
A breadcrumb trail is a set of links that shows customers where they are in relation to other pages in the
359-
store.
360-
361-
Attribute | Data type | Description
362-
--- | --- | ---
363-
`category_id` | Int | An ID that uniquely identifies the category
364-
`category_level` | Int | Indicates the depth of the category within the tree
365-
`category_name` | String | The display name of the category
366-
`category_url_key` | String | The url key assigned to the category
367-
`category_url_path` | String | The URL path of the category
368-
369-
### CategoryTree object
370-
371-
This `CategoryTree` object contains information about the next level of subcategories of the category specified in the original query.
372-
373-
Attribute | Data type | Description
374-
--- | --- | ---
375-
`children` | [CategoryTree] | An array containing the next level of subcategories
320+
`children` | `CategoryTree` | An array containing the next level of subcategories. By default, you can specify up to 10 levels of child categories

guides/v2.3/graphql/queries/cms-blocks.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,8 @@ Attribute | Data type | Description
5656

5757
## Output attributes
5858

59-
The `CmsBlocks` object contains an array of `items`, each of which can contain the following attributes:
59+
The `CmsBlocks` object contains an array of `items`, each of which can contain a `CmsBlock` object.
6060

61-
Attribute | Data type | Description
62-
--- | --- | ---
63-
`content` | String | The content of the CMS block in raw HTML
64-
`identifier` | String | The CMS block identifier
65-
`title` | String | The title assigned to the CMS block
66-
67-
## Related topics
61+
### CmsBlock attributes
6862

69-
[cmsPage query]({{page.baseurl}}/graphql/queries/cms-page.html)
63+
{% include graphql/cms-block-object.md %}

guides/v2.3/graphql/queries/products-234.md

Lines changed: 89 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ filter: {
5050
}
5151
```
5252

53-
Magento processes the attribute values specified in a `ProductAttributeFilterInput` as simple data types (strings, integers, Booleans). However, returned attributes can be a different, complex data type. For example, in a response, `price` is an object that contains a monetary value and a currency code.
53+
Magento processes the attribute values specified in a `ProductAttributeFilterInput` as simple data types (strings, integers, Booleans). However, returned attributes can be a different, complex data type. For example, in a response, `price` is an object that contains a monetary value and a currency code.
5454

5555
By default, you can use the following attributes as filters. To define a custom filter, see [Filtering with custom attributes]({{page.baseurl}}/graphql/custom-filters.html). Use the `input_type` output attribute of the [`customAttributeMetadata` query]({{page.baseurl}}/graphql/queries/custom-attribute-metadata.html) to determine whether your custom filter should include the `FilterEqualTypeInput`, `FilterMatchTypeInput`, or `FilterRangeTypeInput` data type.
5656

@@ -521,9 +521,9 @@ The following query returns aggregations for a query that filters on items with
521521
items {
522522
name
523523
sku
524-
price {
525-
regularPrice {
526-
amount {
524+
price_range {
525+
minimum_price {
526+
regular_price {
527527
value
528528
currency
529529
}
@@ -563,6 +563,11 @@ The following query returns aggregations for a query that filters on items with
563563
"count": 5,
564564
"label": "Category",
565565
"options": [
566+
{
567+
"label": "New Luma Yoga Collection",
568+
"value": "8",
569+
"count": 1
570+
},
566571
{
567572
"label": "Bottoms",
568573
"value": "22",
@@ -582,11 +587,6 @@ The following query returns aggregations for a query that filters on items with
582587
"label": "Performance Fabrics",
583588
"value": "35",
584589
"count": 2
585-
},
586-
{
587-
"label": "New Luma Yoga Collection",
588-
"value": "8",
589-
"count": 1
590590
}
591591
]
592592
},
@@ -642,6 +642,21 @@ The following query returns aggregations for a query that filters on items with
642642
"count": 7,
643643
"label": "Material",
644644
"options": [
645+
{
646+
"label": "Nylon",
647+
"value": "37",
648+
"count": 1
649+
},
650+
{
651+
"label": "Rayon",
652+
"value": "39",
653+
"count": 1
654+
},
655+
{
656+
"label": "LumaTech&trade;",
657+
"value": "148",
658+
"count": 1
659+
},
645660
{
646661
"label": "Microfiber",
647662
"value": "150",
@@ -661,21 +676,6 @@ The following query returns aggregations for a query that filters on items with
661676
"label": "CoolTech&trade;",
662677
"value": "156",
663678
"count": 2
664-
},
665-
{
666-
"label": "LumaTech&trade;",
667-
"value": "148",
668-
"count": 1
669-
},
670-
{
671-
"label": "Nylon",
672-
"value": "37",
673-
"count": 1
674-
},
675-
{
676-
"label": "Rayon",
677-
"value": "39",
678-
"count": 1
679679
}
680680
]
681681
},
@@ -697,10 +697,15 @@ The following query returns aggregations for a query that filters on items with
697697
]
698698
},
699699
{
700-
"attribute_code": "eco_collection_bucket",
701-
"count": 1,
702-
"label": "eco_collection_bucket",
700+
"attribute_code": "eco_collection",
701+
"count": 2,
702+
"label": "Eco Collection",
703703
"options": [
704+
{
705+
"label": "0",
706+
"value": "0",
707+
"count": 3
708+
},
704709
{
705710
"label": "1",
706711
"value": "1",
@@ -709,10 +714,15 @@ The following query returns aggregations for a query that filters on items with
709714
]
710715
},
711716
{
712-
"attribute_code": "performance_fabric_bucket",
713-
"count": 1,
714-
"label": "performance_fabric_bucket",
717+
"attribute_code": "performance_fabric",
718+
"count": 2,
719+
"label": "Performance Fabric",
715720
"options": [
721+
{
722+
"label": "0",
723+
"value": "0",
724+
"count": 2
725+
},
716726
{
717727
"label": "1",
718728
"value": "1",
@@ -721,17 +731,46 @@ The following query returns aggregations for a query that filters on items with
721731
]
722732
},
723733
{
724-
"attribute_code": "new_bucket",
734+
"attribute_code": "erin_recommends",
725735
"count": 1,
726-
"label": "new_bucket",
736+
"label": "Erin Recommends",
737+
"options": [
738+
{
739+
"label": "0",
740+
"value": "0",
741+
"count": 4
742+
}
743+
]
744+
},
745+
{
746+
"attribute_code": "new",
747+
"count": 2,
748+
"label": "New",
727749
"options": [
750+
{
751+
"label": "0",
752+
"value": "0",
753+
"count": 3
754+
},
728755
{
729756
"label": "1",
730757
"value": "1",
731758
"count": 1
732759
}
733760
]
734761
},
762+
{
763+
"attribute_code": "sale",
764+
"count": 1,
765+
"label": "Sale",
766+
"options": [
767+
{
768+
"label": "0",
769+
"value": "0",
770+
"count": 4
771+
}
772+
]
773+
},
735774
{
736775
"attribute_code": "style_bottom",
737776
"count": 5,
@@ -797,19 +836,19 @@ The following query returns aggregations for a query that filters on items with
797836
"count": 4
798837
},
799838
{
800-
"label": "Hot",
801-
"value": "212",
802-
"count": 3
839+
"label": "Spring",
840+
"value": "208",
841+
"count": 1
803842
},
804843
{
805844
"label": "Warm",
806845
"value": "209",
807846
"count": 2
808847
},
809848
{
810-
"label": "Spring",
811-
"value": "208",
812-
"count": 1
849+
"label": "Hot",
850+
"value": "212",
851+
"count": 3
813852
}
814853
]
815854
}
@@ -818,9 +857,9 @@ The following query returns aggregations for a query that filters on items with
818857
{
819858
"name": "Karmen Yoga Pant",
820859
"sku": "WP01",
821-
"price": {
822-
"regularPrice": {
823-
"amount": {
860+
"price_range": {
861+
"minimum_price": {
862+
"regular_price": {
824863
"value": 39,
825864
"currency": "USD"
826865
}
@@ -830,9 +869,9 @@ The following query returns aggregations for a query that filters on items with
830869
{
831870
"name": "Ida Workout Parachute Pant",
832871
"sku": "WP03",
833-
"price": {
834-
"regularPrice": {
835-
"amount": {
872+
"price_range": {
873+
"minimum_price": {
874+
"regular_price": {
836875
"value": 48,
837876
"currency": "USD"
838877
}
@@ -842,9 +881,9 @@ The following query returns aggregations for a query that filters on items with
842881
{
843882
"name": "Bardot Capri",
844883
"sku": "WP08",
845-
"price": {
846-
"regularPrice": {
847-
"amount": {
884+
"price_range": {
885+
"minimum_price": {
886+
"regular_price": {
848887
"value": 48,
849888
"currency": "USD"
850889
}
@@ -854,9 +893,9 @@ The following query returns aggregations for a query that filters on items with
854893
{
855894
"name": "Aeon Capri",
856895
"sku": "WP07",
857-
"price": {
858-
"regularPrice": {
859-
"amount": {
896+
"price_range": {
897+
"minimum_price": {
898+
"regular_price": {
860899
"value": 48,
861900
"currency": "USD"
862901
}

0 commit comments

Comments
 (0)