Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Best Way To Create This Structure

Go to End

3 Posts   916 Views


Community Member, 116 Posts

22 October 2010 at 8:21am

Hi everyone,

I have a new website I am hoping to build on SilverStripe. I have a bit of a problem though, in that I have a bit of a weird structure I need, and am trying to find a "client friendly" solution so they can manage this themself.

The client has a variety of products who they want to display on their website, but they want to be able to display these items in many different categories. Each product can be in one or more category at the same time.

Normally, I'd create my categories as pages, and just add products in as sub pages for the category they're in, if there is a 1-to-1 relationship.

However, now I am trying to find an easy way to allow the client to create a product, and then select multiple categories. My original idea was to just create the same structure I used above, but use a RedirectorPage to "place the product" into different categories. However, that's not ideal for clients.

Does anyone have another idea of how I could achieve this in a client friendly way?


Forum Moderator, 5523 Posts

22 October 2010 at 5:33pm

What you want is a many_many structure. Depends on how you want to do it but you could have a page for each category then a checkboxsetfield to select the categories a page exists in OR use a treemultiselect field would be another way of having a many_many releation.

See this tutorial for a bit of background to the relationships


Forum Moderator, 1899 Posts

22 October 2010 at 9:52pm

I'd also like to suggest that this *maybe* best outside of the sitetree... the pages could be dynamically created from dataobjects and you could use modeladmin to manage the categories and products - this also means you could easily control user access to the category/product data without exposing the rest of the sitetree for them to change. also I'd suggest using multiselectfield to manage the many to many relationship.