Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 665313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:41:40+00:00 2026-05-13T23:41:40+00:00

It should be simple: Hook a MODEL_save_after event (or MODEL_save_before if that’s more appropriate).

  • 0

It should be simple:

  • Hook a MODEL_save_after event (or MODEL_save_before if that’s more appropriate).
  • Check getData() vs getOrigData() to see what changes the user has made.

In the customer_address model, edited through the backend, both save events are triggered twice. The first time customer_address_save_before is triggered, followed by customer_address_save_after.

In both cases getOrigData() and getData() are identical, except getData() has a new updated_at value, and has a store_id set (is this a bug?). So, the model doesn’t have the submitted data from the user yet. The events are both before entering user data or validation, so this is of no use.

customer_address_save_before is triggered, followed by customer_address_save_after a second time. This time (in both cases), getOrigData() is empty, and getData() now has all the submitted data from the user. So I can’t compare these events either! It appears this is after validation, saving, the lot!

Why the save process appears to occur twice? Magento v1.3.2.4.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:41:40+00:00Added an answer on May 13, 2026 at 11:41 pm

    I wound up hooking customer_address_save_before, and comparing the results to what was in the database like so:

    <?php
    customer_address_save_before_listener ($event)
    {
      $address = $event->getCustomerAddress();
    
      $database_address = Mage::getModel('customer/address')->load($address->getId());
    }
    ?>
    

    And comparing the getData() returns from the two. There were three gotcha’s that I came across:

    • Use getEntityTypeId() on $address and check it. Despite hooking ‘customer_address_save_before’, you also get OrderAddress models being sent to your listener (this seems wrong to me, but ah well).
    • Check for arrays in $address->getData() values. For example, ‘street’ is returned from the DB as a single string, while the address your listener is passed has this exploded on endlines.
    • The CustomerAddress your listener is passed has a ‘store_id’. Even though CustomerAddress doesn’t store ‘store_id’, and it doesn’t get saved (or loaded from) the database.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Should simple JavaBeans that have only simple getters and setters be unit tested?? What
Really simple question: Am I missing something? Seems like this should be all that
It should be simple, but it's not. I have a library that is hoping
Should be simple and quick: I want a C# equivalent to the following Java
should be simple right? but have not found any anwsers :
Should be simple but I couldn't find the answer, I would like to place
This should be simple enough, and I blame this primarily on my inexperience working
This should be simple, but the answer is eluding me. If I've got a
This should seem simple enough, but can't figure it out. I was porting a
My scenario should be simple... the type I want to convert FROM is ALWAYS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.