Update order grid in magento

How to add number of product’s quantity of the order in Order grid

Note:- you can download extension from this rar_image

Update order grid in magento through custom module.
Note:- Firstly disable the cache from Cache Management tab which is in System tab.
there are many steps to create the extension.
Step1:- Create Mywork_UpdateOrderedGrid.xml file in app/etc/modules/.
where Mywork is Namespace and UpdateOrderedGrid is Modulename.

<?xml version="1.0"?>
<config>
    <modules>
        <Mywork_UpdateOrderedGrid>
            <active>true</active>
            <codePool>local</codePool>
		</Mywork_UpdateOrderedGrid>        
    </modules>
</config>

Note:- 1) If you want to active the extensions then use true otherwise false.
2) there are three code pool (a) local (b) core (c) community
when we create the own extension then we use local code pool.

Step2:- Now create the config.xml file in app/code/local/Mywork/UpdateOrderedGrid/etc/config.xml

<config>
  <modules>
    <Mywork_UpdateOrderedGrid>
        <version>1.0.0</version>
    </Mywork_UpdateOrderedGrid>    
  </modules>

  <global>
      <blocks>
        <adminhtml>
            <rewrite>
            <sales_order_grid>Mywork_UpdateOrderedGrid_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
            </rewrite>
        </adminhtml>
      </blocks>
    <helpers>
        <UpdateOrderedGrid>
            <class>Mywork_UpdateOrderedGrid_Helper</class>
        </UpdateOrderedGrid>
    </helpers>
  </global>
 </config>

Note:- 1) In this file we created version of this module is 1.0.0
2) When we want to update the sales order grid then we use sales_order_grid tag which is in the rewrite tag.

Step:3:- Now we create the Grid.php which is in the app/code/local/Mywork/UpdateOrderedGrid/Block/Adminhtml/Sales/Order/

<?php 
class Mywork_UpdateOrderedGrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
	 
public function setCollection($collection) {
        $collection->join('sales/order_item', 'order_id=entity_id', array('name'=>'name', 'sku' =>'sku', 'qty_ordered'=>'qty_ordered' ), null,'left');
		$this->_collection = $collection;
    }
	
	protected function _prepareColumns()
    {
        $this->addColumnAfter('qty_ordered', array(
            'header' => Mage::helper('sales')->__('Items Ordered'),
            'index' => 'qty_ordered',
		),'shipping_name');
		return parent::_prepareColumns();
	}	 
}
?>

Note:-In this file we create the class name Mywork_UpdateOrderedGrid_Block_Adminhtml_Sales_Order_Grid
this class extends Mage_Adminhtml_Block_Sales_Order_Grid class.

in the public function setCollection($collection) we add $collection->join(‘sales/order_item’, ‘order_id=entity_id’, array(‘name’=>’name’, ‘sku’ =>’sku’, ‘qty_ordered’=>’qty_ordered’ ), null,’left’);

in the protected function _prepareColumns() we create the
$this->addColumnAfter(‘qty_ordered’, array(
‘header’ => Mage::helper(‘sales’)->__(‘Items Ordered’),
‘index’ => ‘qty_ordered’,
),’shipping_name’);
return parent::_prepareColumns();
}

Step4:- Now we create the Data.php file in Helper folder

<?php 
class Mywork_UpdateOrderedGrid_Helper_Data extends Mage_Core_Helper_Abstract
 {
 }
?>