0

I am trying to create a observer which should trigger after sales order complete. Unfortunately,its not firing. my Sales_registration.xml file :

true local Config.xml file enter image description here Observer.phml Observer.phml

3
  • Well you're observing checkout_submit_all_after, shouldn't you observe sales_order_place_after ? – Raphael at Digital Pianism Mar 7 '16 at 10:52
  • Why is there a global tag outside of the config node in the xml? – Smartie Mar 7 '16 at 11:39
  • That I changed ....Still not triggering. – Abdul Aziz Mar 7 '16 at 12:53
2

config.xml file code as below

app/code/local/Sales/Registration/etc/config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Sales_Registration>
      <version>0.1.0</version>
    </Sales_Registration>
  </modules>
  <global>
    <models>
      <salesregistration>
        <class>Sales_Registration_Model</class>
        <resourceModel>salesregistration_mysql4</resourceModel>
      </salesregistration>
    </models>
    <events>
      <sales_order_place_after>
        <observers>
          <checkout_submit_all_after_handler>
            <type>model</type>
            <class>salesregistration/observer</class>
            <method>getAlert</method>
          </checkout_submit_all_after_handler>
        </observers>
      </sales_order_place_after>
    </events>
  </global>
</config>

Observer.php code as below

app/code/local/Sales/Registration/Model/Observer.php

<?php
class Sales_Registration_Model_Observer
{
    public function getAlert(Varien_Event_Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();
        $orderId = $order->getIncrementId();
        $customer_id = $order->getCustomerId();
        $customerData = Mage::getModel('customer/customer')->load($customer_id);
        $customerName = $customerData->getName();
    }
}
25
  • still Not trigerring – Abdul Aziz Mar 7 '16 at 11:21
  • Have you enabled module in app/etc/modules/Sales_Registration.xml ? – Prashant Valanda Mar 7 '16 at 11:36
  • Yes...enable though Sales_Registration.xml – Abdul Aziz Mar 7 '16 at 11:58
  • <config> <modules> <Sales_Registration> <active>true</active> <codePool>local</codePool> </Sales_Registration> </modules> </config> – Abdul Aziz Mar 7 '16 at 11:58
  • How do you check it not triggering? – Prashant Valanda Mar 7 '16 at 12:02

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.