tags:

views:

31

answers:

1

Hi, i need get a old email and compare with a new email using customer_save_before event

Test to listen customer_save_before event, getData('email') return a new email and getOrigData('email') not work

Test me too with customer_save_after and not work, getOrigData('email ') return 1 and getData('email') return a new email.

is there any way to tell which is the email that was changed?

use: magento-1.4.0.1

Thanks

A: 

In the customer_save_before, the old data should still be present in the DB, so you could try getting the customer from the model based on id:

$old_email = Mage::getModel('customer/customer')->load($customer->getId())->getEmail();

The above line of code assumes that you $customer is the customer object you get from the event.

If my reasoning is correct the retrieved customer data should contain the old email address.

silvo
Oh, Thanks really work!!Thanks again!
Zarpele
Happy I could help. If you found this answer helpful, please accept it or upvote it.
silvo