Difference between catalog_product_save_after and catalog_product_save_commit_after?
Saving happens in a MySQL transaction and the save_after
event is triggered before the transaction is committed, so that you can do additional updates in the database within the same transaction.
The save_commit_after
event is triggered after the transaction has been committed, i.e. when the changes were written to the database.
Also, on save_commit_after
, the _hasDataChanges
property already has been reset to false
, so your check would not work. On the other hand, if there were no changes, both events would not even be triggered, because Mage_Core_Model_Abstract::save() does nothing if there were no data changes:
if (!$this->_hasModelChanged()) {
return $this;
}
That being said, I don't see why your code should not work.