Adding Observers to Magento Events · Thilanga Pitigala

Thilanga Pitigala     Archive     Feed

Adding Observers to Magento Events

  1. To write an Observer you need minimum of 2 files
  2. etc/config.xml (Details about the EVENT_TO_HOOK and the area [frontend adminhtml])
  3. Model/Observer.php (Your php code goes here)

  4. Find the event you want


Remove an action from Mass Action list in admin (Order list page)

    <adminhtml> <!-- Area -->
            <adminhtml_block_html_before> <!-- EVENT_TO_HOOK you want to bind with -->
                    <adminhtml_block_html_before> <!-- Your unique tag name -->
                        <class>Acme_Adminhtml_Model_observer</class>  <!-- Your custom Observer -->
                        <method>removeMassAction</method> <!--Method you want to trigger -->

class Acme_Adminhtml_Model_Observer extends Varien_Object
    public function removeMassAction($event) {

        $block = $event->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction) {

            return $this;
comments powered by Disqus