您的位置:首页 > 其它

How to extend Magento Order Grid?

2011-01-25 22:52 381 查看

How to extend Magento Order Grid?

30th NOV 2010 | Posted by Domagoj Potkoc in Administration, Magento, Orders





Here is small example which explains how to modify order grid. Main class for order grid is “Mage_Adminhtml_Block_Sales_Order_Grid”, if you want to add some column you have to rewrite this class (block).

How to rewrite magento block:

If you call block “adminhtml/sales_order_grid”, you will get
Inchoo_Test_Block_Adminhtml_Order_Grid of course you need to create
your class Inchoo_Test_Block_Adminhtml_Order_Grid.

This is example of our block Inchoo_Test_Block_Adminhtml_Order_Grid:

If you want to add some column you need to add next code in method: _prepareColumns

Also you will notice that we modified method: _prepareCollection(),
we changed SQL query, we made inner join to second database table in
order to get data from second database table. This is our working
example and your SQL query you can modify as you wish.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息