Friday, January 20, 2012

Code to get multiple SKUs in Sales->Order Grid in Magento Admin



$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');

No comments:

Post a Comment