title: How to sort productcollection by category and sku?
body: <p>I'm using a custom extension for Magento, with the following code to show a list of products.
  At the moment, products are sorted by SKU, but I would like to sort these products by category. </p>
  
  <p>I've tried with replacing addAttributeToSelect with addCategoryFilter($category), but it doesn't seem to work.</p>
  
  <p>Does anyone have a clue which code to add to this example to sort by category at first, and within this category by SKU ?</p>
  
  <pre><code>    $this-&gt;_productCollection = Mage::getModel('catalog/product')-&gt;getCollection()
  
          -&gt;addAttributeToSelect(Mage::getSingleton('catalog/config')-&gt;getProductAttributes())
          -&gt;addFieldToFilter('entity_id', array('in'=&gt;$_arrayOfProductIds))
          -&gt;addAttributeToSelect('sku')
          -&gt;setOrder('sku', 'asc')-&gt;load();
  </code></pre>
  
  <p>Thanks in advance</p>