title: Add categories column to the product grid in Magento admin
body: <p>I'm trying to add a category column to the product grid.
  I've modified <code>Mage_Adminhtml_Block_Catalog_Product_Grid</code>.
  Added the following to <code>_prepareCollection</code> :</p>
  
  <pre><code>-&gt;joinField('category_ids',
              'catalog/category_product_index',
              'category_id',
              'product_id=entity_id',
              null,
              'left')
  </code></pre>
  
  <p>which gives me an error :
  <code>a:5:{i:0;s:72:"Item (Mage_Catalog_Model_Product) with the same id "16243" already exist"</code>.</p>
  
  <p>In prepareColumns I'm adding :</p>
  
  <pre><code>$this-&gt;addColumn('category_ids',
          array(
              'header'=&gt; Mage::helper('catalog')-&gt;__('Categories'),
              'index' =&gt; 'category_ids',
              'width' =&gt; '150px'
      ));
  </code></pre>
  
  <p>How can I fix my query so I won't get the error?
  Is it possible to show and filter by category names instead of ids?</p>
  
  <p>A forum post shows a similar code but I couldn't make it work with categories
  <a href="http://www.magentocommerce.com/boards/viewthread/44534/" rel="nofollow noreferrer">http://www.magentocommerce.com/boards/viewthread/44534/</a></p>
  
  <pre><code>static protected $COLUMN_ID_TRADE_REFERENCES = 'ref_text';
  
  protected function _prepareCollection()
  {
      $store = $this-&gt;_getStore();
      $collection = Mage::getModel('catalog/product')-&gt;getCollection()
          -&gt;addAttributeToSelect('name')
          -&gt;addAttributeToSelect('attribute_set_id')
          -&gt;addAttributeToSelect('type_id')
          -&gt;addAttributeToSelect('ref_text')
          -&gt;joinTable('productreferences/reference',
              'product_id=entity_id',
              array('ref_text'),
              null,
              'left')
          -&gt;joinField('qty',
              'cataloginventory/stock_item',
              'qty',
              'product_id=entity_id',
              '{{table}}.stock_id=1',
              'left')
          -&gt;addStaticField('ref_text')
          -&gt;addExpressionAttributeToSelect(self::$COLUMN_ID_TRADE_REFERENCES,
              'GROUP_CONCAT(ref_text SEPARATOR " ; ")',
              'ref_text')
          -&gt;groupByAttribute('entity_id');
  </code></pre>