title: Add AS-Expression to selected columns in getCollection()
body: <p>As an follow up idea to solve my "sort product collection by sub-category" problem explained in my question <a href="https://stackoverflow.com/questions/19097839/sorting-collections-by-subcategory-an-attribute-and-by-productname">sorting collections by subcategory, an attribute and by productname</a> I had the idea to add a <code>AS</code> expression to the selected fields of the collection.</p>
  
  <p>What I want to achieve (SQL-wise) is something like this:</p>
  
  <p><code>SELECT field1, 'some string' as 'category_name' FROM ...</code></p>
  
  <p>So I thought I could use the <code>addExpressionFieldToSelect</code> in the method chain to dynamically add the category name string to the products collection.</p>
  
  <p>For that have the following:</p>
  
  <pre><code> // ...
   $_products = Mage::getModel('catalog/product')
       -&gt;getCollection()
       -&gt;joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left')
        -&gt;addAttributeToSelect('*')
        -&gt;addExpressionFieldToSelect('\'some category name\'', 'AS', 'category_name')
        -&gt;addAttributeToFilter('status', 1)
        -&gt;addAttributeToFilter('visibility', 4)
        -&gt;addAttributeToFilter('is_saleable', array('like' =&gt; '1'))
        -&gt;addAttributeToFilter('category_id', $_subcategory_finset_ids)
        -&gt;addAttributeToSort('ws_geschmack', 'ASC')
        -&gt;addAttributeToSort('name', 'ASC');
   // ...
  </code></pre>
  
  <p>But with that I get an error:</p>
  
  <p><code>Fatal error: Call to undefined method Mage_Catalog_Model_Resource_Product_Collection::addExpressionFieldToSelect() ...</code></p>
  
  <p>Short explanation: In fact I am not able to sort product collections by sub-category (string) I first query all child categories of a parent category (ordered) and within a loop I query all products of these child categories (down to the deepest level) to get products sublists of each subcategory and sub-sub categories. To fully understand my problem, please refer to my question mentioned above.</p>
  
  <p>It is just a try, I do not know if all this is really working. As a hack for now I just try to come a little closer with that <code>AS expression</code> field holding the category name of the outer loop. I then could merge these collections and would have a final products collection.</p>
  
  <p>If there is a more simple way, please let me know.</p>
  
  <p>Any help is greatly appreciated!! </p>
  
  <p><strong>Update</strong></p>
  
  <p>Instead of using <code>addExpressionFieldToSelect</code> it is possible to use this:</p>
  
  <pre><code> $_products-&gt;getSelect()
       -&gt;columns(
           array(
              'category_name' =&gt; new Zend_Db_Expr(
                          'some string')
           )
       );
  </code></pre>