Magento – Observer for Contact Form

contact-usevent-observersoap

I need to pass information from the Magento Contact Form to a CRM system. I was wondering does anyone know if there is an observer that can be triggered to pass the form information to the CRM via the SOAP API?

Best Answer

When using an observer for the event controller_action_postdispatch_contacts_index_post you can access the Post-Data via

public function controllerActionPostdispatchContactsIndexPost(Varien_Event_Observer $observer)
{
    $data = $observer->getData();
    $post = $data['controller_action']->getRequest()->getPost();
}

To listen for the event create the those nodes in the config.xml of your Module:

config/global/events/

<controller_action_postdispatch_contacts_index_post>
    <observers>
        <company_modulename_controller_action_postdispatch_contacts_index_post>
            <class>company_modulename/observer</class>
            <method>controllerActionPostdispatchContactsIndexPost</method>
        </company_modulename_controller_action_postdispatch_contacts_index_post>
    </observers>
</controller_action_postdispatch_contacts_index_post>
Related Topic