Fatal error: Call to a member function getData() on a non-object




public function saveRedemptionInfo(){

    $order_id = $observer->getData('order_ids');
    $order = Mage::getModel('sales/order')->load($order_id);

Same issue happens when I use sales_order_place_after and $order_id = $observer->getEvent()->getOrder()->getId(); . I get error-

Call to a member function getEvent() on a non-object

1 Answer 1


you did a mistake in defining the function in the observer. You did not pass $observer as an argument to the observer function. You can call the function on the event sales_order_place_after like below :

public function saveRedemptionInfo($observer){

    $order = $observer->getEvent()->getOrder();
    echo "<pre>"; print_r($order->getData()); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.