This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
Discounts Search Criterion reference¶
Search Criteria are found in the Ibexa\Contracts\Discounts\Value\Query\Criterion
namespace, implementing the CriterionInterface interface:
Criterion | Description |
---|---|
CreatedAtCriterion | Find discounts with given creation date |
CreatorCriterion | Find discounts created by specific users |
EndDateCriterion | Find discounts by their end date. For permanent discounts, the end date is set to null |
IdentifierCriterion | Find discounts by their identifier |
IsEnabledCriterion | Find discounts by their status |
LogicalAnd | Composite criterion to group multiple criterions using the AND condition |
LogicalOr | Composite criterion to group multiple criterions using the OR condition |
NameCriterion | Find discounts by their name |
PriorityCriterion | Find discounts by their priority |
StartDateCriterion | Find discounts with given start date |
TypeCriterion | Find cart or catalog discounts by using constants from the DiscountType class |
You can use the FieldValueCriterion's constants like FieldValueCriterion::COMPARISON_CONTAINS
or FieldValueCriterion::COMPARISON_STARTS_WITH
to specify the operator for the condition.
Use the limit
and offset
properties of DiscountQuery to limit the number of results and implement pagination.
The following example shows how you can use the criteria to find all the currently active discounts:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
The criteria limit the result set to discounts matching all of the conditions listed below:
- discount must be enabled
- discount start date is not after the current date
- discount end date is not before the current date or is not specified