on ‎2023 Feb 01 7:31 PM
Hi,
I want to list the best-selling products in the product category in the product crousel on the product detail page, While doing this, I plan to keep the products as a list field on the components with a cronjob. Has anyone done anything like this before?
Request clarification before answering.
Hi Tugce, what about a Flexible Search Query that extracts the best selling products, starting from a certain date?
You can extend the carousel component with its own Controller; the fillModel of the controller method will call a DAO with the below query. You can limit the results (eg. top 10).
Please note that Flexible Search results are cached but, in case you want to implement a job, you can persist the results.
Example:
SELECT DISTINCT {oe:product},{oe:quantity}
FROM {OrderEntry AS oe}
WHERE {oe:order} IN
(
{{
SELECT {o:PK}
FROM {Order AS o}
WHERE {o:date} >= '2023-01-01 23:59:59'
}}
)
ORDER BY {oe:quantity} DESC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.