Ao criar uma fatura programaticamente, como posso fazer com que o sistema envie a fatura por e-mail ao cliente?
$order=Mage::getModel('sales/order')->load($orderid);
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
if (!$invoice->getTotalQty()) {
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
}
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($invoice->getOrder());
$transactionSave->save();
magento-1.9
email
invoice
Qaisar Satti
fonte
fonte