hello,
I know it's wrong to use object manager directly but in this case I'm forced. I'm successfully adding new categories with this code:
$collection = $objectManager->create('Magento\Catalog\Model\Category');
$category->setName($name)
->setIsActive($status)
->setUrlKey($slug)
->setParentId($parent_id))
->setPath($collection->load($parent_id)->getPath())
->setStoreId($storeId)
->save();
but when I try to update some data, I don't receive any error but it's not saving:
$collection = $objectManager->create('Magento\Catalog\Model\Category');
$category = $collection->load($id, $storeId);
$category->setName($name)
->setIsActive($status)
->setParentId($collection->load($parent_id)->getPath())
->setPath($rootCat->getPath())
->setStoreId($storeId);
try {
$category->save();
}
catch (Exception $e) {
echo $e->getMessage();
}
any help?
thanks