5 February 2011 0 Comments

[Magento] Retrieve/Fetch Products of specific Category

I am working with Magento Shopping Cart and i was in need to show products of particular category only. Magento almost provides all functions to get variety of combination data. I was searching to retrieve the category specfic products and finally i succeed. Here is the code i am sharing with you. Its 2 line code which saves a lt time of your. Hope i help you.

$cObj = Mage::getModel(‘catalog/category’)->load($categoryId);
$productObj = $cObj->getProductCollection()->getData();

$categoryId is the category id for which you need the products. isn’t it simple ?

    Freelance PHP Developer