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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Dynamic fields for Pages based on categories


Go to End


2 Posts   1721 Views

Avatar
BP

Community Member, 25 Posts

22 July 2012 at 12:38am

Hi All,

I've got a task to implement, which I'm stuck with so maybe someone could suggest which approach should I use. The main idea is:

We've got a catalog of ITEMS (for now this is one Page class Item.php ) where each Item belongs to a Category (Thus we've got category list, with ITEM pages in each category)

I need to code a solution for adding additional custom fields (with different datatypes) which would be entered for each category, and would be filled for each Item in that category . To make it clear:

In the CMS :
Client comes to "Phones" Category
Adds fields and their types :
1. Weight - [Numeric]
2. Short Code - [Varchar]
3. Description for bulk retailers - [HTMLText]

Now Client saves this Category, and all the ITEMS in that category would get those fields availiable in DataObjectManager (or somehow in other way) for filling with proper form elemens. Thus for each Phone client would be able to add Weight, ShortCode and Description.

So for each category he has to have a chance of entering custom fields, which would populate to ITEMS under this Category. Thus this is somehting like doing flexible/custom $db variables for ITEMS underneath category.

Anyone could suggest which logic/modules should I use or at least take a look at for implementing this ? I assume UserForms has something like that, as you can create fields dynamically, but they are not populating over the children pages, so any ideas/help would be appreciated.

Thank you.

Avatar
BP

Community Member, 25 Posts

6 August 2012 at 4:35pm

Bump, any suggestions ?