I'm creating a partial invoice and I'm unable to get the qty invoiced
to send it to the payment gateway.
The code I'd written in my model for capture()
is:
if ($order->hasInvoices()) {
foreach ($order->getInvoiceCollection() as $invoice) {
foreach ($invoice->getAllItems() as $item) {
Mage::log($item->getQtyInvoiced()); // getting qty = 0
}
}
}
also, for the next time I do want to create the invoice then $order->hasInvoices()
returning false
.
Is the above code is right? Any note on debug the invoice items will be appreciated.
Best Answer
The
getQtyInvoiced()
method you are using does not exist. You need to useThen you should be all set.
P.S. For a full list of functions applicable to this object, refer to
app/code/core/Mage/Sales/Model/Order/Invoice/Item.php