Google+

Pages

Sunday, April 1, 2012

Code to multiple skus in Sales->Order Grid in Magento Admin

Check out this code:

$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: