title: Creating Order Item Grid in Magento
body: <p>I am working on creating a Sales Order Item Grid in Magento 1.7. I have creted a new submenu under the Sales Menu in the admin for the same. 
  The Order Item grid will display each product ordered in a new row. Hence there can be multiple OrderIds present in the grid.
  My query in the grid class is:</p>
  
  <pre><code>$collection = Mage::getResourceModel('sales/order_collection')
          -&gt;join(
              'sales/order_item',
              '`sales/order_item`.order_id=`main_table`.entity_id',
              array(
                  'skus'  =&gt; `sales/order_item`.`sku`,
                  'names' =&gt; `sales/order_item`.`name`,
                  'order_incharge' =&gt; `sales/order_item`.`order_incharge` ,
                  'proptions' =&gt; `sales/order_item`.`product_options` ,
  
              ));
  </code></pre>
  
  <p>I do not have any GroupBy clause. When I print this query in the log, it appears as:</p>
  
  <pre><code>SELECT `main_table`.* FROM `sales_flat_order` AS `main_table` INNER JOIN `sales_flat_order_item` AS `sales/order_item` ON `sales/order_item`.order_id=`main_table`.entity_id
  </code></pre>
  
  <p>I have 2 orders in my database.
  Order Id =24 has two products
  Order Id 25 has one product
  So the above query when run on the database correctly displays 3 records.
  However this does not display on the grid. I get the following error when trying to display in the grid:</p>
  
  <pre><code>Item (Mage_Sales_Model_Order) with the same id "24" already exist";i:1;s:4274:"#0 C:\wamp\www\bakery\lib\Varien\Data\Collection\Db.php(576): Varien_Data_Collection-&gt;addItem(Object(Mage_Sales_Model_Order))
  </code></pre>
  
  <p>How do I resolve this issue, so that the same Order Id can be added to the collection? </p>
  
  <p>Thanks,
  Neet</p>