[Magento] How To Fetch Products Of Specific Category In Magento

Hi Friends, Some days ago I was working on one magento project in which I need to get products of a specific category, Magento is best eCommerce software and having kostly all functionlity yo retrive data, so I search about it and got one solution to get/fetch/retrive products of specific category. We need to use 2 line of code to get products  from particular category.

Here is code to get particular category products :

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

In above code in first line $categoryId is category id for which you want to fetch products. So just pass category id in this code and you will get products object in $productObj.

I hope this post helpful for someone. If you have any question then you can ask me anytime or post it in comment.

Also I am PHP Freelancer, Freelance PHP Developer having more than 4 years of experience, So if you want to do any projects then you can contact me.

Hostgator Hosting in 1 Cent Coupon Code – “1CENTHECOUPON” (Without Quotes).

Subscribe to PHP Freelancer

Enter your email address: