Ideas for showing collection items in random order?

[Interestingly, there doesn't seem to be a good category for this post... does this mean I should ask this on stackoverflow?]

I was looking at how to have a collection display items in random order, but the batching feature complicates things: we would have to establish a random order of all items, then show batches of that. Would the random ordering of all items have to be done per user, per visit? Would that random ordering be different from that seen by other users? What happens on reload? Would we store a random ordering as a cookie? How would this work with cacheing.

If it's not per user or per visit, how often should the random order be regenerated on the server?

As random generator could be made deterministic with a seed, maybe it would be possible to add the seed into batch query string parameters? (Although, that would probably need touching also the batching package[s].)

1 Like

Hi @tkimnguyen,

Have you found a solution to this? I have the same use case. I need a collection to show 1 item of a category, randomly, changing after every refresh.

Thanks,

Rafael

I haven't looked further at how to implement this in collections, but in the past I've written JavaScript that chose random items for display (e.g. choosing from one of many possible main images on landing pages).

this is how we implemented such feature in the collection tile of collective.cover:

1 Like

I filed this feature request... https://github.com/plone/Products.CMFPlone/issues/2056

Let's see if it gets shot down :slight_smile: