I need to create all suborder invoice of an order in magento. i used this code but my amount is coming 0 .
$order = Mage::getModel('sales/order')->loadByIncrementId(100000067); $items = $order->getItemsCollection(); $items = array(); //this will be used for processing the invoice foreach ($order->getAllItems() as $item) { $items[$item->getId()] = $item->getQtyOrdered(); } $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice($items); // The rest is only required when handling a partial invoice as in this example $amount = $invoice->getGrandTotal(); echo $amount; $invoice->register()->pay(); $invoice->getOrder()->setIsInProcess(true); $history = $invoice->getOrder()->addStatusHistoryComment( 'Partial amount of $' . $amount . ' captured automatically.', false ); $history->setIsCustomerNotified(true); $order->save(); Mage::getModel('core/resource_transaction') ->addObject($invoice) ->addObject($invoice->getOrder()) ->save(); How to create all suborder invoice of an order.... like if my order id 110101 and if contain 5 sku (101,102,103,104,105) for this i want to create suborder invoice of order in magento......
