Create Invoice In Magento

Create invoice for an order

Suppose order id is 1. Then,

$order = Mage::getModel('sales/order')->load($order_id);
$order->getPayment()->setSkipTransactionCreation(false);
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
Mage::getModel('core/resource_transaction')
      ->addObject($invoice)
      ->addObject($order)
      ->save();

 

And invoice for that particular order will be created successfully.

Happy coding 🙂

. . .

Comment

Add Your Comment

Be the first to comment.

css.php