You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/v2.3/graphql/reference/products.md
+20-1Lines changed: 20 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,7 @@ items: [ProductInterface]
105
105
page_info: SearchResultPageInfo
106
106
total_count: Int
107
107
filters: [LayerFilter]
108
+
sort_fields: SortFields
108
109
{% endhighlight %}
109
110
110
111
Each attribute is described below:
@@ -115,6 +116,7 @@ Attribute | Description
115
116
`page_info` | An object that includes the `page_info` and `currentPage` values specified in the query
116
117
`total_count` | The number of products returned
117
118
`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
118
120
119
121
120
122
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
129
131
</arguments>
130
132
</type>
131
133
```
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` arraydefined in the `ProductEntityAttributesForAst` class. The array also contains the `min_price`, `max_price`, and `category_ids`attributes.
133
135
134
136
135
137
## ProductInterface {#ProductInterface}
@@ -150,6 +152,7 @@ The following table defines the `ProductInterface` attributes and objects.
150
152
Attribute | Data type | Description
151
153
--- | --- | ---
152
154
`attribute_set_id` | Int | The attribute set assigned to the product
155
+
`canonical_url` | String | The canonical URL for the product
153
156
`categories` | [CategoryInterface] | The categories assigned to the product. See [categories endpoint]({{ page.baseurl }}/graphql/reference/categories.html) for more information
154
157
`category_ids` | [Int] | An array of category IDs the product belongs to
155
158
`country_of_manufacture` | String | The product's country of origin
@@ -323,6 +326,22 @@ Field | Type | Description
323
326
`value_string` | String | The value for filter request variable to be used in a query
324
327
`items_count` | Int | The number of items the filter returned
325
328
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
+
326
345
## Sample query
327
346
328
347
You can review several general interest `products` queries at [Searches and pagination in GraphQL]({{ page.baseurl }}/graphql/search-pagination.html).
0 commit comments