title: Magento ->addCategoryFilter - filtering product collection by root category
body: <p>Concerning the use of the <strong>->addCategoryFilter</strong> on a product collection. Why is it not possible to filter by the root category? I have 2 stores, both with different root categories. I want to show a list of best-selling products on my homepage. But I can't filter the products by the root category, only sub-categories under that. </p>
  
  <p>So, on my homepage, all products from both stores show up. I can filter ok by any sub-categories. For example, my second root category has an ID of 35. If I try to filter by this, I get every product from both roots. But the first sub-category under that root is ID 36, and filtering by this works correctly, showing only those products. My call is as follows (simplified):</p>
  
  <pre><code>$_category = Mage::getModel('catalog/category')-&gt;load(35);
  
  $_testproductCollection = Mage::getResourceModel('catalog/product_collection')
  -&gt;addCategoryFilter($_category)
  -&gt;addAttributeToSelect('*');
  $_testproductCollection-&gt;load();
  
  foreach($_testproductCollection as $_testproduct){ 
  echo $this-&gt;htmlEscape($_testproduct-&gt;getName())."&lt;br/&gt;"; 
  };
  </code></pre>
  
  <p>Anyone know why this isn't working? Or is there some other way to filter by the root category?</p>
  
  <p><strong>UPDATE:</strong>
  I still haven't had any luck with this. Seems very buggy - adding a category filter using the root category only works sometimes, you need to add all products to the root, then save, then remove any that shouldn't be in that root cat, then re-save. But if you re-index you get all products showing again. If I output the sql query from my above collection call I get the following:</p>
  
  <pre><code>SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(`price_index`.`tier_price`, LEAST(`price_index`.`min_price`, `price_index`.`tier_price`), `price_index`.`min_price`) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id='2' AND cat_index.category_id='35' INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
  </code></pre>
  
  <p>As you can see, the category is listed there, so why doesn't the filter work?</p>