title: Remove where filter from Zend DB Select
body: <p>How do I remove a where condition on a Zend_DB_Select? I've a Magento collection which I added a where condition to using the addAttributeToFilter method from Varien_Data_Collection_Db. Now I need to remove that where condition. Is this possible?</p>
  
  <p><strong>MORE INFO</strong></p>
  
  <p>I've a Magento widget that loads a collection based on an attribute. The widget does this:</p>
  
  <pre><code>$collection-&gt;addAttributeToFilter($attributeCode, array('notnull'-&gt;true));
  </code></pre>
  
  <p>The widget also adds the following filter, to limit results to products that have a name starting with a letter:</p>
  
  <pre><code>collection-&gt;addAttributeToFilter('name', array('like'-&gt; $letter.'%'));
  </code></pre>
  
  <p>However, the client's custom toolbar needs an index of ALL the products by first letter, like [A][B][C][D]...[Z], so when you click on the link, the product collection will be filtered with products starting with that first letter. The problem is that the catalog/product_list_toolbar toolbar block uses the same product collection as the parent catalog/product_list block. So the toolbar's product collection is also filtered by letter.</p>
  
  <p><strong>WORKAROUND</strong></p>
  
  <p>Here's my hacky solution. I added the following code to the widget using PHP's reflection:</p>
  
  <pre><code>$letterCollection = clone $this-&gt;_productCollection;
  $letterSelect = clone $letterCollection-&gt;getSelect();
  $reflectionClass = new ReflectionClass($letterCollection);
  $reflectionProperty = $reflectionClass-&gt;getProperty('_select');
  $reflectionProperty-&gt;setAccessible(true);
  $reflectionProperty-&gt;setValue($letterCollection, $letterSelect);
  $letterCollection-&gt;addAttributeToSelect('name');
  $toolbar = $this-&gt;getChild('toolbar');
  $toolbar-&gt;setLetterCollection($letterCollection);
  
  $this-&gt;_productCollection-&gt;addFieldToFilter('name', array('like' =&gt; "$letter%"));
  </code></pre>
  
  <p>In the extended toolbar (Namespace_Module_Block_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar), I just get the unfiltered collection:</p>
  
  <pre><code>$collection = $this-&gt;getLetterCollection();// $this-&gt;getCollection() would be the filtered collection
  </code></pre>
  
  <p>There should really be a way to remove filter from a Magento collection.</p>