I'm getting all products with this code:
$collection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('size', array('in'=>$size))
->addAttributeToFilter('room', array('in'=>$room))
->addStoreFilter()
->setOrder('created_at', 'desc')
->setPage($pageNumber, $productPerPage)
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection->addAttributeToFilter('price', array('gt'=>$priceL));
$collection->addAttributeToFilter('price', array('lt'=>$priceG));
Then I added this code for filter by category:
->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id=entity_id', null, 'left')
->addAttributeToFilter('category_id', array('in' => $catID))
And now, this code work for filter by subcategory but doesn't work for root category. Why? And how do I solve this problem?
EDIT: I'm trying to filter by one category, multi category and root category.