It should be simple:
- Pick up the event
MODEL_save_after
(or MODEL_save_before
, if more appropriate). - Check
getData()
and g etOrigData()
to see what changes the user has made.
In the customer_address model edited through the backend, both save events are fired twice. The first time it starts customer_address_save_before
, then customer_address_save_after
.
In both cases, getOrigData()
they are getData()
identical, except that it getData()
has a new updated_at value and has a store_id set (is this an error?). Thus, the model does not yet have data provided from the user. Both events before entering user data or checking, so this is useless.
customer_address_save_before
triggered, then customer_address_save_after
a second time. This time (in both cases) it is getOrigData()
empty, and getData()
now it has all the data sent from the user. So I can not compare these events! It seems that this is after checking, saving, a lot!
Why does the save process happen twice? Magento v1.3.2.4.
source
share