'Add product name with attribute color, size in Order Grid Magento

I want to add Product name with attributes (color,size). But after using below code total record show only 2 records. Here is my code: file name is : app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid

 protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel($this->_getCollectionClass());
        $collection->getSelect()->joinLeft('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('customer_email'=>'customer_email'));
        $collection->getSelect()->joinLeft('sales_order_status', 'sales_flat_order.status=sales_order_status.status',array('label'=>'label'));
        $collection->join(
                'sales/order_item',
                '`sales/order_item`.order_id=`main_table`.entity_id',
                array(
                     'product_name' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR ",")'),
                    )
                );
        $collection->getSelect()->group('entity_id');

        //$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = "shipping" ',array('telephone', 'email'));
        //var_dump((string)$collection->getSelect());
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

and in function _prepareColumns()

$this->addColumn('product_name', array(
            'header'    => Mage::helper('Sales')->__('Product Name'),
            'width'     => '100px',
            'index'     => 'product_name',
            'type'        => 'text',
        ));

Kindly help me how to add attributes with product name?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source