I am having problem apply filters based on categories. The situation is I load all products belonging to a category and and then based on few parameter apply further category filtering like the query might be to fetch all products belonging to "flags" and "skulls" category from all products in clothing category. (category == "clothing" && (category == "flags" || category == "skulls"))
1. $collection = Mage::getModel('catalog/category')->load($categoryId)->getProductCollection(); //load all products in category with id $categoryID
2. $collection->addCategoryFilter(Mage::getModel('catalog/category')->load(array(implode(',', $category_filters_ids))), true);
The problem with line no 2 is that it brings out all categories belonging to ids given in $category_filter_ids without enforcing $categoryId from line 1.
3. $collection->addAttributeToFilter('category_ids',array('in'=>$category_filters_ids));
this gives "Call to a member function getBackend() on a non-object" error. My goal is to load only products belonging to id $category and then further those which belong any of the ids in $category_filter_id array. Please help me