Skip to content

Commit 52040b9

Browse files
mnoconadriendupuis
andauthored
Apply suggestions from code review
Co-authored-by: Adrien Dupuis <[email protected]>
1 parent 4bd5562 commit 52040b9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

docs/discounts/discounts_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The following discount rule types are available in the `\Ibexa\Discounts\Value\D
4444

4545
Only a single discount can be applied to a given product, and a discount can only have a single rule.
4646

47-
When creating a rule through other means than the user interface, you must pass the required expression values for the rule to be valid:
47+
When creating a rule, not with the user interface but an API, you must pass the required expression values for the rule to be valid:
4848

4949
- using PHP, the values are passed through the constuctor which converts them into an expression variable
5050
- using data migrations and the REST API, the values are specified using the `expressionValues` key

docs/discounts/extend_discounts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ For both of them, you need to specify their logic with [Symfony's expression lan
2929
You can use the following built-in expressions (variables and functions) in your own custom conditions and rules.
3030
You can also [create your own](#custom-expressions).
3131

32-
| Type | Name | Value | Available for |
32+
| Type | Name | Value | Available for |
3333
| --- | --- | --- | --- |
3434
| Function | `get_current_region()` | [Region object](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-RegionInterface.html) of the current siteaccess.| Conditions, rules |
3535
| Function | `is_in_category()` | `true/false`, depending if a product belongs to given [product categories](pim_guide.md#product-categories).| Conditions, rules |
@@ -116,12 +116,12 @@ This condition can be used in both catalog and cart discounts.
116116
To implement a cart-only discount, additionally implement the marker [`CartDiscountConditionInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-CartDiscountConditionInterface.html) interface.
117117

118118
The `tolerance` option is made available for usage in the expression by passing it in the constructor.
119-
The `getExpression` method contains the logic of the condition, expressed using the variables and functions available in the expression engine.
119+
The `getExpression()` method contains the logic of the condition, expressed using the variables and functions available in the expression engine.
120120
The expression must evaluate to `true` or `false`, indicating whether the condition is met.
121121

122122
The example uses three expressions:
123123

124-
- the custom `is_anniversary` function, returning a value indicating whether today is user's registration anniversary
124+
- the custom `is_anniversary()` function, returning a value indicating whether today is user's registration anniversary
125125
- the custom `current_user_registration_date` variable, holding the value of current user's registration date
126126
- the custom `tolerance` variable, holding the acceptable tolerance (in days) for the calculation
127127

@@ -157,7 +157,7 @@ To learn how to integrate it into the back office, see [Extend Discounts wizard]
157157

158158
### Implement custom rules
159159

160-
The following example implements a [purchasing power parity](https://en.wikipedia.org/wiki/Purchasing_power_parity) discount, adjusting product's price in the cart based on buyer's region.
160+
The following example implements a [purchasing power parity](https://en.wikipedia.org/wiki/Purchasing_power_parity) discount, adjusting product's price in the cart based on buyer's region.
161161
You could use it, for example, in regions sharing the same currency and apply the rule only to them by using the [`IsInRegions` condition](discounts_api.md#conditions).
162162

163163
To implement a custom rule, create a class implementing the [`DiscountRuleInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountRuleInterface.html).
@@ -166,7 +166,7 @@ To implement a custom rule, create a class implementing the [`DiscountRuleInterf
166166
[[= include_file('code_samples/discounts/src/Discounts/Rule/PurchasingPowerParityRule.php') =]]
167167
```
168168

169-
The `getExpression` method contains the logic of the rule, expressed using the variables and functions available in the expression engine.
169+
The `getExpression()` method contains the logic of the rule, expressed using the variables and functions available in the expression engine.
170170
The expression must return the new price of the product.
171171

172172
It uses three expressions:

docs/discounts/extend_discounts_wizard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Integrate custom rules and conditions into the back office forms.
3-
editions:
3+
editions:
44
- lts-update
55
- commerce
66
month_change: true

0 commit comments

Comments
 (0)