3

I was wondering that what is difference between defining event in frontend/admin and global. I know that we can define events in admin or frontend and also can be define the same events in global.So is there any performance difference between Frontend/admin and global

thank you

  • I guess it would obviously make better/easier for magento to look at when calling an event specifically. – Adarsh Khatri Jun 25 '15 at 6:04
  • @AdarshKhatri Yes, i know that but i was wondering what is performance difference between them. How magento look for specific event as i think it check for event, it need to check whole config. Please correct me if i am wrong – Bhupendra Jadeja Jun 25 '15 at 6:07
5

It depends on what your observer does and if it gets dispatched.
If it's heavy, it will have an impact.
You should define events only in the area that you need it.
For example, if you need something to happen when every page loads on frontend and you put it under the global area then it will impact the admin also, because it will be dispatched for every admin page also. And you might not need that.
But if, for example, you are observing the event page_block_html_topmenu_gethtml_before under the global area it will have no impact on the backend, because that event is not dispatched in the backend.
I choose this example, because in the Mage_Catalog module this exact event is observed under the global area. And this does not impact the frontend.
But because it's in the core, doesn't make it right.
As a general rule you should observe events only in the area you need it, because otherwise it might impact performance.

  • Yes, i know we need observer event where only in the area we need it . But i was wondering something more about whole magento event system :D – Bhupendra Jadeja Jun 25 '15 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.