I need to filter a magento product collection by disabled status. Magento seems to by default ignore disabled products when loading the collection.
So there are two parts to my question:
1 - How can i load a collection in magento containing only disabled products? 2 - Why is magento not loading disabled products in the collection to begin with?
I am using standard code to load the collection:
$collction = Mage::getModel('catalog/product')->getCollection()
this never loads disabled products.
If you use the product flat structure, then
$col = Mage::getModel('catalog/product')->getCollection();
will use the flat table (eg. catalog_product_flat_1
), and disabled
products are not part of that table.
Change the config Use Flat Catalog Product
to "NO" and you will have all products in the collection:
It will load all products this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With