2

I want to add new column 'Item list' in sales order grid table in admin where it will show all the names of ordered items. I updated in /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grip.php page and it will show the correct output but the pagination and number of records shows incorrect as per the data. Please see the code that i changed in Grid.php page

protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel($this->_getCollectionClass());
        $collection->getSelect()->join('sales_flat_order_item', '`sales_flat_order_item`.order_id=`main_table`.entity_id', array('name'  => new Zend_Db_Expr('group_concat(`sales_flat_order_item`.name SEPARATOR ", ")')));
 $collection->getSelect()->group('entity_id');
    $collection->getSelect()->joinLeft(
                array('cev' => 'customer_entity_varchar'),
                '(main_table.customer_id = cev.entity_id AND cev.attribute_id = 141 AND main_table.customer_id IS NOT NULL)',
                array(
                    'admin_number' => 'cev.value',
                )
            ); 
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

and for adding column

$this->addColumn('name', array(
        'header'    => Mage::helper('Sales')->__('Item List'),
        'width'     => '200px',
        'index'     => 'name',
        'type'        => 'text',

    ));

when i removed the above code then everything is working fine. Please check it and tell me where i am doing mistake. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.