我试图在下面的函数中找到一种方法来过滤 getInvoiceCollection 的结果:
// "eachInvoice" is each of the Invoice object of the order "$orders"
if ($order->hasInvoices()) {
foreach ($order->getInvoiceCollection() as $eachInvoice) {
$invoiceIncrementId = $eachInvoice->getIncrementId();
}
}
可以将下面的过滤器添加到 $order->getInvoiceCollection()
$order->getInvoiceCollection()
->addAttributeToFilter('created_at', array(
'from' => $from_date,
'to' => $today,
'date' => true,));
所以整个功能是正确的方法,它似乎不正确。
// "eachInvoice" is each of the Invoice object of the order "$orders"
if ($order->hasInvoices()) {
foreach ($order->getInvoiceCollection()$order->getInvoiceCollection()
->addAttributeToFilter('created_at', array( 'from' => $from_date,
'to' => $today, 'date' => true,)) as $eachInvoice) {
$invoiceIncrementId = $eachInvoice->getIncrementId();
}
}
这样做的“正确方法”是什么?