Skip to content

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\Range;
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Aggregation\ProductStockRangeAggregation;

$productQuery = new ProductQuery();
$productQuery->setAggregations([
    new ProductStockRangeAggregation('stock', [
        Range::ofInt(null, 10),
        Range::ofInt(10, 100),
        Range::ofInt(100, null),
    ]),
]);