I am trying to create a handler for the Order place event using which I need to send the order data to some other table. I have created a module with config.xml and observer.php file. The handler function is called when order is placed, but the $observer objects does not return any order data.
My Sm/Sx/etc/config.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Sm_Sx>
<version>0.1.0</version>
</Sm_Sx>
</modules>
<global>
<helpers>
<Sx>
<class>Sm_Sx_Helper</class>
</Sx>
</helpers>
<events>
<sales_order_place_after>
<observers>
<Sm_Sx_Model_Observer>
<class>Sm_Sx_Model_Observer</class>
<method>create_sx_order</method>
</Sm_Sx_Model_Observer>
</observers>
</sales_order_place_after>
</events>
</global>
</config>
My Sm/Sx/Model/Observer.php is:
class Sm_Sx_Model_Observer
{
public function __construct()
{
//Just constrcutor for fun :-)
}
public function create_sx_order(Varien_Event_Observer $observer)
{
$data = $observer->getData('Order');
echo "<pre>";
print_r($data);
echo "</pre>";
exit;
return $this;
}
}
I have tried using:
$data = $observer->getOrder();
And
$data = $observer->getEvent()->getOrder();
But nothing works. Any help would be greatly appreciated.
Mage::log('orderData'); Mage::log($data->debug());
you will see output in log.. if you are using exit then you will see the output in console.$data = $observer->getData('order');
$data = $observer->getOrder();