2 Support questions or comments
Please login or create an account to post a question or comment.
-
Feb 21, 2017Buro26 PurchasedI had to edit the createInvoice method, because it wasn't working. Code =
protected function createInvoice($orderId)
{
$order = Mage::getModel('sales/order'->load($orderId);
if (!$order->canInvoice())
return;
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice(array());
$invoice->register();
$invoice->getOrder()->setIsInProcess(true);
$transactionSave = Mage::getModel('core/resource_transaction'
->addObject($invoice)
->addObject($invoice->getOrder())
->save();
$invoice
->setEmailSent(true)
->sendEmail(true)
->save();
$invoice->getOrder()
->setStatus('factuur_verzonden'
->addStatusHistoryComment('Gefactureerd via BATCH verwerking', true)
->save();
Mage::getModel('sales/order_api'->addComment($order->getIncrementId(), 'factuur_verzonden', '', false);
}