What is the difference between getOrigData(); and getData();?

here i can give you popular example of this.

$product = Mage::getModel('catalog/product')->load(any product id);
$product->getData('something'); // returns "foo"
$product->setData('something', 'bar');
$product->getData('something');     // returns "bar"
$product->getOrigData('something'); // returns "foo"

every model (once loaded) will make a copy of the originally loaded data and store it in Model_Class::_origData property. This makes it possible to do optimizations for _beforeSave calls so that queries only modify the changed data and not rewrite the same data all the time.

you can also try it your own way.

hope this will sure help you.


getOrigData() object's methods return the unaltered data and it's call by save_before event.

getData() object's methods return the altered data and it's call by save_after event.