Skip to content

Commit 4c1e4ea

Browse files
julitafalconduszaadriendupuisadamwojs
authored
IBX-6702: BasePriceStatsAggregation and CustomPriceStatsAggregation described (#2252)
* BasePriceStatsAggregation and CustomPriceStatsAggregation described * Type updated * Vale fix * Fixes after review * Update custompricestats_aggregation.md Co-authored-by: Adam Wójs <[email protected]> --------- Co-authored-by: Adrien Dupuis <[email protected]> Co-authored-by: Adam Wójs <[email protected]>
1 parent d2c371d commit 4c1e4ea

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

docs/search/aggregation_reference/aggregation_reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ There are three types of aggregations:
5858
|Name | Type | Based on|
5959
|---|---|---|
6060
|[Product attribute](product_attribute_aggregations.md) | Term / Range | Product attribute values |
61+
|[BasePriceStats](basepricestats_aggregation.md) | Stats | Product base price |
62+
|[CustomPriceStats](custompricestats_aggregation.md) | Stats | Product custom price |
6163
|[ProductAvailabilityTerm](productavailabilityterm_aggregation.md) | Term | Product availability |
6264
|[ProductStockRange](productstockrange_aggregation.md) | Range | Product stock |
6365
|[ProductPriceRange](productpricerange_aggregation.md) | Range | Product price |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# BasePriceStatsAggregation
2+
3+
The BasePriceStatsAggregation aggregates search results by the value of the product's price
4+
and provides statistical information for the values. You can use the provided getters to access the values:
5+
6+
- sum (`getSum()`)
7+
- count of values (`getCount()`)
8+
- minimum value (`getMin()`)
9+
- maximum value (`getMax()`)
10+
- average (`getAvg()`)
11+
12+
## Arguments
13+
14+
- `name` - name of the Aggregation
15+
- `\Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface` - currency of the price
16+
17+
## Example
18+
19+
``` php
20+
$query = new ProductQuery();
21+
$query->setAggregations([
22+
new BasePriceStatsAggregation('base_price_stats_aggregation', $currency),
23+
]);
24+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CustomPriceStatsAggregation
2+
3+
The CustomPriceStatsAggregation aggregates search results by the value of the custom product's price
4+
and provides statistical information for the values. You can use the provided getters to access the values:
5+
6+
- sum (`getSum()`)
7+
- count of values (`getCount()`)
8+
- minimum value (`getMin()`)
9+
- maximum value (`getMax()`)
10+
- average (`getAvg()`)
11+
12+
## Arguments
13+
14+
- `name` - name of the Aggregation
15+
- `\Ibexa\Contracts\ProductCatalog\Values\CurrencyInterface` - currency of the price
16+
- `\Ibexa\Contracts\ProductCatalog\Values\CustomerGroupInterface|null` - customer group that defines custom pricing, by default it is the one assigned to current user
17+
18+
## Example
19+
20+
``` php
21+
$query = new ProductQuery();
22+
$query->setAggregations([
23+
new CustomPriceStatsAggregation('custom_price_stats_aggregation', $currency, $customerGroup),
24+
]);
25+
```

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ nav:
675675
- IntegerStatsAggregation: search/aggregation_reference/integerstats_aggregation.md
676676
- KeywordTermAggregation: search/aggregation_reference/keywordterm_aggregation.md
677677
- Product attribute aggregations: search/aggregation_reference/product_attribute_aggregations.md
678+
- BasePriceStatsAggregation: search/aggregation_reference/basepricestats_aggregation.md
679+
- CustomPriceStatsAggregation: search/aggregation_reference/custompricestats_aggregation.md
678680
- ProductAvailabilityTermAggregation: search/aggregation_reference/productavailabilityterm_aggregation.md
679681
- ProductStockRangeAggregation: search/aggregation_reference/productstockrange_aggregation.md
680682
- ProductStockRangeAggregation: search/aggregation_reference/productstockrange_aggregation.md

0 commit comments

Comments
 (0)