2010-12-09 77 views
1

我試圖在magento網站的後端按字母順序列出發票上的項目。如何獲得與magento中的發票相關的產品清單?

我有權訪問用於在後端顯示這些項目的Mage_Adminhtml_Block_Sales_Order_Invoice_View_Items對象。

有沒有什麼辦法可以使用這個對象來獲得產品skus列表並重新排列這些項目?

編輯:

下面的代碼收集真實對象在取景顯示的行。我想我需要得到這個點之前排序的項目 -

<?php $_items = $this->getInvoice()->getAllItems() ?> 

回答

0

你可以試試這個:

$this->getInvoice()->getItemsCollection()->addAttributeToSort('sku', 'desc') 
+0

謝謝我會試試看。這是否修改了對象的實際狀態?我在模板中添加了將發票項目收集到數組中的行,並將其添加到原始文章中 - 我會嘗試將該行添加到該行的上方。 – wes 2010-12-09 14:36:26

+0

似乎沒有任何效果,我會嘗試多捅一些。 – wes 2010-12-09 14:41:10

1

你應該附上您處理程序事件「sales_order_invoice_item_collection_load_before」。從事件獲取收集對象並附加此功能

$invoiceObject->addAttributeToSort('sku', 'desc') 
相關問題