10

This question already has an answer here:

What is the difference between

$model->getOrigData(); 

and

$model->getData();

marked as duplicate by Mufaddal, 7ochem, Pratik bhatt, Amit Bera, liyakat Sep 23 '15 at 11:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

11

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.

7

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.

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