This snippet works fine except that it returns a different set of product collection, mainly due to is anchor
attribute:
$category = Mage::getModel('catalog/category')->load(1371);
$collection = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category);
The snippet above returns the complete products including the child category products. However, when running through cron, it returns only a small amount of items. I could simulate what the cron is getting by defining:
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
I want to get the collection that includes the sub category products. How can I achieve this?