Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c0ce60

Browse files
authored
Merge pull request magento#2023 from magento/kh_graphql-pr-7-12
Updates for GraphQL PR magento#7 and magento#12
2 parents 59a15e0 + 10ba76d commit 3c0ce60

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

guides/v2.3/graphql/reference/products.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ items: [ProductInterface]
105105
page_info: SearchResultPageInfo
106106
total_count: Int
107107
filters: [LayerFilter]
108+
sort_fields: SortFields
108109
{% endhighlight %}
109110

110111
Each attribute is described below:
@@ -115,6 +116,7 @@ Attribute | Description
115116
`page_info` | An object that includes the `page_info` and `currentPage` values specified in the query
116117
`total_count` | The number of products returned
117118
`filters` | An array of layered navigation filters. These filters can be used to implement layered navigation on your app.
119+
`sort_fields` | An object that includes the default sort field and all available sort fields
118120

119121

120122
When a product requires a filter attribute that is not a field on its output schema, inject the attribute name into the class in a module's `di.xml` file.
@@ -129,7 +131,7 @@ When a product requires a filter attribute that is not a field on its output sch
129131
</arguments>
130132
</type>
131133
```
132-
This example adds `field_to_sort` and `other_field_to_sort` attributes to the `additionalAttributes` array, which is defined in the `ProductEntityAttributesForAst` class. The array automatically contains the `min_price`, `max_price`, and `category_ids`attributes.
134+
This example adds `field_to_sort` and `other_field_to_sort` attributes to the `additionalAttributes` array defined in the `ProductEntityAttributesForAst` class. The array also contains the `min_price`, `max_price`, and `category_ids`attributes.
133135

134136

135137
## ProductInterface {#ProductInterface}
@@ -150,6 +152,7 @@ The following table defines the `ProductInterface` attributes and objects.
150152
Attribute | Data type | Description
151153
--- | --- | ---
152154
`attribute_set_id` | Int | The attribute set assigned to the product
155+
`canonical_url` | String | The canonical URL for the product
153156
`categories` | [CategoryInterface] | The categories assigned to the product. See [categories endpoint]({{ page.baseurl }}/graphql/reference/categories.html) for more information
154157
`category_ids` | [Int] | An array of category IDs the product belongs to
155158
`country_of_manufacture` | String | The product's country of origin
@@ -323,6 +326,22 @@ Field | Type | Description
323326
`value_string` | String | The value for filter request variable to be used in a query
324327
`items_count` | Int | The number of items the filter returned
325328

329+
## SortFields object
330+
331+
The `SortFields` object contains the default value for sort fields as well as all possible sort fields.
332+
333+
Field | Type | Description
334+
--- | --- | ---
335+
`default` | String | The default sort field
336+
`options` | `SortField` | An array that contains all the fields you can use for sorting
337+
338+
### SortField object
339+
340+
Field | Type | Description
341+
--- | --- | ---
342+
`value` | String | The attribute name or code to use as the sort field
343+
`label` | String | The attribute's label
344+
326345
## Sample query
327346

328347
You can review several general interest `products` queries at [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html).

0 commit comments

Comments
 (0)