I have a custom script to update prices and stock automaticly.

To get all products attributes I use:

$collection = Mage::getModel('catalog/product')->getCollection()

I saw that other people noticed that not all products-id are loaded. This I figured out. Because the disabled products are not in de EAV flat tables.

  1. So my question, how to I get the same output with the collection above but then with the disabled products included?
  2. And also is there another way to load all products id and attributes by name e.g. foreach product, id, price, stock.... without loading all the overhead

2 Answers 2


When you are using Flat Catalog Product options it will return only enable product collection.check below code for more understanding


public function updateProductStatus($productId, $status, $store = null)
    if (is_null($store)) {
        foreach (Mage::app()->getStores() as $store) {
            $this->updateProductStatus($productId, $status, $store->getId());
        return $this;

    if ($status == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
        $this->_getResource()->updateProduct($productId, $store);
        $this->_getResource()->updateChildrenDataFromParent($store, $productId);
    else { //IF the product is disabled it is removed from the flat tables
        $this->_getResource()->removeProduct($productId, $store);

    return $this;

Still if you want to get disabled product collection then you can get only from EAV tables

For that

$collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_DISABLED));

It will return only disabled product collection

And if you want to both product collection then you have disabled FLAT catalog


In magento, disabled products are not indexed in the flat table. so you can get disabled products using only EAV tables. You can disable FLAT tables in system configuration by setting System->Config->Catalog and Frontend -> Use Flat Catalog Product as NO

After this, you can get the disabled products by

 $collection = Mage::getResourceModel('catalog/product_collection')
 ->addAttributeToFilter('type_id', array('eq' => 'configurable'))
 ->addAttributeToFilter('status', array('eq' =>

To select only few attributes like name, price change the ->addAttributeToSelect('*') to ->addAttributeToSelect('name')->addAttributeToSelect('price')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.