Return random result into product list APIs

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Return random result into product list APIs

Post by traiyani75 » 12 Mar 2021, 11:58

Hello,

We are using the APIs in mobile application. Now, we want to show random result on every request on product end point. Either by catalog or by searching . How can we do that part?

Regards

User avatar
aimeos
Administrator
Posts: 7937
Joined: 01 Jan 1970, 00:00

Re: Return random result into product list APIs

Post by aimeos » 14 Mar 2021, 14:49

It's difficult to get real random results fast from a database. This articles describes how it can be achieved:
http://jan.kneschke.de/projects/mysql/order-by-rand/

To implement that in Aimeos, you can add a searchRandom() method to your own product manager and use that in your own product endpoint in the JSON REST API.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply