0

How to print order id & all other order detail. For event observer "sales_order_save_commit_after" ?

Currently using these codes for get all order detail for event observer "checkout_onepage_controller_success_action"

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

singleton Barcatsia_Smsntf_Model_Observer smsntf_cancel_order

public function smsntf_cancel_order($observer){
// how to print order id & all other detail customer detail, sales detail of order.
}

1 Answer 1

1

Try this in Observer.php file

public function smsntf_cancel_order($observer)
{
      $order = $observer->getEvent()->getOrder();
      echo $order->getId();

      $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
      echo "<pre>"; print_r($customer->getData());    
}
2
  • after get once order id . i can get another detail same as using in checkout_onepage_controller_success_action? Commented Feb 3, 2016 at 13:15
  • yes : $order = $observer->getEvent()->getOrder(); echo $order->getId();
    – Abdul
    Commented Feb 3, 2016 at 13:19

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.