HALP! This is my first attempt at this kind of thing. It seems that the function won't fire when the event happens. (Eventually, what's supposed to happen is that when the event

Mage::dispatchEvent('nextbits_form_save_after',array('form_data'=>$params, 'form_model'=>$formModel));

occurs, the form data will be routed to appropriate people based on the data contained in the form.....)

I haven't written that code yet, but I don't see the observer catching the event and doing anything at all. What is the problem with my event/observer structures?

Observer.php: [\app\code\local\Westcott\EmailRouter\Model\Observer.php]


class Westcott_EmailRouter_Model_Observer {

    public function Notify_by_Mail($observer){

        if (isset($observer['form_data'])) {
            $form_data = $observer['form_data'];
            //$form_model = $observer['form_model'];

            foreach ($form_data as $key =>$fd) {
                //Do something with the form data
                echo "K: ".$key." => ".$fd."<br/>";
            foreach ($form_model as $key =>$fm) {
                //Do something with the form data
                echo "K: ".$key." => ".$fm."<br/>";
        } else {
            //Do something else with the form data...


    echo "Hello!!";

Westcott_EmailRouter.xml: [\app\etc\modules\Westcott_EmailRouter.xml]

<?xml version="1.0"?>

config.xml: [\app\code\local\Westcott\EmailRouter\etc\config.xml]

<?xml version="1.0"?>

First make sure the event your observing exits:

grep -rin -B2 -A2 "Mage::dispatchEvent" app/* > events.txt

View events.txt and search for nextbits_form_save_after

Second, as others mentioned your observer method isn't defined in your Observer.php

<method> should be doNotifyBySubmittedContent instead.

You can also get a list of events with a quick core hack:

You may also want to verify that the eventDispatch you're trying to observer is in fact being called during the stack as well.

* EDIT *

$observer will not have ['form_data'] you'll need to get the Event Request.

$request = $observer->getEvent()->getRequest()->getParams();
if(is_set($request['form_data'])) {

* EDIT #2 *

Just realized I had getParams() as the dispatched Event is magic getter/setter NOT a URI request.

Something like this should work if you're sure the event is being dispatched and form data is present:

$event = $observer->getEvent(); $formData = $event->getFormData(); // magic get/set $formModel = $event->getFormModel(); // magic get/set zend_debug::dump($formData); zend_debug::dump($formModel);

  • 1
    OK... Thanks, Boomer. I assumed the event was in there but it wasn't for some reason. I purchased the extension and was told by the vendor's support staff that it was there....I'll have to take that up with them now, I guess. Also, I know about the observer method. (last minute edit while posting, etc.) Is there another problem with the class declaration? – Greg Nickoloff Apr 9 '14 at 20:48
  • Quick additional note, zend_debug::dump(get_class_methods($observer->getEvent())); Will give you a list of available methods the observed event has. – B00MER Apr 9 '14 at 21:36
  • Thanks, @B00MER, I'm not sure what to do with that. I get "syntax errors near unexpected token `get_class_methods'".... I found a comment you posted elsewhere: "The approach I usually take is, a quick edit/save/revert to app/code/core/Mage/Core/Model/App.php and mage::log($eventName,null,'events.txt',true); to the dispatchEvent method. Load the page I'm trying to observe. Obviously don't leave this as is and revert once your var/logs/events.txt is created. Dirty, yes. Quick, yes. :) – B00MER Apr 15 '13 at 20:39" Do I read this correctly as temporarily adding the mage::log() to App.php? – Greg Nickoloff Apr 10 '14 at 13:19
  • 1
    Not sure unfortunatly, perhaps a good reference may help: inchoo.net/ecommerce/magento/… some other events you may be able to hook into. – B00MER Apr 11 '14 at 23:09
  • 1
    $event = $observer->getEvent(); $formData = $event->getFormData(); // magic get/set $formModel = $event->getFormModel(); // magic get/set zend_debug::dump($formData); zend_debug::dump($formModel); Was what I needed. Thank you, @B00MER – Greg Nickoloff Apr 16 '14 at 14:45

Hello There are issue in events tags... model class declaretion also Notify_by_Mail is not exiting in observer.php


  • I wanted to answer, when I saw this. In other words: You named your model group name as emailrouter, but you declare your observer class alias with westcott_emailrouter/observer. The latter should be emailrouter/observer. – nevvermind Apr 9 '14 at 20:37
  • i cannot understand ,what u asked – Amit Bera Apr 10 '14 at 13:54

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.