开发者

How can I get a list of products related to an invoice in magento?

I am trying to alphabetize the items listed on an invoice in the backend of a magento site.

I have access to the Mage_Adminhtml_Block_Sales_Order_Invoice_View_Items object used to display these items in the backend.

Is there any way I can use this ob开发者_如何学运维ject to get a list of product skus and reorder these items?

Edit:

Here's the line of code that's gathering the objects for display in the view. I imagine I'd need to get the items sorted before this point –

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


You should attach you handler on event "sales_order_invoice_item_collection_load_before". Get collection object from event and attach this function

$invoiceObject->addAttributeToSort('sku', 'desc')


you can try this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜