Engine23
blogBannerImage
By Engine23

Magento - How many events are fired during a normal page load

I have been doing a bunch of work lately using the event observers system.  This powerful feature of Magento community and Magento Enterprise allows for so much flexibility.  I did find myself kind of stuck trying to find the right event to observe.  My issue was I need to find an event that was after the customer was initialized, but before the Header.php and Header.phtml were brought in.  I needed to change the status of some text based on the customers logged in/out status.

Fastforward to me using the wrong event.  I found, what I thought was the perfect event, customer_session_init.  So, after patting myself on the back for being so smart, I wrote all my logic, and did a happy dance that it was so easy.  Well, after running the code, it turns out that because I was checking if the customer was logged in or not, and if not, AND I had some Header information, I was logging them in...well, sadly that "re-initiallized" the customer session!!!! So, I got the dreaded 

Front controller reached 100 router match iterations

Well, I instantly figured out that I had found a great place to start my check but it was too early in the execution.  I needed a better place, something later in the request flow.  Just to prove things worked  I chose the last "non-generic" event that was fired: controller_front_send_response_after

Sadly, that was way too late!  The Head.php and Header.phtml were already loaded up and long gone with data. I could not manipulate things the way I needed to.

So, I decided to log every single event on a regular page load, for example a CMS page.  I wanted to know what my options are.  Google was helpful, but honestly, using Magento code is so much more helpful ( caveat - you just need to know where to look! ).

After logging all the events on a CMS page load, I was shocked.  In my Magento Enterprise Edition version 1.14 there are 561 events that are fired during a page load!

Digging into the events, I can see them in what order they are fired....I noticed way up at the top ( excluding the "generic" ones that are fired all the time throughout the code, customer_session_init...I knew that was too early on and would lead to disaster.  Then just a bit lower, I noticed cms_page_load_before.  That sounded reasonable.  

Well, after some testing and debugging, that ended up being the exact event that I needed.  It was early enough in the execution to give me time to change things I needed to, but after the customer was initialized, because if I cant see if the customer was logged in my logic would never work the way I needed it to.

So, i present to you the events, in order of a Magento Enterprise 1.14 CMS page load

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

core_collection_abstract_load_before

core_collection_abstract_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

controller_front_init_before

controller_front_init_routers

resource_get_tablename

model_load_after

enterprise_url_rewrite_load_after

resource_get_tablename

core_locale_set_locale

resource_get_tablename

controller_action_predispatch

customer_session_init

resource_get_tablename

websiterestriction_frontend

controller_action_predispatch_cms

controller_action_predispatch_cms_index_index

model_load_before

cms_page_load_before

resource_get_tablename

resource_get_tablename

model_load_after

cms_page_load_after

cms_page_render

controller_action_layout_load_before

core_layout_update_updates_get_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

controller_action_layout_generate_xml_before

controller_action_layout_generate_blocks_before

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_session_abstract_clear_messages

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_session_abstract_clear_messages

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

controller_action_layout_generate_blocks_after

core_session_abstract_clear_messages

core_session_abstract_clear_messages

core_session_abstract_clear_messages

controller_action_layout_render_before

controller_action_layout_render_before_cms_index_index

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

wishlist_items_renewed

resource_get_tablename

model_load_after

core_abstract_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

core_collection_abstract_load_before

core_collection_abstract_load_after

enterprise_customersegment_ids_changed

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

model_load_before

catalog_category_load_before

model_load_after

core_abstract_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_category_load_after

resource_get_tablename

core_collection_abstract_load_before

core_collection_abstract_load_after

model_load_after

core_abstract_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

catalog_product_collection_apply_limitations_before

resource_get_tablename

catalog_product_collection_apply_limitations_after

eav_collection_abstract_load_before

catalog_product_collection_load_before

catalog_product_collection_load_after

resource_get_tablename

catalog_product_collection_apply_limitations_before

resource_get_tablename

catalog_product_collection_apply_limitations_after

resource_get_tablename

resource_get_tablename

catalog_category_collection_add_is_active_filter

model_load_before

catalog_product_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_product_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

core_collection_abstract_load_before

core_collection_abstract_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_before

core_abstract_load_before

resource_get_tablename

model_load_after

core_abstract_load_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

model_load_before

catalog_category_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_category_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

model_load_before

catalog_category_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_category_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

resource_get_tablename

resource_get_tablename

catalog_product_collection_apply_limitations_before

resource_get_tablename

catalog_product_collection_apply_limitations_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

catalog_product_collection_apply_limitations_before

resource_get_tablename

catalog_product_collection_apply_limitations_after

catalog_product_collection_apply_limitations_before

catalog_product_collection_apply_limitations_after

catalog_product_collection_apply_limitations_before

catalog_product_collection_apply_limitations_after

catalog_block_product_list_collection

eav_collection_abstract_load_before

catalog_product_collection_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

catalog_product_collection_load_after

catalog_product_collection_apply_limitations_before

catalog_product_collection_apply_limitations_after

resource_get_tablename

catalog_helper_output_construct

core_collection_abstract_load_before

core_collection_abstract_load_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_to_html_before

resource_get_tablename

currency_display_options_forming

core_block_abstract_to_html_after

core_collection_abstract_load_before

core_collection_abstract_load_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

model_load_before

catalog_category_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_category_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

model_load_before

catalog_category_load_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_load_after

catalog_category_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

core_block_abstract_prepare_layout_before

core_block_abstract_prepare_layout_after

core_layout_block_create_after

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_after

core_block_abstract_to_html_before

core_block_abstract_to_html_after

controller_action_postdispatch_cms_index_index

controller_action_postdispatch_cms

controller_action_postdispatch

model_save_before

core_abstract_save_before

resource_get_tablename

resource_get_tablename

resource_get_tablename

model_save_after

core_abstract_save_after

model_save_commit_after

core_abstract_save_commit_after

controller_front_send_response_before

http_response_send_before

controller_front_send_response_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

core_collection_abstract_load_before

core_collection_abstract_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

core_collection_abstract_load_before

core_collection_abstract_load_after

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename

resource_get_tablename