Hi,
In this post an overview on how to create productfamilies with the DynamicWeb provider (in DW10). The only thing you need in the source data is a common_key. In my specific case the Master was also a family member, so the source data included a field: 'IsParent: yes/no'.
It's important to note when implementing this, you have to modify your conditionals accordingly. I've structured my profiles in. single/family member creation, master creation and family(relation)handling.
All credits to Lars Hejgaard.
--------------------------------
Product families use the same data structure as Variants. You said that there is a common property in NAV that binds the items together, and I'll use Common_Key to refer to that. The Actual Item No. from NAV I'll refer to as Item_No.
Let's start with the master. One record should be imported as the master product, i.e. with empty ProductVariantId. The ProductId must be the Common_Key. I would create a table mapping to for this that uses ProductId and ProductLanguageId as keys and mark it with "Skip duplicates". Remember to set a value for ProductLanguageId. Also map ProductDefaultVariantComboId with the common_key
For each master, a record should be added to EcomVariantGroups with the Common_Key property as VariantGroupId. The property VariantGroupFamily must be set to 1 so it is recorded as a family. These are not displayed in variant groups in Admin. Remember to set VariantGroupLanguageId.
Finally, for the masters, a record should be imported to EcomVariantGroupProductRelation, where the Common_Key should be used for both VariantGroupProductRelationVariantGroupId and VariantGroupProductRelationProductId. Map VariantGroupProductRelationId with the common_key.
For the actual family products, each item should be imported to EcomProducts with the Common_Key mapped to ProductId and Item_No from NAV as ProductNumber. The Item_No should also be mapped to ProductVariantId. Remember to set ProductLanguageId.
To create the variant options, we import each family product to EcomVariantsOptions with Common_Key mapped to VariantOptionGroupId and Item_No mapped to VariantOptionId and VariantOptionName. Remember to set VariantOptionLanguageId.
We need to add the relationship between product and variant option, and we do that by creating a record in VariantOptionsProductRelationProductId with Common_Key mapped to VariantOptionsProductRelationProductId and Item No. mapped VariantOptionsProductRelationVariantId
Let's start with the master. One record should be imported as the master product, i.e. with empty ProductVariantId. The ProductId must be the Common_Key. I would create a table mapping to for this that uses ProductId and ProductLanguageId as keys and mark it with "Skip duplicates". Remember to set a value for ProductLanguageId. Also map ProductDefaultVariantComboId with the common_key
For each master, a record should be added to EcomVariantGroups with the Common_Key property as VariantGroupId. The property VariantGroupFamily must be set to 1 so it is recorded as a family. These are not displayed in variant groups in Admin. Remember to set VariantGroupLanguageId.
Finally, for the masters, a record should be imported to EcomVariantGroupProductRelation, where the Common_Key should be used for both VariantGroupProductRelationVariantGroupId and VariantGroupProductRelationProductId. Map VariantGroupProductRelationId with the common_key.
For the actual family products, each item should be imported to EcomProducts with the Common_Key mapped to ProductId and Item_No from NAV as ProductNumber. The Item_No should also be mapped to ProductVariantId. Remember to set ProductLanguageId.
To create the variant options, we import each family product to EcomVariantsOptions with Common_Key mapped to VariantOptionGroupId and Item_No mapped to VariantOptionId and VariantOptionName. Remember to set VariantOptionLanguageId.
We need to add the relationship between product and variant option, and we do that by creating a record in VariantOptionsProductRelationProductId with Common_Key mapped to VariantOptionsProductRelationProductId and Item No. mapped VariantOptionsProductRelationVariantId
To verify the data, you may use the following SQL examples and replace the product id and variant group id with your own values:
select ProductId, ProductVariantId, ProductNumber from ecomproducts where Productid = '10023' and ProductLanguageId = 'LANG1'
select * from EcomVariantGroups where VariantGroupId = 'VARGRP7'
select * from EcomVariantGroupProductRelation where VariantGroupProductRelationProductId = '10023'
select * from EcomVariantsOptions WHERE VariantOptionGroupId = 'VARGRP7' and VariantOptionLanguageId = 'LANG1'
select * from EcomVariantOptionsProductRelation where VariantOptionsProductRelationProductId = '10023'
select * from EcomVariantGroups where VariantGroupId = 'VARGRP7'
select * from EcomVariantGroupProductRelation where VariantGroupProductRelationProductId = '10023'
select * from EcomVariantsOptions WHERE VariantOptionGroupId = 'VARGRP7' and VariantOptionLanguageId = 'LANG1'
select * from EcomVariantOptionsProductRelation where VariantOptionsProductRelationProductId = '10023'