Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Getting a set of random data objects

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 441 Views
  • kylehudson00
    Community Member
    22 Posts

    Getting a set of random data objects Link to this post

    EDIT: Forgot to mention I'm using 2.4.x for this particular project, not SS3.

    Hi All,

    I'm wondering if somebody could give me some basic guidance with this. It's a fairly simple situation - I have a database with a bunch of product listings. I would like to be able to get a variable number of random products (say, for example, 3) and display them on the homepage of my site. I've managed to get by so far with the existing documentation, can I can't quite get my head around how to achieve this particular task.

    Down the track I may want the ability to set specific products to appear on the homepage (I imagine this would just be a simple flag), but right now, I'd just like Sapphire/Silverstripe to grab a bunch at random and stick them up. I imagine this request would be repeated every time the page was refreshed.

    Any help - even if it's just pointing me towards the right documentation - would be most appreciated.

    I can post more info about my data model (it's reasonably complex with a number of relations) if necessary.

    Cheers! Kyle

  • martimiz
    Forum Moderator
    1086 Posts

    Re: Getting a set of random data objects Link to this post

    I read a similar post here, that might at least set you on track: http://www.silverstripe.org/general-questions/show/16768

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.