Closed infosteo closed 1 year ago
Here is the solution: change the last lines of code:
if (Artico.id_category_default != idCatDef)
{
Thread.Sleep(250);
productfactory.Update(Artico);
//read again the product
Artico = productfactory.Get((long)Artico.id);
Artico.id_category_default = idCatDef;
productfactory.Update(Artico);
}
Hello, I'm getting this error: You cannot set a position greater than the total number of products in the category, which starts at 1.
This happens after I deleted some categories in a product and after I changed id_category_default (and updated the product).
my code:
// Artico is my product
Bukimedia.PrestaSharp.Entities.AuxEntities.category[] aDelCats = new Bukimedia.PrestaSharp.Entities.AuxEntities.category[Artico.associations.categories.Count];
Artico.associations.categories.CopyTo(aDelCats);
Any suggestion?
Thank you!