订单页面(ordergrid)显示所有的sku和productname http://webkul.com/blog/magento-product-name-and-product-sku-in-sales-order-grid/
(http://blog.chinaunix.net/uid-26559452-id-3093383.html)
1./app/code/core/Mage/Adminhtml/Block/Sales/Order and opengrid.php
_prepareCollection()
protected
function
_prepareCollection()
{
$collection
= Mage::getResourceModel(
$this
->_getCollectionClass())
->join(
'sales/order_item'
,
'`sales/order_item`.order_id=`main_table`.entity_id'
,
array
(
'skus'
=>
new
Zend_Db_Expr(
'group_concat(`sales/order_item`.sku SEPARATOR ",")'
),
'names'
=>
new
Zend_Db_Expr(
'group_concat(`sales/order_item`.name SEPARATOR ",")'
),
)
);
$collection
->getSelect()->group(
'entity_id'
);
$this
->setCollection(
$collection
);
return
parent::_prepareCollection();
}
2._prepareColumns()
$this
->addColumn(
'skus'
,
array
(
'header'
=> Mage::helper(
'Sales'
)->__(
'Skus'
),
'width'
=>
'100px'
,
'index'
=>
'skus'
,
'type'
=>
'text'
,
));
$this
->addColumn(
'names'
,
array
(
'header'
=> Mage::helper(
'Sales'
)->__(
'Name'
),
'width'
=>
'100px'
,
'index'
=>
'names'
,
'type'
=>
'text'
,