B-219 Sec-55 Noida, India
+918010221733

Add Category Filter on Product Collection In Magento

Here is the code to add category filter on the product collection
$productcollection = Mage::getModel(‘catalog/product’)->getCollection();
$productcollection = $productcollection->addCategoryFilter(Mage::getModel(‘catalog/category’)->load($currcategory),true);
$productcollection = $productcollection->addAttributeToFilter(‘special_price’, array(‘gt’ => 0));
echo $productcollection->getSize();

(Visited 63 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.