by Kevin Schroeder | 3:42 pm

controller_front_init_before

Technically, it’s resource_get_tablename, but the first usable event is controller_front_init_before.

But this is also a bit of a trick question. controller_front_init_before is ONLY triggered from the global area. The first usable event in the frontend (or adminhtml) area is controller_action_predispatch. core_locale_set_locale might also be a possibility because it is set when the area is loaded, but I would say that controller_action_predispatch is still the best, first usable event once the area is known.

But it gets even more interesting.

The first usable event in the API is actually controller_front_init_before. In api.php both the global and the adminhtml areas are loaded before execution whereas in the regular requests it is not. So if you want to execute an observer only in the API you can have it listen on the adminhtml area on the controller_front_init_before event.

Comments

Store-Frontend: What is the first event that can be observed? - MagentoHub

[…] What is the first event fired in Magento? – (Apr 2014; by E. Schrade) […]

Mar 17.2016 | 09:36 am

Francis Kim

What about Magento 2? 🙂

Jun 14.2016 | 11:50 pm

    Kevin Schroeder

    I believe the event is “going to get a coffee because it’s taking so long for the page to load”.

    Jun 15.2016 | 07:19 am

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.