I'm trying to assign a product to a number of categories programmatically. I'm using this code to do so :
$arrayofCategories = array($Id1,$Id2); $product->setCategoryIds($arrayofCategories);
Note that i'm using that same $product to set others attributes and they were set properly but when i check the product in backend in its categories section, none of the categories with the ids in the array is checked.
Is this the right syntax ?