I need to stop Magento (version 1.8.1.0) from generating invoices automatically with credit card or paypal payment methods.
I look at registerCaptureNotification() in app/code/Mage/Sales/Model/Order/Payment.php. If I comment out the following code snippet:
if (!$invoice) {
if ($this->_isCaptureFinal($amount)) {
// comment out the following to stop creating invoices automatically
//$invoice = $order->prepareInvoice()->register();
//$order->addRelatedObject($invoice);
//$this->setCreatedInvoice($invoice);
} else {
if (!$skipFraudDetection) {
$this->setIsFraudDetected(true);
}
$this->_updateTotals(array('base_amount_paid_online' => $amount));
}
}
But this doesn't seem to work. Invoices are still being generated using credit card payment.
What is the right way to prevent auto invoice generation?
Best Answer
Karl,goto app/code/core/Mage/Paypal/Model/Ipn.php
copy to
app/code/local/Mage/Paypal/Model/Ipn.php
here magento create invoice on paypal order
find the code:
app/code/core/Mage/Paypal/Model/Ipn.php goto function
here create invoice by below code:
just change it to
here function
$payment->getCreatedInvoice()
createinvoice of an order
or used the extension:
http://www.magentocommerce.com/magento-connect/disable-automatic-generation-of-invoice.html