Question

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?

Was it helpful?

Solution 2

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top