I have a given scenario and I am wondering how this could be structured in the Sitefinity eCommerce module.
I essentially have two product types, a full product and spare part. As expected spare parts relate to full products and some spare parts can relate to different full products.
I have modeled this structure in Sitefinity fine using a Related Data property on the full product with the ability to select multiple spare parts per product.
My issue arises when I create variants of the full product and the main variant attribute is essentially the design print on the full product. I need to be able to associate a spare part to a specific variant, an example being a replacement cover that has the specific design print on so can only ever be associated with a variant of a full product. So in effect I just need a Related Data property against the variant rather than the product itself if that makes sense.
Is this possible out of the box in Sitefinity? If not, can I structure my product / spare parts in manner that I can query spare parts on a variant basis? Or do I need to model this outside of Sitefinity?
PS I am fairly new to Sitefinity development so if there is anything I could have missed please let me know.
Since my previous post I've in some respect managed to model this via the advanced settings for ProductVariationsBackendDefinition.
So now I can select the 'spare part' product type as part of the properties for a product variant,but now whenever I do, I get a script error suggesting a null argument exception.
I've attached the error being given on the product variant property view and the settings I created to configure the RelatedDataField on the view.
Can you suggest why I may be getting the script error?
I guess my problem closely resembles that to which you can add images to specific product variations or 'product attributes' as you describe them. So rather than selecting images how can I select a collection of another product type (in my case spare parts) to relate directly to a product attribute.How would I go about putting in a custom implementation for this functionality?
var metadataManager = MetadataManager.GetManager();
var dynamicType = metadataManager.GetMetaType(
dynamicType = metadataManager.CreateMetaType(
var fields = dynamicType.Fields.Where(f => f.FieldName ==
(fields.Count == 0)
var metaField = metadataManager.CreateMetafield(
metaField.Parent = dynamicType;
Thanks for the code snippet, but I think my problem does require an implementation for Related Data fields, so can you indicate where I may be able to find help in creating the metadata mapping and the changes to the service that persists the values.
I'm not sure if you saw my previous post but I mentioned building the relationship via the backend settings screens and managed to get some form of success but I get a script error when I try to choose using the product selector.