Lors de la création d'une facture par programme, comment puis-je demander au système d'envoyer la facture par e-mail au client?
$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
la source
la source