Products can be of different types in Magento. The different product types are Simple Product, Configurable Product, Bundle Product, Grouped Product, Downloadable Product, and Virtual Product. For example: Chair can be a Simple Product. Shoes can be of different color and size. So, shoes falls under Configurable product. A downloadable mp3 music file will fall under Downloadable product.
The following code shows how to fetch product collection by particular product type, i.e. fetching all products which falls under a particular product type. If I want to fetch all Configurable products then I will pass the type_id as ‘configurable‘.
Here is the code:-
$collectionSimple = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'simple'));
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'configurable'));
$collectionBundle = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'bundle'));
$collectionGrouped = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'grouped'));
$collectionVirtual = Mage::getResourceModel('catalog/product_collection')
->addAttributeToFilter('type_id', array('eq' => 'virtual'));
Hope this helps. Thanks.