Save product in observer in magento 1
We cannot use save() to save product in observer in magento 1 if we are using event catalog_product_save_after because that will lead to an infinite loop.
So instead of using save(), we can save product data by using these lines of code-
$product = Mage::getModel('catalog/product')->load(1); $price = 10; $product->setData('price', $price); $product->getResource()->saveAttribute($product, 'price');
In this manner we can save other attributes of a product as well, i.e, in place of price we can use sku, description etc.
Also, by saving a product in this manner will not trigger any events as well. That is why we can use it in event catalog_product_save_after
Happy coding 🙂