I am trying to get all disabled products from magento using the following code but it returns only enabled products. I have enabled Flat Catalog Product options. Is there any way to get disabled configurable products using mysql or magento code?
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToFilter('type_id', array('eq' => 'configurable'))
->addAttributeToSelect('*')
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED));
Best Answer
The disabled products are not indexed in the flat table.
Take a look at
Mage_Catalog_Model_Product_Flat_Indexer::updateProductStatus()
. This is called sometime during the indexing process.So you can get the disabled products only by using the EAV tables.
Try this: