title: Magento Product Collection Get Only Products From Certain Categories
body: <p>I am trying to get a list of products that have a sale price that are only in certain categories. Right now I am trying to use a product collection to get this data. I am not sure how I would go about restricting the collection for particular categories only. Here is what I have so far:</p>
  
  <pre><code>$products = Mage::getModel('catalog/product')
      -&gt;getCollection()
      -&gt;addAttributeToSelect('*')
      -&gt;addAttributeToFilter('status', 1)
      -&gt;addAttributeToFilter('visibility', 4)
      -&gt;addAttributeToFilter('special_price', array('neq' =&gt; ""))
      -&gt;addAttributeToFilter('discontinued', array('neq' =&gt; 1))
      -&gt;setPageSize(10)
      -&gt;setOrder('price', 'ASC')
      ;
  </code></pre>
  
  <p>The discontinued attribute is a custom attribute that we use so that products don't display but also don't 404.</p>
  
  <p>Is there a way to use the product model and restrict to certain categories?</p>