0

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.

1 Answer 1

4

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
);
4
  • This is great, thanks for the doc reference. We were looking at that Inchoo post but wasn't sure how relevant it may still be as from 2010 plus I think I was confusing myself with needing to add this ability into our client's payment gateway extension but of course, that wouldn't be the case. Thanks and perfect!
    – zigojacko
    Commented Aug 9, 2013 at 7:51
  • Curious: what is the purpose of the payment gateway module, if the client does the payment directly on the gateway?
    – ProxiBlue
    Commented Aug 9, 2013 at 8:11
  • It provides the credit card form for customers to pay by card on the front end. It just doesn't allow client to use it in back office for manual orders as it throws an error about not receiving all info but they didn't cater for not required 3dsecure if manual order basically.
    – zigojacko
    Commented Aug 9, 2013 at 9:58
  • Hmm, we got stuck with this one actually - please check out our latest question relating to this. Thanks.
    – zigojacko
    Commented Aug 12, 2013 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.