Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Limiting and/or randomizing related content

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

Page: 1
Go to End
Author Topic: 930 Views
  • pingu
    Avatar
    Community Member
    75 Posts

    Limiting and/or randomizing related content Link to this post

    Hi,

    Is there a way to limit and randomize related content?

    I have a site where products can have up to 4 related products. These are selected via a complextablefield.
    Currently, all selected related products are display. I'd like to know how I can:

    1. Limit these to show only 4
    2. If possible, show 4 random ones from all which have been selected.

  • PGiessler
    Avatar
    Community Member
    47 Posts

    Re: Limiting and/or randomizing related content Link to this post

    Hello,

    I think there is a way to limit and randomize related content. You have to edit your SQL-Request ( DataObject::get), because you can write an optional parameter (limit). Furthermore you can create an easy random function in mysite/code , which the DataObject will randomize.

    If you don't know what I suppose, you can show me your source code. So I can look at this!

    Best regards,

    Pascal

    930 Views
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.