Skip to content

Commit d7b35ff

Browse files
committed
[Discounts] Added doc for 4.6.22
1 parent 327665e commit d7b35ff

File tree

7 files changed

+90
-9
lines changed

7 files changed

+90
-9
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type: discount_code
2+
mode: create
3+
code: TEST_CODE
4+
global_usage_limit: 100 # Optional
5+
user_usage_limit: 5 # Optional
6+
created_at: '2023-01-01T12:00:00+00:00' # Optional
7+
creator_id: 42 # Optional

docs/api/event_reference/discounts_events.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ month_change: true
1313

1414
The events below are dispatched when managing [discounts](discounts_guide.md):
1515

16-
| Event | Dispatched by |
17-
|---|---|
18-
|[BeforeCreateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeCreateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)
19-
|[CreateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-CreateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)
20-
|[BeforeDeleteDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeDeleteDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)
21-
|[DeleteDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-DeleteDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)
22-
|[BeforeUpdateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeUpdateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)|
23-
|[UpdateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-UpdateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)|
16+
| Event | Dispatched by | Description |
17+
|---|---|---|
18+
|[BeforeCreateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeCreateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) | Dispatched before a discount is created. |
19+
|[CreateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-CreateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) | Dispatched after a discount is created. |
20+
|[BeforeDeleteDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeDeleteDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) | Dispatched before a discount is deleted. |
21+
|[DeleteDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-DeleteDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) | Dispatched after a discount is deleted. |
22+
|[BeforeUpdateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-BeforeUpdateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)| Dispatched before a discount is updated. |
23+
|[UpdateDiscountEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Event-UpdateDiscountEvent.html)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) | Dispatched after a discount is updated. |
24+
|[OverridePrioritizationOnCreateEvent](TODO)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)| Dispatched before a discount is created. Use it to set the `overridePrioritization` property to give a discount [higher priority](discounts_guide.md#discounts-priority). |
25+
|[OverridePrioritizationOnUpdateEvent](TODO)| [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html)| Dispatched before a discount is updated. Use it to set the `overridePrioritization` property to give a discount [higher priority](discounts_guide.md#discounts-priority). |
2426

2527
## Form events
2628

docs/content_management/data_migration/importing_data.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The following data migration step modes are available:
5656
| `currency` | ✔ | ✔ | ✔ | |
5757
| `customer_group` | ✔ | ✔ | ✔ | |
5858
| `discount` | ✔ | ✔ | | |
59+
| `discount_code` | ✔ | | | |
5960
| `language` | ✔ | | | |
6061
| `location` | | ✔ | | ✔ |
6162
| `object_state` | ✔ | | | |
@@ -525,6 +526,14 @@ The provided conditions overwrite any already existing ones.
525526

526527
For a list of available conditions, see [Discounts API](discounts_api.md#conditions).
527528

529+
### Discount codes [[% include 'snippets/lts-update_badge.md' %]]
530+
531+
You can create a discount code as in the following example:
532+
533+
``` yaml
534+
[[= include_file('code_samples/data_migration/examples/discounts/discount_code_create.yaml') =]]
535+
```
536+
528537
## Criteria
529538

530539
When using `update` or `delete` modes, you can use criteria to identify the objects to operate on.

docs/discounts/discounts_guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ A shopping cart can have multiple active discounts, but a specific product can o
5959

6060
When two or more discounts can be applied to a single product, the system evaluates the following properties to choose the right one:
6161

62+
- discount code existence (discounts with discount codes have priority over the others)
6263
- discount activation place (cart discounts rank higher over catalog discounts)
6364
- discount priority (higher priority ranks higher)
6465
- discount creation date (newer discounts rank higher)
@@ -107,7 +108,8 @@ These conditions can include:
107108

108109
For **cart discounts**, you can specify an additional text value that needs to be entered in the cart for the discount to apply.
109110

110-
The discount code usage can be limited per customer:
111+
The discount code usage can be limited globally, for example by making the discount valid only for the first 10 customers using it before it expires.
112+
You can also limit the usage per customer:
111113

112114
- single use: every customer can use this code only once
113115
- limited use: every customer can use the code a specified number of times

docs/release_notes/ibexa_dxp_v4.6.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,44 @@ month_change: true
1010

1111
<div class="release-notes" markdown="1">
1212

13+
[[% set version = 'v4.6.22' %]]
14+
[[= release_note_entry_begin("Discounts " + version, 'TODO', ['LTS Update', 'Commerce']) =]]
15+
16+
#### Global discount codes
17+
18+
- You can now [limit the number of times](discounts_guide.md#discount-codes) a discount code can be used before it expires
19+
20+
#### Discount codes prioritization
21+
22+
- Discounts with discount codes now have priority over the other discounts
23+
24+
#### Discount codes migrations
25+
26+
- You can now create discount codes using [data migrations](importing_data.md#discount-codes).
27+
28+
#### PHP API
29+
30+
The PHP API has been enhanced with the following new classes:
31+
32+
- TODO
33+
34+
[[= release_note_entry_end() =]]
35+
[[= release_note_entry_begin("Ibexa DXP " + version, 'TODO', ['Headless', 'Experience', 'Commerce']) =]]
36+
37+
#### TODO
38+
39+
#### PHP API
40+
41+
The PHP API has been enhanced with the following new classes:
42+
43+
- TODO
44+
45+
#### Full changelog
46+
[[% include 'snippets/release_46.md' %]]
47+
[[= release_note_entry_end() =]]
48+
49+
50+
1351
[[% set version = 'v4.6.21' %]]
1452

1553
[[= release_note_entry_begin("Discounts " + version, '2025-06-11', ['LTS Update', 'Commerce']) =]]

docs/search/discounts_search_reference/discounts_sort_clauses.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Sort Clauses are found in the [`Ibexa\Contracts\Discounts\Value\Query\SortClause
1515
| [EndDate](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-EndDate.html)| Sort by discount's end date |
1616
| [Id](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-Id.html)| Sort by discount's database ID |
1717
| [Identifier](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-Identifier.html)| Sort by discount identifier |
18+
| [OverridePrioritization](TODO: PHP REF LINK) | Sort by the discount's `overridePrioritization` property. |
1819
| [Priority](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-Priority.html)| Sort by discount priority |
1920
| [StartDate](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-StartDate.html)| Sort by discount start date |
2021
| [Type](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-Query-SortClause-Type.html)| Sort by the place where the discount activates: catalog or cart. When sorting with ascending order, cart discounts are returned first. |

docs/update_and_migration/from_4.6/update_from_4.6.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,28 @@ To use the [latest features](ibexa_dxp_v4.6.md) added to them, update them separ
522522
REFERENCES ezuser (contentobject_id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;
523523
```
524524

525+
## 4.6.22
526+
527+
### Database update
528+
529+
Run the following scripts:
530+
531+
=== "MySQL"
532+
533+
``` sql
534+
ALTER TABLE ibexa_discount ADD override_prioritization tinyint(1) NOT NULL DEFAULT 0;
535+
CREATE INDEX ibexa_discount_prioritization_idx ON ibexa_discount (override_prioritization, type, priority);
536+
ALTER TABLE ibexa_discount_code ADD global_limit INT DEFAULT NULL;
537+
```
538+
539+
=== "PostgreSQL"
540+
541+
``` sql
542+
ALTER TABLE ibexa_discount ADD override_prioritization tinyint(1) NOT NULL DEFAULT 0;
543+
CREATE INDEX ibexa_discount_prioritization_idx ON ibexa_discount (override_prioritization, type, priority);
544+
ALTER TABLE ibexa_discount_code ADD global_limit INT DEFAULT NULL;
545+
```
546+
525547
=== "AI actions"
526548

527549
Run the following command to get the latest version:

0 commit comments

Comments
 (0)