Im creating a module to send the order details to another server's database when a order is placed in my magento server. Im using event to point to the model class but Im not able to get the order details like product name, quantity, price etc which are all needed to write in the other database. How can I make my model to get the values and write it to the database?

This is the config.xml file Im using


and this is the code Im using to get the order details

        $event = $observer->getEvent();
        $order =$invoice->getOrder();   

I need to get the details of the order placed by customer and then push those details to another server's dd

  • please show some code you have so far so we can build on that.
    – Marius
    Commented Nov 25, 2014 at 12:31
  • I have'nt started on model yet. I have created config.xml Commented Nov 25, 2014 at 12:32
  • then how can you say you cannot get the order details if you haven't written any code? You can't get them without coding :)
    – Marius
    Commented Nov 25, 2014 at 12:33
  • haha. not Like that. Im hoping to get a code to retrieve last order info somehting like $event = $observer->getEvent(); $invoice=$event->getInvoice(); $order =$invoice->getOrder(); $orderno=$order->getIncrementId(); can i get the order details like price etc from it? Commented Nov 25, 2014 at 12:35
  • I have edited the qn Marius. Hope it has the necessary details :) Commented Nov 25, 2014 at 12:37

2 Answers 2


If you have the order object you can get the order items like this:

foreach ($order->getAllItems() as $item) { //or $order->getAllVisibleItems()

   $price = $item->getPrice();
   $name = $item->getName();
   $qty = $item->getOrderedQty();

If you have last order id or increment id use the below code to collect last order data

$order = Mage::getModel('sales/order')
                ->loadByIncrementId([increment_id]); //increment id 

$order = Mage::getModel('sales/order')
                ->load([order_id]);     //entity_id

From order data you can get shipping data refer below

//get shipping method
$shippingMethod = $order->getShippingMethod();

For billing address

//get billing address
$shippingAddress = $order->getBillingAddress();

To get last order customer details

//customer name

$customer = Mage::getModel('customer/customer')

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.