Search code examples
magentomagento-1.4magento-1.5

Magento Events. Catch static block rendering or specified block rendering


I have a module which adds little piiece of code to specified static blocks - meaning that there are 2 filters:

  1. static blocks only
  2. only some of them, which are specified.

Currently I have an observer, which catches abstract_html_after event and checkes whether this is a static block at all and whether this block is in specified block list. If so then it adds this little html addon to the block.

The problem is: this algorythm slows down system horrifically.

What might be the solutions?


Solution

  • Currently there is no CMS block specific event you can use that narrows down your event scope.
    You can't even use the cms_block_load_after event on the cms/block model to do that, because in Mage_Cms_Model_Block no $_eventPrefix is set, so you are stuck with core_abstract_load_after.

    The only solution is to rewrite the cms/block block or model class and either dispatch a custom event there, or just add your content directly in the rewritten class.