Excluding child products from category that is anchor through code/filter
Hi we have a category with a complex filter set-up: it shows 43 products in backend. When we grab the collection however and show it on the frontend it shows 52 products. I understand this is because we enable anchor = yes
because it needs to be layered.
My question now is: how can we filter out the child products of our collection?
Our current collection call in template file: $_productCollection=$this->getLoadedProductCollection();
I have read some semi-similar questions, but none with a concrete results. I was thinking along the lines of adding a filter like this
$_productCollection=$this->getLoadedProductCollection()->addAttributeToSelect('is_anchor');
or maybe this $this->_productLimitationFilters['category_is_anchor'] = 1;
or maybe this $category->setIsAnchor(true);
or maybe when looping over the products collection? (Add a continue statement)
Another solution would be if I can retrieve all the "genuine" product ids of the parent category (so this time without children) I can then merge exclude the ID's? Or do this is the foreach loop?