2

I was testing various scenarios creating invoices and capturing them. I am using EE 1.13.1.0, and I noticed a strange behavior where if I do the following, the subtotal is doubled from the original ordered item list. [Update: I now know why this is happening. Please see the end of the post.]

  1. Submit an order through authorize.net in test mode with authorize-only mode.
  2. Create an invoice using the API and nothing more.

    i.e. $invoice = Mage::getModel('sales/order_invoice_api')->create($orderIncrementId, array());

  3. Ship all of the order items.

  4. Go to the admin, and cancel the pending invoice.
  5. Create another invoice
  6. Check out the subtotal. My instance always doubles the subtotal, tax, etc, and it cannot be modified in the second time creating the invoice.

UPDATE 1:

This is happening because when the API method is called to create the invoice and the process ends there, the sales_flat_order table's *_invoiced entries are not updated. When a non-capturing invoice is created, sales_flat_order's *_invoiced are updated.

Subsequently, when canceling this pending invoice, sales_flat_order is updated (subtracted) to reset values in *_invoiced. This is causing the negative dollar amounts in this table and causing problems when I try to re-invoice the order. I'm gonna try a couple more things and post an update here.

Update 2:

I've resolved this problem, and it was due to a logic problem and not inherently related to the core functions. I'll update my answer later.

  • Interesting. I suggest you file a bug with magento support, since you pay for that ;) If they come back with a result, you could update the answer. – ProxiBlue Jan 14 '14 at 2:53
  • I think it may have to do with the incorrect use of the functions. I'm going to try something and post an update. – musicliftsme Jan 14 '14 at 17:50
  • @laketuna could you share what the problem was? – David Manners May 20 '14 at 15:22
  • @laketuna - please move your solution into an answer and mark it as "accepted". It won't get you points, and isn't something you should do often, but it's the right way to self-answer a question. Thanks! – STW Oct 1 '14 at 20:54
1

As I recall, this was a problem of a method processing invoices for the same order in different ways. It was creating two separate invoices and save them separately, causing inconsistencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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