Question

Whether this defies the logic of Magento's order processing, I haven't entirely worked out...

A client takes a number of telephone orders and takes their payment via a 3rd party portal or via a handheld PDQ terminal. Subsequently, the orders get raised in Magento with no payment method.

Orders with no payment method, it would appear it is not possible to generate invoices for...?

What would be the recommended approach for implementing the ability to raise invoices for these types of orders. The provided extension from the payment gateway used offers no way to handle these types of orders.

Would there be any scope in attempting to auto-generate the invoice for orders of where there is no payment method selected maybe - would this work?

Or would it be possible to implement a method that allows you to create an invoice manually at any time against an order?

Thanks in advance.

Was it helpful?

Solution

So if i undertsand your question correctly, the order is manually created in magento via the admin interface?

I have not done this myself, so cannot give exact details, but I think you need to do an 'Offline Capture'

see this page : http://www.magentocommerce.com/wiki/welcome_to_the_magento_user_s_guide/chapter_8

From the page given:

Capture Offline - When the Invoice is submitted, the system will not capture the payment. It will be assumed that the payment is going to be captured directly through the gateway, and you will no longer have the option to capture this payment through Magento. You will have the ability to create a Credit Memo, but you will not have the option to Void the Invoice (even though the Order used an online payment, the Invoice is essentially an offline Invoice).

Additonally, this blog post from Inchoo shows how to do it via code:

For completeness (since links disappear of the net (gasp)) here is their code:

(note this is Inchoo's blog entry, no credit to myself)

Maybe you want to create an invoice from some custom script or through cron script. Here is one very useful example of code. First of all, we have to load some order over model “sales/order”, this is very easy.

try {
if(!$order->canInvoice())
{
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
}
$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();
}
catch (Mage_Core_Exception $e) {
}

You will notice that we have set option for capture online. This option depends on payment method. Some payment methods support capture online and some don’t. If you want to set capture offline, you can do that with next line code:

$invoice->setRequestedCaptureCase(
Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE
);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top