Skip to content

Commit 885876a

Browse files
committed
Review suggestion
1 parent 4a58964 commit 885876a

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

docs/pim/product_api.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,25 @@ To delete a product, use `LocalProductServiceInterface::deleteProduct()`:
5858

5959
### Product variants
6060

61+
#### Searching for variants of a specific product
62+
6163
You can access the variants of a product by using the [`ProductServiceInterface::findProductVariants()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductServiceInterface.html#method_findProductVariants) method.
6264
The method takes the product object and a [`ProductVariantQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductVariantQuery.html) object as parameters.
6365

64-
You can filter variants by variant codes or use product criteria:
66+
You can filter variants by:
67+
68+
- variant codes:
69+
70+
``` php
71+
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 50, 54) =]]
72+
```
73+
74+
- product criteria:
75+
76+
To use [Product Search Criteria](product_search_criteria.md) and [Product Sort Clauses](product_sort_clauses.md) with [`ProductVariantQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductVariantQuery.html), wrap it with a [`ProductCriterionAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Content-Query-Criterion-ProductCriterionAdapter.html) class, as in the example below:
6577

6678
``` php
67-
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 50, 66) =]]
79+
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 55, 66) =]]
6880
```
6981

7082
From a variant ([`ProductVariantInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-ProductVariantInterface.html)), you can access the attributes that are used to generate the variant by using [`ProductVariantInterface::getDiscriminatorAttributes()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-ProductVariantInterface.html#method_getDiscriminatorAttributes).
@@ -73,20 +85,27 @@ From a variant ([`ProductVariantInterface`](/api/php_api/php_api_reference/class
7385
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 69, 73) =]]
7486
```
7587

76-
See [Product Search Criteria](product_search_criteria.md) and [Product Sort Clauses](product_sort_clauses.md) references for more information about how to use the [`ProductVariantQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductVariantQuery.html) class.
77-
78-
#### Searching variants across products
88+
#### Searching for variants across all products
7989

8090
To search for variants across all products, use [`ProductServiceInterface::findVariants()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductServiceInterface.html#method_findVariants).
8191
This method takes a [`ProductVariantQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductVariantQuery.html) object and returns variants regardless of their base product.
8292

8393
Unlike `findProductVariants()`, which requires a specific product object, `findVariants()` allows you to search the entire variant catalog.
8494

85-
You can filter variants using Product Criteria wrapped in a [`ProductCriterionAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Content-Query-Criterion-ProductCriterionAdapter.html).
86-
For example, you can search for variants with specific product codes or attribute values, as below:
95+
You can filter variants by:
96+
97+
- variant codes:
98+
99+
``` php
100+
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 83, 87) =]]
101+
```
102+
103+
- product criteria:
104+
105+
To use [Product Search Criteria](product_search_criteria.md) and [Product Sort Clauses](product_sort_clauses.md) with [`ProductVariantQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Product-ProductVariantQuery.html), wrap it with a [`ProductCriterionAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Content-Query-Criterion-ProductCriterionAdapter.html) class, as in the example below:
87106

88107
``` php
89-
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 83, 100) =]]
108+
[[= include_file('code_samples/api/product_catalog/src/Command/ProductVariantCommand.php', 92, 100) =]]
90109
```
91110

92111
#### Creating variants

docs/search/criteria_reference/product_search_criteria.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ page_type: reference
55

66
# Product Search Criteria reference
77

8-
Product Search Criteria are supported by [Product Search (`ProductServiceInterface::findProduct`)](product_api.md#products).
8+
Product Search Criteria are supported by [product and product variant search)](product_api.md#products) with the following methods:
99

10-
Search Criterion let you filter product by specific attributes, for example, color, availability, or price.
10+
- `ProductServiceInterface::findProducts()`
11+
- `ProductServiceInterface::findProductVariants()`
12+
- `ProductServiceInterface::findVariants()`
1113

12-
Product Search Criteria can also be used with `ProductVariantQuery` when wrapped in a [`ProductCriterionAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-Content-Query-Criterion-ProductCriterionAdapter.html).
13-
See the [product variant search examples](product_api.md#searching-variants-across-products) for more information.
14+
Search Criterion let you filter product by specific attributes, for example, color, availability, or price.
1415

1516
## Product Search Criteria
1617

0 commit comments

Comments
 (0)