-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add breadcrumb info to GraphQL categories topic #2767
Changes from 1 commit
2bb5798
2a8fba7
e179f2d
2ae5f53
d827569
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,11 @@ title: category endpoint | |
| version: 2.3 | ||
| --- | ||
|
|
||
| The `category` endpoint allows you to search for a single category definition or the entire category tree. | ||
| The `category` endpoint allows you to search for a single category definition or the entire category tree. To return multiple category levels in a single call, define the response so that it contains up to ten nested `children` options. You cannot return the entire category tree if it contains more than 10 sublevels. | ||
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if it helps, but consider adding a "for example" define a response so that it contains up to ten nested Also, in the Sample Queries section -- It might be good to show a real response for the CategoryTree query since it's kind of complicated.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left the description as is, but added sample output. |
||
| ## Query structure | ||
|
|
||
| ``` json | ||
| ``` | ||
| category ( | ||
| id: int | ||
| ): CategoryTree | ||
|
|
@@ -40,17 +40,19 @@ Attribute | Data type | Description | |
| `product_count`| Int | The number of products in the category | ||
| `default_sort_by`| String | The attribute to use for sorting | ||
| `products(<attributes>)` | `CategoryProducts` | The list of products assigned to the category | ||
| `children` | `CategoryTree` | | ||
| `breadcrumbs` | `Breadcrumb` | | ||
|
||
| `children` | `CategoryTree` | A `CategoryTree` object that contains information about a child category. You can specify up to 10 levels of child categories. | ||
|
|
||
|
|
||
| #### CategoryProducts object | ||
|
|
||
| The `products` attribute can contain the following attributes: | ||
|
|
||
| Attribute | Data type | Description | ||
| --- | --- | --- | ||
| `pageSize` | Int | Specifies the maximum number of results to return at once. This attribute is optional. The default value is 20. | ||
| `currentPage` | Int | Specifies which page of results to return. The default value is 1. | ||
| `sort` | `ProductSortInput` Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information. | ||
|
|
||
| #### CategoryProducts | ||
| `sort` | `ProductSortInput` | Specifies which attribute to sort on, and whether to return the results in ascending or descending order. See [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html) for more information. | ||
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the way you changed the "See" reference 🥇 |
||
| The `CategoryProducts` object contains the following attributes: | ||
|
|
||
|
|
@@ -61,28 +63,24 @@ Attribute | Data type | Description | |
| `total_count` | Int | The number of products returned | ||
|
|
||
|
|
||
| The response can contain up to ten nested `children` options that allow you to return multiple levels of the category tree. In most cases, the entire category tree can be returned in a single call. The following response definition returns two levels of categories: | ||
| #### Breadcrumb object | ||
|
|
||
| {% highlight json %} | ||
| { | ||
| category_tree { | ||
| id | ||
| level | ||
| name | ||
| children { | ||
| id | ||
| level | ||
| name | ||
| } | ||
| } | ||
| } | ||
| {% endhighlight %} | ||
| A breadcrumb trail is a set of links that shows customers where they are in relation to other pages in the | ||
| store. | ||
|
|
||
| Attribute | Data type | Description | ||
| --- | --- | --- | ||
| `category_id` | Int | An ID that uniquely identifies the category | ||
| `category_name` | String | The display name of the category | ||
| `category_level` | Int | Indicates the depth of the category within the tree | ||
| `category_url_key` | String | The url key assigned to the category | ||
|
|
||
| ## Sample Query | ||
|
|
||
| ## Sample Queries | ||
|
|
||
| The following query returns information about category ID `20` and four levels of subcategories. In the sample data, category ID `20` is assigned to the "Women" category. | ||
|
|
||
| {% highlight json %} | ||
| ``` | ||
| { | ||
| category(id: 20) { | ||
| products { | ||
|
|
@@ -119,4 +117,24 @@ The following query returns information about category ID `20` and four levels o | |
| } | ||
| } | ||
| } | ||
| {% endhighlight %} | ||
| ``` | ||
|
|
||
| The following query returns breadcrumb information about the women's tops category (`id` = 25). | ||
|
|
||
| ``` | ||
| { | ||
| category ( | ||
| id: 25 | ||
| ) { | ||
| id | ||
| level | ||
| name | ||
| breadcrumbs { | ||
| category_id | ||
| category_name | ||
| category_level | ||
| category_url_key | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider leaving off "for more information about modes" -- just
"See [Set the Magento mode]."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's too terse for me. Changed to
[Set the Magento mode] describes how to check and change the mode.