I'm working on a product showcase application managed using Model Admin in SilverStripe (which I this is a seriously great module!)
There's a set structure for how the items are categorised, which is very simple to set up with regards to their DataObjects.
Essentially there are 2 category levels - Top Category and Subcategory. Each product belongs to one or more Subcategory and each Subcategory belongs to one Top Category. There must not be any further levels of categories.
I am trying to figure out the best way of managing this system in the CMS. When I say the best way, I mean the cleanest and simplest way for my client.
I've played with different methods of managing categories. I've used ManyManyComplexTableFields which seems great for single level categories, but not for multi-level categories (or so it seems to me). Also there's this solution posted here http://silverstripe.org/general-questions/show/265149#post265149 - for unlimited levels of nested categories using self join, which isn't exactly what I'm after due to the strict 2-layer categories I need.
I was thinking one method would be to manage the Top Categories separately in ModelAdmin. Then, when assigning products to Subcategories, somehow dynamically create a ComplexTableField for each Top Category, showing the Subcategories and enabling the user to add more Subcategories and tick them. I hope I've explained this well enough!
So, do you guys think this is a good way of doing it? And, most importantly, is it possible? I haven't tried it, but is it possible to create dynamic fields in getCMSFields() using DataObject::get() to retrieve a list of all the Top Categories, create ManyManyComplexTableFields for each one, then assign all checked SubCategories to the product being editied??
Phew! Thanks for your help in advance!