$product = Mage::getModel('catalog/product')->load(1); // Set new data $product->setName('New Product Name'); // Get original name $originalName = $product->getOrigData('name'); echo $originalName; // Output: Product Name
$customer = Mage::getModel('customer/customer')->load(1); // Set new data $customer->setFirstname('John'); $customer->setLastname('Doe'); // Get original name $originalName = $customer->getOrigData('firstname') . ' ' . $customer->getOrigData('lastname'); echo $originalName; // Output: Jane SmithIn this example, we load a customer model with an ID of 1 and set its first and last name to new values. We then use getOrigData to retrieve the original first and last name of the customer before any changes were made, and concatenate them to form the original full name. Package library: The Mage_Core_Model_Abstract class is part of the Magento Core module, which is included as part of the Magento library.