Home » Magento20 April 2010

Magento: Get Product Collection by Type

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:-

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • VicHaunter

    Hello, very interesting, but i want to know how to filter for example simple and configurable with the same filter, or any other combination of 2 or 3 different types in the same collection.
    Is this possible? thankyou

  • Lalit Patel

    Thank you for this post. Very help full

  • Ela

    Hi ,

    I want to get the all the sku’s of the Configurable product inner products. How can i alter your method to get the sku’s of the configurable products

    $collectionconfigurable = Mage::getResourceModel(‘catalog/product_collection’)
    ->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
    Zend_Debug::dump($collectionconfigurable);

  • Jerome Dennis D

    Hi brother i don’t know how to thank you.

    You have saved me a lot of time through your very precise articles which hit straight at the target in my magento development  and i would also like to donate you to help this blog as soon as i can :-)

    Keep rocking with your articles. Its not an exaggeration if i would say this blog is a Magento Cook Book.

    Thanks and Regards,
    Jerome Dennis D
    http://haijerome.wordpress.com

  • Yogendra M

    Hello Mukesh, can you guide if we want to sort the product type instead of filter than how can we achieve this?