I am going to modify default magento category filter.

I have two categories Fruits and Apple. In fruits there are 100 products and in Apple there are 50 products.

www.demo.com/fruits.html (category page) this is listing all 100 products.

But now when i click on Apple from left category filter, it should load only 50 products that are assign to both category.

www.demo.com/fruuits.html?cat=10 (10 is Apple category id)

I am not getting how and where to modify code to get the result as per my need.


1 Answer 1


Try below code to load product collection by category id

$category_id = $this->getRequest()->getParam('cat'); // 10 as Category Id
$products = Mage::getModel('catalog/category')->load($category_id)
    ->addAttributeToFilter('status', 1) 
    ->addAttributeToFilter('visibility', 4)
    ->setOrder('price', 'ASC');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.