在Magento中有这个功能:
public function capture(Varien_Object $payment, $amount)
{
$order = $payment->getOrder();
$order_id = $order->getId();
$invoice = ????
$invoice_id = $invoice->getId();
}
如何获取发票或发票ID?
答案 0 :(得分:1)
Mage_Sales_Model_Order
包含hasInvoices()
和getInvoiceCollection()
等方法:
public function capture(Varien_Object $payment, $amount)
{
$order = $payment->getOrder();
$order_id = $order->getId();
if ($order->hasInvoices()) {
$oInvoiceCollection = $order->getInvoiceCollection();
foreach ($oInvoiceCollection as $oInvoice) {
$invoice_id = $oInvoice->getId();
// ...
}
}
}