Skip to content

Commit 792252b

Browse files
mnoconadriendupuis
andauthored
Apply suggestions from code review
Co-authored-by: Adrien Dupuis <[email protected]>
1 parent 0cd5ae4 commit 792252b

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

docs/content_management/data_migration/importing_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ The provided conditions overwrite any already existing ones.
522522
[[= include_file('code_samples/data_migration/examples/discounts/discount_update.yaml') =]]
523523
```
524524

525-
For a list of available conditions, see [Discounts API](discounts_api.md).
525+
For a list of available conditions, see [Discounts API](discounts_api.md#conditions).
526526

527527
## Criteria
528528

docs/discounts/discounts_api.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ By integrating with the [Discount feature](discounts_guide.md) you can automate
1414

1515
For example, you can automatically create a discount when a customer places their 3rd order, encouraging them to make another purchase and increase their chances of becoming a local customer.
1616

17-
You can manage discounts using [data migrations](importing_data.md#discounts), [REST API](/api/rest_api/rest_api_reference/rest_api_reference.html#discounts), or the PHP API by using the [Ibexa\Contracts\Discounts\DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) service.
17+
You can manage discounts using [data migrations](importing_data.md#discounts), [REST API](/api/rest_api/rest_api_reference/rest_api_reference.html#discounts), or the PHP API by using the [`Ibexa\Contracts\Discounts\DiscountServiceInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) service.
1818

1919
The core concepts when working with discounts through the APIs are listed below.
2020

2121
### Types
2222

2323
When using the PHP API, the discount type defines where the discount can be applied.
2424

25-
Discounts are applied in two places, listed in the [DiscountType](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountType.html) class:
25+
Discounts are applied in two places, listed in the [`DiscountType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountType.html) class:
2626

2727
- **Product catalog** - `catalog` discounts are activated when browsing the product catalog and do not require any action from the customer to be activated
2828
- **Cart** - `cart` discounts can activate when entering the [cart](cart.md), if the right conditions are met. They may also require entering a discount code to be activated
@@ -31,7 +31,7 @@ Regardless of activation place, discounts always apply to products and reduce th
3131

3232
To define when a discount activates and how the price is reduced, use rules and conditions.
3333
They make use of the [Symfony Expression language]([[= symfony_doc=]]//components/expression_language.html).
34-
Use the expression values provided below when using data migrations or the REST API to pass the right values.
34+
Use the expression values provided below when using data migrations or when parsing REST API responses.
3535

3636
### Rules
3737

@@ -40,8 +40,8 @@ The following discount rule types are available:
4040

4141
| Rule type | Identifier | Description | Expression value |
4242
|---|---|---|---|
43-
| `Ibexa\Discounts\Value\DiscountRule\FixedAmount` | `fixed_amount` | Deducts the specified amount, for example 10 EUR, from the base price | `discount_amount` |
44-
| `Ibexa\Discounts\Value\DiscountRule\Percentage` | `percentage` | Deducts the specified percentage, for example -10%, from the base price | `discount_percentage` |
43+
| `Ibexa\Discounts\Value\DiscountRule\FixedAmount` | <nobr>`fixed_amount`</nobr> | Deducts the specified amount, for example <nobr>10 EUR</nobr>, from the base price | <nobr>`discount_amount`</nobr> |
44+
| `Ibexa\Discounts\Value\DiscountRule\Percentage` | <nobr>`percentage`</nobr> | Deducts the specified percentage, for example -10%, from the base price | <nobr>`discount_percentage`</nobr> |
4545

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

@@ -90,13 +90,13 @@ The discount has four properties that can be translated:
9090
| Promotion label | Information displayed to customers |
9191
| Promotion description | Information displayed to customers |
9292

93-
Use the [DiscountTranslationStruct](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Struct-DiscountTranslationStruct.html) to provide translations for discounts.
93+
Use the [`DiscountTranslationStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Struct-DiscountTranslationStruct.html) to provide translations for discounts.
9494

9595
### Discount codes
9696

9797
To activate a cart discount only after a proper discount code is provided, you need to:
9898

99-
1. Create a discount code using the [DiscountCodeServiceInterface::createDiscountCode()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-DiscountCodeServiceInterface.html#method_createDiscountCode) method
99+
1. Create a discount code using the [`DiscountCodeServiceInterface::createDiscountCode()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-DiscountCodeServiceInterface.html#method_createDiscountCode) method
100100
1. Attach it to a discount by using the `IsValidDiscountCode` condition
101101

102102
Set the [`usedLimit`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-Value-Struct-DiscountCodeCreateStruct.html#method___construct) property to the number of times a single customer can use this code, or to `null` to make the usage unlimited.
@@ -107,12 +107,13 @@ The [`DiscountCodeServiceInterface::registerUsage()`](/api/php_api/php_api_refer
107107

108108
The example below contains a Command creating a cart discount. The discount:
109109

110-
- has the highest possible priority value
111-
- deducts 10 EUR from the base price of the product
112-
- is permanent
113-
- is valid in Germany and France
114-
- applies to 2 products
115-
- requires a `summer10` discount code to be activated. The code can be used unlimited number of times
110+
- has the highest possible [priority](#priority) value
111+
- [rule](#rules) deducts 10 EUR from the base price of the product
112+
- is [permanent](#start-and-end-date)
113+
- [depends](#conditions) on
114+
- being bought from Germany or France
115+
- 2 products
116+
- a `summer10` [discount code](#discount-codes) which can be used unlimited number of times
116117

117118
``` php hl_lines="60-66 68-92"
118119
[[= include_file('code_samples/discounts/src/Command/ManageDiscountsCommand.php') =]]
@@ -122,7 +123,7 @@ Similarly, use the `deleteDiscount`, `deleteTranslation`, `disableDiscount`, `en
122123

123124
## Search
124125

125-
You can search for Discounts using the [`DiscountServiceInterface::findDiscounts()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html#method_findDiscounts) method.
126+
You can search for Discounts using the [`DiscountServiceInterface::findDiscounts()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html#method_findDiscounts) method.
126127
To learn more about the available search options, see Discounts' [Search Criteria](discounts_criteria.md) and [Sort Clauses](discounts_sort_clauses.md).
127128

128129
For discount codes, you can query the database for discount code usage using [`DiscountCodeServiceInterface::findCodeUsages()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-DiscountCodeServiceInterface.html#method_findCodeUsages) and [`DiscountCodeUsageQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-Value-Query-DiscountCodeUsageQuery.html).

0 commit comments

Comments
 (0)