good example of how to use taxonomy in a custom part?

Apr 29, 2013 at 7:28 PM
Edited Apr 29, 2013 at 7:29 PM
Hi all,
It's a little sad that this great thing does not have any documentation on how to implement it on a custom part through code :) could someone please provide me with a good link to do so?

This is what I have found so far:

ContentDefinitionManager.AlterPartDefinition("ProductPart", builder =>
            builder.WithField("Materials", fld => fld.OfType("TaxonomyField")
                .WithSetting("DisplayName", "Materials")
                .WithSetting("TaxonomyFieldSettings.Taxonomy", "Materials")
                .WithSetting("TaxonomyFieldSettings.LeavesOnly", "False")
                .WithSetting("TaxonomyFieldSettings.SingleChoice", "False")
        ));
  1. How do I make sure the taxonomy "Materials" exists?
  2. should I define a property in my Product Part?
  3. When I should have to define a property in my product part, what type does it need since it's multiple choice? (and what would it be when having single choice?)
  4. Should I define a property in my Record? and what type?
Coordinator
Apr 29, 2013 at 7:32 PM
You should ask your questions on the main orchard forum now, as we have merged the module into core, I am sure people already have the answer to that.
As a side note, if you want to collaborate and provide extensions methods to make things easier I would support you.
Apr 29, 2013 at 7:35 PM
thanks, I'll try my luck on the other forum. I'm not ready for extension methods just yet :) I'll be happy to just be able to use it as is for now, I'm still introducing myself into the big world of orchard