I am currently trying to load a custom layout handle after the catalog_category_view handle through the use of an observer that looks for the event catalog_controller_category_init_after.

The layout handle works when removing blocks, however ignores any layout update that adds a block to the layout.

Am I using the correct event to load the handle? Is there a better way of loading the custom layout handle?

  • can you post your layout update?
    – Marius
    Commented Feb 19, 2015 at 12:35
  • Hi Marius, Its not so much the update that's the problem but the actual loading of the handle. If I change the layout handle of my custom handle to <catalog_category_view> it works fine. As soon as I change it back to <new_catalog_category_view> it removes the specified blocks contained inside but doesn't add the blocks. Commented Feb 19, 2015 at 12:45

2 Answers 2


This is because catalog_controller_category_init_after is triggered before the layout is loaded. That means, if you add a layout handle in the observer for this event, it is the first one, before catalog_category_view, even before default. So any block you are referencing in your handle does not exist yet.

The <remove> tag works differently, it operates on the fully merged XML tree, that's why you can remove blocks. But instantiating blocks and executing actions happens in order of definition.


Use a different event. A good choice is controller_action_layout_render_before_catalog_category_view which is triggered immediately before the layout is rendered, so you can be sure that it has been fully loaded.


Now in latest magento version (2.4.X) the event is changed as $this->eventManager->dispatch('layout_render_before_' . $this->request->getFullActionName());

So for above case the new event will be layout_render_before_catalog_category_view


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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