Here's a collection that should include all simple products in my magento store:

$collectionSimple = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToFilter('type_id', 'simple');

This collection has 6750 items, while my magento has 9892 simple products.

Any ideas why is this happening?


This could occur if you have multiple store views.

Try adding ->addStoreFilter(Mage_Core_Model_App::ADMIN_STORE_ID) to load products from the "default" store.

| improve this answer | |
  • It's a single store installation. I added your code but I'm getting the same results. – zekia Apr 3 '18 at 21:01

It's seems out that (enabled) flat catalog is causing this issue. A simple fix is to add this line before the getCollection

Mage::app()->getStore()->setConfig('catalog/frontend/flat_catalog_product', 0);

solution source: https://stackoverflow.com/a/30750804/236021

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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