Magento 1.7 – Difference Between $model->getOrigData() and $model->getData()

magento-1.7model

There are two methods which retrieve model data.

$model->getData();
$model->getOrigData();

Can anyone explain what is the difference between them ? Any help will be appreciated.

Best Answer

getOrigData() returns the data in the object at the time it was initialised/populated.

After the model is initialised you can update that data and getData() will return what you currently have in that object.

Have a look at Varien_Object (getOrigData,setOrigData), grep -R "origData" app/ so you can have a look at what is used.

In EE, it's very useful to log what is changed (Enterprise_Logging) module.