Get product collection filter by category id in magento

Below is the code by using we can get product collection filter by category id in magento

$category = Mage::getModel('catalog/category')->load('category_id');
$productCollection = $category->getProductCollection();
$productCollection
->addStoreFilter()
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addUrlRewrite();

Tags: Magento1,

Related Posts

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *