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

Commit

Permalink
Added correct sort type for products query in graphql (#6627)
Browse files Browse the repository at this point in the history
* Added correct sort type for products query in graphql

* another change

* corrected page size and removed color attribute

* Update products.md

* Gave alternative to enabling the color attribute

Co-authored-by: Kevin Harper <keharper@users.noreply.github.com>
  • Loading branch information
VinothKumar361 and keharper authored Feb 12, 2020
1 parent 7117d2b commit 90b3f48
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/guides/v2.3/graphql/queries/products.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ products(
filter: ProductAttributeFilterInput
pageSize: Int
currentPage: Int
sort: ProductSortFilterInput
sort: ProductAttributeSortInput
): Products
```

Expand Down Expand Up @@ -280,7 +280,7 @@ The `AggregationOption` array contains a list of possible options for the `attri
Attribute | Data type | Description
--- | --- | ---
`count` | Int | The number of items returned by the filter
`label` | String! | The label of the filter
`label` | String | The label of the filter
`value` | String! | The internal ID representing the value of the option

### ProductInterface attributes {#ProductInterface}
Expand Down Expand Up @@ -352,7 +352,7 @@ The following search returns items that contain the word `yoga` or `pants`. The

```graphql
{
products(search: "Yoga pants", pageSize: 10) {
products(search: "Yoga pants", pageSize: 2) {
total_count
items {
name
Expand Down Expand Up @@ -519,6 +519,9 @@ The following query returns aggregations for a query that filters on items with
- In the price range of $30 - $39.99
- Comes in black (color `49`)

{:.bs-callout-info}
By default, you cannot filter on the `color` attribute. [Filtering with custom attributes]({{page.baseurl}}/graphql/custom-filters.html) describes how to enable this attribute for filtering. You can also run the following query without enabling the attribute by deleting `, color: {eq: "49"}`.

**Request:**

```graphql
Expand Down Expand Up @@ -1025,7 +1028,7 @@ In the following example, a catalog price rule that provides a 10% discount on a

### Sort by a custom attribute

In this example, the `description` attribute has been enabled by setting the **Stores** > Attributes > **Product** > description > **Storefront Properties** > **Use in Search** and **Used in Sorting in Product Listing** fields to Yes. The query returns all products with a price range of $28 to $30, sorted by the description.
In this example, the `description` attribute has been enabled by setting the **Stores** > Attributes > **Product** > description > **Storefront Properties** > **Use in Search** and **Used for Sorting in Product Listing** fields to Yes. The query returns all products with a price range of $28 to $30, sorted by the description.

**Request:**

Expand Down

0 comments on commit 90b3f48

Please sign in to comment.