1

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?

0

2 Answers 2

0

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.

1
  • It's a single store installation. I added your code but I'm getting the same results.
    – zekia
    Apr 3, 2018 at 21:01
0

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

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.