I'm using this to update the attributes of a product:


However, I want to set the category IDs as well. But $product->setCategoryIds() is a function not an attribute. Now, it will defeat the purpose of fast product saving if I load the product model just to set the category IDs. Any way I could set the category IDs without loading the product?


You can. Just call the product model, assign ID of a product you want to edit, set categories or any other attributes, and save it:

$product = Mage::getModel('catalog/product');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.