title: Searching sales order grid redirects to dashboard in magento 1.7
body: <p>I have used a custom module to add new columns to Sales_Order_Grid in Magento but If I search for Order_Id the page redirects to the Dashboard.</p>
  
  <p>If I try to select sales/orders again I get an error:</p>
  
  <pre><code>a:5:{i:0;s:104:"SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'increment_id' in where clause is ambiguous";i:1;s:6229:"#0
  </code></pre>
  
  <p>I have no idea how to solve this and could really do with some guidance please?</p>
  
  <p>Here's the Grid.php code:</p>
  
  <pre><code>&lt;?php
  class Excellence_Salesgrid_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
  {
  
  
      protected function _addColumnFilterToCollection($column)
      {
          if ($this-&gt;getCollection()) {
              if ($column-&gt;getId() == 'shipping_telephone') {
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = 't4.telephone';
                  $this-&gt;getCollection()-&gt;addFieldToFilter($field , $cond);
                  return $this;
              }else if ($column-&gt;getId() == 'shipping_city') {
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = 't4.city';
                  $this-&gt;getCollection()-&gt;addFieldToFilter($field , $cond);
                  return $this;
              }else if ($column-&gt;getId() == 'shipping_region') {
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = 't4.region';
                  $this-&gt;getCollection()-&gt;addFieldToFilter($field , $cond);
                  return $this;
              }else if ($column-&gt;getId() == 'shipping_postcode') {
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = 't4.postcode';
                  $this-&gt;getCollection()-&gt;addFieldToFilter($field , $cond);
                  return $this;
              }else if($column-&gt;getId() == 'product_count'){
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = ( $column-&gt;getFilterIndex() ) ? $column-&gt;getFilterIndex() : $column-&gt;getIndex();
                  $this-&gt;getCollection()-&gt;getSelect()-&gt;having($this-&gt;getCollection()-&gt;getResource()-&gt;getReadConnection()-&gt;prepareSqlCondition($field, $cond));
                  return $this;
              }else if($column-&gt;getId() == 'skus'){
                  $cond = $column-&gt;getFilter()-&gt;getCondition();
                  $field = 't6.sku';
                  $this-&gt;getCollection()-&gt;joinSkus();
                  $this-&gt;getCollection()-&gt;addFieldToFilter($field , $cond);
                  return $this;
              }else{
                  return parent::_addColumnFilterToCollection($column);
              }
          }
      }
  
      protected function _prepareColumns()
      {
  
          $this-&gt;addColumnAfter('shipping_description', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Method'),
                  'index' =&gt; 'shipping_description',
          ),'shipping_name');
          $this-&gt;addColumnAfter('method', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Payment Method'),
                  'index' =&gt; 'method',
                  'type'  =&gt; 'options',
                  'options' =&gt; Mage::helper('payment')-&gt;getPaymentMethodList()
          ),'shipping_description');
  
          $this-&gt;addColumnAfter('shipping_city', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Shipping City'),
                  'index' =&gt; 'shipping_city',
          ),'method');
  
          $this-&gt;addColumnAfter('shipping_telephone', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Telephone'),
                  'index' =&gt; 'shipping_telephone',
          ),'method');
  
          $this-&gt;addColumnAfter('shipping_region', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Region'),
                  'index' =&gt; 'shipping_region',
          ),'method');
  
          $this-&gt;addColumnAfter('shipping_postcode', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Shipping Postcode'),
                  'index' =&gt; 'shipping_postcode',
          ),'method');
  
          /*$this-&gt;addColumnAfter('product_count', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Product Count'),
                  'index' =&gt; 'product_count',
                  'type' =&gt; 'number'
          ),'increment_id');
  
          /*$this-&gt;addColumnAfter('skus', array(
                  'header' =&gt; Mage::helper('sales')-&gt;__('Product Purchased'),
                  'index' =&gt; 'skus',
          ),'increment_id');*/
  
          return parent::_prepareColumns();
  
      }
  
  
  }
  </code></pre>