cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Category Best Seller Product

former_member712344
Discoverer
0 Likes
613

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?

View Entire Topic
alemasetto
Participant
0 Likes

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