Magento: Filter products by Status

Viewed 48863

I'm having some serious Magento issues here. As expected the following:

$products = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('status', array('eq' => 1));

Will return all enabled products for my $category_id. However this:

$products = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('status', array('eq' => 0));

Does not return disabled products. I can't seem to find a way to return disabled products, and I don't know why.

I've tried this:

Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);

Which was meant to have worked, but apparently may have been deprecated.

Does anyone know how to get all products in a category, enabled and disabled?

5 Answers
Related