Revision: 56481
Updated Code
at March 30, 2012 15:27 by ddavidd
Updated Code
/* You will need to edit/replace your $collection declaration in _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 ",")'),
'quantities' => new Zend_Db_Expr('group_concat(`sales/order_item`.qty_ordered SEPARATOR ",")'),
)
);
$collection->getSelect()->group('entity_id');
/* You will then need to add new columns in _prepareColumns() */
$this->addColumn('sku', 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',
));
Revision: 56480
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 30, 2012 15:24 by ddavidd
Initial Code
/* You will need to edit/replace your $collection declaration in _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 ",")'),
'quantities' => new Zend_Db_Expr('group_concat(`sales/order_item`.qty_ordered SEPARATOR ",")'),
)
);
$collection->getSelect()->group('entity_id');
/* You will then need to add new columns in _prepareColumns() */
$this->addColumn('sku', 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',
));
Initial URL
http://www.magentocommerce.com/boards/viewthread/218158/
Initial Description
Add the below commented sections into the appropriate functions in your /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php and you'll be good to go! This has been (personally) tested with 1.6.1.0
Initial Title
Add a SKU column to the order grid in Magento 1.6.1
Initial Tags
php, magento
Initial Language
PHP