Hi Guys,
What is de best way to import products with product category field values ?
I have a custom source provider, that retrieves the data from an external source. We can model the data as needed for the intergration module.
Kind regards,
Ben
Hi Guys,
What is de best way to import products with product category field values ?
I have a custom source provider, that retrieves the data from an external source. We can model the data as needed for the intergration module.
Kind regards,
Ben
HI Ben,
you can use the Ecom provier as a destination and provide the mappings/source values for the "EcomProductCategoryFieldValue" table:
columns: FieldValueProductId/FieldValueProductNumber should have some value to assiciate it with product
FieldValueFieldId - should be your existing category field id, so it is needed to have the category and its fields being created before importing the values to this table,
FieldValueValue - field value.
As an options you can write the code to create the ProductCategory and populate it with fields directly in your source provider:
public override void LoadSettings(Job job) method
using this code:
var category = Ecommerce.Products.Categories.Category.GetCategoryById(categoryId);
if (category == null)
{
category = Ecommerce.Products.Categories.Category.Create(categoryId);
}
var categoryField = category.Fields.GetFieldById(id);
if (categoryField != null)
{
categoryField.Label = label;
}
else
{
category.AddField(id, label, templateTag, typeId,
string.Empty, FieldListPresentationType.RadioButtonList, new FieldOptionCollection());
}
category.Save();
Regards,
Dmitrij
You must be logged in to post in the forum