Products and more...

Posted by Community Admin on 05-Aug-2018 12:39

Products and more...

All Replies

Posted by Community Admin on 18-Feb-2011 00:00

Hi,

I need some more functionality in my system then only a 'Product'.
How can I add a product that has;

1. a 'Product group' assigned to it
2. a relation with one or more 'Nutritional values' (many-to-many)
3. a relation with one or more 'Categories' (many-to-many) / no built-in taxonomies

Is this possible to build in Sitefinity? Including translations into different languages and maintenance in the backend?

Thanks,
Daniel

Posted by Community Admin on 19-Feb-2011 00:00

Hi Daniel,

For a project i'm currently developing, i have to manage 1 to many relationships and many-to-many relationships.

To do this, you must manage all your content in custom modules (like product catalog sample).

So in your case, you will create a custom module to manage Nutritional values (or do you want to use taxonomies?).
In the model of your product module, you will add a code like this:

private TrackedList<Guid> nutrionalValues;
  
[FieldAlias("nutrionalValues")]
[DataMember]
[ReadOnly(true)]
public TrackedList<Guid> NutrionalValues
      get
       
            if (this.nutrionalValues== null)
                this.nutrionalValues= new TrackedList<Guid>();
            return this.nutrionalValues;
      
      set
       
            var nv = this.NutrionalValues;
            nv.Clear();
            foreach (var id in value)
            
                 nv.Add(id);
            
        

In your manager, in the copy method, you must add this line:
destination.NutrionalValues = source.NutritionalValues;

It is the same for your Categories.

If you use taxonomies for 'Nutrional values', you can create the taxonomy in the installation method of your module. If you want to use taxonomies, i can explain how to do this.

So you can build this in sitefinity. You can support translations into different languages, workflows...

You should use a module based on product catalog sample.

Hope this helps.

Jocelyn

Posted by Community Admin on 21-Feb-2011 00:00

Hi Jocelyn,

Thanks for the explanation.
So how do you know when your dealing with a 1-n or a n-n relation? Is this something you can set?

I'll think I'll start with a Product module and a ProductGroup module...

Is it possible to have a menu item like 'Content' but then 'Products' and beneath this 'Products', 'Product groups' etc.?

Regards,
Daniel

Posted by Community Admin on 02-Mar-2013 00:00

Daniel,

I'm wondering if you was able to setup many-to-many relation between products and categories custom modules. I Think it should be implemented similarly to what ModuleBuilder does for "array of Guids" fields.

Denis.

This thread is closed