Magento Certified Developer GuideCategory: 3.2 BlocksIn which ways can block output be disabled in Magento?
Manish Prakash Staff asked 5 years ago

1. We can disable block out from “admin -> system -> configuration -> advanced -> disable module output” , but this will disable entire modules output

2. but listen to event ‘core_block_abstract_to_html_after’ and then set empty html

class Mage_Test_Model_Observer{
public function core_block_abstract_to_html_after($event){
   $block = $event->getBlock();
   $transport = $event->getTransport();
   if($block->getName() === 'our.test.block'){

above is the observer defined for core_block_abstract_to_html_after in config.xml

3. we can define our own “_afterToHtml()” in the block file and return empty html from there
4. set an empty template file using setTempate() function