Skip to content

Commit 302bd07

Browse files
committed
Modify configure_discounts.md
1 parent d812b76 commit 302bd07

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/discounts/configure_discounts.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,31 @@ ibexa:
3030
products_list_per_page_limit: 15
3131
```
3232
33+
## Discount re-indexing
34+
35+
Discounts feature uses [[= product_name_base =]] Messenger to reindex discounts and product prices in the background.
36+
This way changes are processed efficiently without slowing down the system and disrupting the user experience.
37+
38+
When triggered periodically, the `ibexa:discounts:reindex` command identifies discounts that require re-indexing, ensuring catalog prices always remain up-to-date.
39+
If there are edits to discounts that should result in changed product catalog prices, messages are dispatched to an [[= product_name_base =]] Messenger queue and consumed by a background worker.
40+
The worker passes the messages to the handler, which then starts the re-indexing process at the most convenient moment.
41+
42+
To use discount re-indexing in the background:
43+
44+
1\. Make sure that the transport layer is [defined properly](background_tasks.md#configure-package) in Messenger configuration.
45+
46+
2\. Make sure that the worker starts together with the application to watch the transport bus:
47+
48+
``` bash
49+
php bin/console messenger:consume ibexa.messenger.transport --bus=ibexa.messenger.bus
50+
```
51+
52+
3\. Use a scheduler of your choice, to periodically run the following command:
53+
54+
``` bash
55+
php bin/console ibexa:discounts:reindex
56+
```
57+
3358
## Rate limiting
3459

3560
To prevent malicious actors from trying all the possible discount code combinations using brute-force attacks, the [`/discounts_codes/{cartIdentifier}/apply` endpoint](/api/rest_api/rest_api_reference/rest_api_reference.html#discount-codes-apply-discount-to-cart) is rate limited using the [Rate Limiter Symfony component]([[= symfony_doc =]]/rate_limiter.html).

docs/discounts/discounts_guide.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ You can also limit the usage per customer:
113113
- limited use: every customer can use the code a specified number of times
114114
- unlimited
115115

116+
### Discount re-indexing
117+
118+
Discounts affect the prices shown in the product catalog.
119+
When a discount is created, updated, or expires, the product catalog must be re-indexed to ensure that search results and product listings display the correct price.
120+
121+
To prevent performance disruptions which could occur if re-indexing occurred immediately, [[= product_name =]] uses the [Ibexa Messenger](background_tasks.md)'s background queue to process re-indexing tasks in the background.
122+
123+
By [configuring the process](configure_discounts.md#discount-re-indexing), you can decide when is the most convenient time to perform re-indexing and improve your application's overall stability.
124+
116125
## Capabilities
117126

118127
### Management

0 commit comments

Comments
 (0)