diff --git a/docs/search/aggregation_reference/aggregation_reference.md b/docs/search/aggregation_reference/aggregation_reference.md index 0c546d70ea..46ebc3ecf5 100644 --- a/docs/search/aggregation_reference/aggregation_reference.md +++ b/docs/search/aggregation_reference/aggregation_reference.md @@ -59,6 +59,7 @@ There are three types of aggregations: |---|---|---| |[Product attribute](product_attribute_aggregations.md) | Term / Range | Product attribute values | |[ProductAvailabilityTerm](productavailabilityterm_aggregation.md) | Term | Product availability | +|[ProductStockRange](productstockrange_aggregation.md) | Range | Product stock | |[ProductPriceRange](productpricerange_aggregation.md) | Range | Product price | |[ProductTypeTerm](producttypeterm_aggregation.md) | Term | Product type | |[TaxonomyEntryIdAggregation](taxonomyentryid_aggregation.md) | Term | Product category | diff --git a/docs/search/aggregation_reference/productstockrange_aggregation.md b/docs/search/aggregation_reference/productstockrange_aggregation.md new file mode 100644 index 0000000000..a67297f614 --- /dev/null +++ b/docs/search/aggregation_reference/productstockrange_aggregation.md @@ -0,0 +1,21 @@ +# ProductStockRangeAggregation + +The ProductStockRangeAggregation aggregates search results by products' numerical stock. + +## Arguments + +- `name` - name of the Aggregation +- `ranges` - array of Range objects that define the borders of the specific range sets + +## Example + +``` php +$productQuery = new ProductQuery(); +$productQuery->setAggregations([ + new ProductStockRangeAggregation('stock', [ + new Range(null, 10), + new Range(10, 100), + new Range(100, null), + ]), +]); +``` diff --git a/docs/search/criteria_reference/product_search_criteria.md b/docs/search/criteria_reference/product_search_criteria.md index f4b1cc9013..f8823c763e 100644 --- a/docs/search/criteria_reference/product_search_criteria.md +++ b/docs/search/criteria_reference/product_search_criteria.md @@ -21,6 +21,8 @@ Search Criterion let you to filter product by specific attributes, for example: |[IntegerAttribute](integerattribute_criterion.md)|Value of product's integer attribute| |[SelectionAttribute](selectionattribute_criterion.md)|Value of product's selection attribute| |[ProductAvailability](productavailability_criterion.md)|Product's availability| +|[ProductStock](productstock_criterion.md)|Product's numerical stock| +|[ProductStockRange](productstockrange_criterion.md)|Product's numerical stock| |[ProductCategory](productcategory_criterion.md)|Product category assigned to product| |[ProductCode](productcode_criterion.md)|Product's code| |[ProductName](productname_criterion.md)|Product's name| diff --git a/docs/search/criteria_reference/productstock_criterion.md b/docs/search/criteria_reference/productstock_criterion.md new file mode 100644 index 0000000000..c4b3911422 --- /dev/null +++ b/docs/search/criteria_reference/productstock_criterion.md @@ -0,0 +1,26 @@ +# ProductStock Criterion + +The `ProductStock` Search Criterion searches for products by their numerical stock. + +## Arguments + +- `value` - the numerical stock to search for +- (optional) `operator` - operator string (`=` `<` `<=` `>` `>=`) + +## Example + +``` php +$productQuery = new ProductQuery( + null, + new Criterion\ProductStock(10) +); +``` + +``` php +$productQuery = new ProductQuery( + null, + new Criterion\ProductStock(50, '>=') +); +``` + + diff --git a/docs/search/criteria_reference/productstockrange_criterion.md b/docs/search/criteria_reference/productstockrange_criterion.md new file mode 100644 index 0000000000..92608d1549 --- /dev/null +++ b/docs/search/criteria_reference/productstockrange_criterion.md @@ -0,0 +1,19 @@ +# ProductStockRange Criterion + +The `ProductStockRange` Search Criterion searches for products by their numerical stock. + +## Arguments + +- `min` - minimum stock +- `max` - maximum stock + +## Example + +``` php +$productQuery = new ProductQuery( + null, + new Criterion\ProductStockRange(10, 120) +); +``` + + diff --git a/mkdocs.yml b/mkdocs.yml index c470e40673..a8376f2b8f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -459,6 +459,8 @@ nav: - FloatAttribute: search/criteria_reference/floatattribute_criterion.md - IntegerAttribute: search/criteria_reference/integerattribute_criterion.md - ProductAvailability: search/criteria_reference/productavailability_criterion.md + - ProductStock: search/criteria_reference/productstock_criterion.md + - ProductStockRange: search/criteria_reference/productstockrange_criterion.md - ProductCategory: search/criteria_reference/productcategory_criterion.md - ProductCode: search/criteria_reference/productcode_criterion.md - ProductName: search/criteria_reference/productname_criterion.md @@ -596,6 +598,7 @@ nav: - KeywordTermAggregation: search/aggregation_reference/keywordterm_aggregation.md - Product attribute aggregations: search/aggregation_reference/product_attribute_aggregations.md - ProductAvailabilityTermAggregation: search/aggregation_reference/productavailabilityterm_aggregation.md + - ProductStockRangeAggregation: search/aggregation_reference/productstockrange_aggregation.md - ProductPriceRangeAggregation: search/aggregation_reference/productpricerange_aggregation.md - ProductTypeTermAggregation: search/aggregation_reference/producttypeterm_aggregation.md - SelectionTermAggregation: search/aggregation_reference/selectionterm_aggregation.md