I am making a
Mage::getModel call to try and get all products in a certain category that is in stock.
$stockIds = Mage::getModel('cataloginventory/stock_item') ->getCollection() ->addQtyFilter('<=',1) ->addFieldToFilter('is_in_stock', 1) ->getAllIds(); $_productCollection=Mage::getModel('catalog/category') ->load(51) ->getProductCollection() ->addIdFilter($stockIds) ->addAttributeToSelect('*') ->setPageSize(10)->setCurPage(1);
Everything works apart from the
->addFieldToFilter('is_in_stock', 1) line. Without it all products in the category show up. With it, it's filtering some (apparently random) products out, but not based on whether it is 'In stock'. Some out-of-stock items still appears, and some in-stock items do not appear.
I have checked that all the products are enabled and all quantities are at least 10.