Вопрос

I need the ID of the last invoice for an order. I already have the order ID, but it does not know how to get the ID of the last invoice. Does anyone know how to do it?

Это было полезно?

Решение

One approach:

$order_id = intval($_POST['order_id']);
$order = Mage::getModel('sales/order')->load($order_id);
$invoice = $order->getInvoiceCollection()
    ->addAttributeToSort('created_at', 'DSC')
    ->setPage(1, 1)
    ->getFirstItem();
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top