Magento : Product Name and Product SKU in Sales order grid

Product Name and Product SKU in Sales order grid: This is really very important and needed aspects of the sales order grid and saves a lot of time of your’s , Lot of users requested us for this tutorial . so here is a simple hack to display product order name and product sku in magento sales order grid .

Go to /app/code/core/Mage/Adminhtml/Block/Sales/Order and open grid.php

Now replace your _prepareCollection() function to this following code

protected function _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 ",")'),
		            )
		        );
		        $collection->getSelect()->group('entity_id');

		    $this->setCollection($collection);
        return parent::_prepareCollection();
    }

After adding this function lets add the columns in grid for sku and ordername add this code in your _prepareColumns() function

$this->addColumn('skus', 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',

after this you’ll display your sales order screen in like this SKU's and Product nameEmail me for any query or suggestion : sahu.vipin@webkul.com
We also provide extended version of the module for magento extended sales order grid .

Magento Slider

This module supports following product properties in sales order grid –

★ Product image

★ Product id

★ SKU

★ Product Name

★ Buyer Email address

★ Gender

★ Ordered Quantity

Feel free to contact us  or add a ticket at our ticket support system – http://webkul.com/ticket/index.php

. . .

Ask a Feature