I’m currently working on an product integration and I’m having trouble with the category links on the base product. When integration is run everything seemes to be working good, I can see the references to the categorys under “plan” on the baseproducts. However, if i choose to add another category through back office or if I change the main category, all categorys imported by the integration is removed (The actual categorys do still exist though but without referencing the baseproduct as an reference). There arent any errors in the Litium log or the event log.
Im adding the category with productlinks like this :
var newCategory = new Category(productFieldTemplate.SystemId (Guid)market.AssortmentSystemId)
{
Id = mainCategory,
};
foreach (var language in _languageService.GetAll())
{
newCategory.Localizations[language.CultureInfo].Name = mainCategory;
newCategory.Fields.AddOrUpdateValue("_url", language.CultureInfo, _slugifyService.Slugify(CultureInfo.GetCultureInfo(language.Id), mainCategory));
}
newCategory.ProductLinks.Add(new CategoryToProductLink(baseProduct.SystemId)
{
MainCategory = true,
BaseProductSystemId = baseProduct.SystemId
});
_categoryService.Create(newCategory);
Has anyone experienced this before or have any idea what could go wrong?
Litium version: 7.4.0