My store has the following categories:
- Root
- other category
- another category
- Home
- Kitchen
- Cabinets
- Appliances
- Accessories
- Bedroom
- Storages
- Beds
- Blinds
- Bathroom
- Fittings
- Tiles
- Flooring
- Lounge
- Seating
- Electricals
- Lighting
In a custom module i have a page which loads a collection of all my level 4 categories through the home
category path like so:
public function __construct()
{
parent::__construct();
$home_id = 52;
$root_id = Mage::app()->getStore()->getRootCategoryId();
$path = '1/'.$root_id.'/'.$home_id.'/';
$collection = Mage::getModel('catalog/category')->getCollection()
->addAttributeToFilter('level', 4)
->addAttributeToFilter('is_active', 1)
->addPathsFilter($path)
->addAttributeToSelect(array('name'))
->addNameToResult()
->addUrlRewriteToResult()
->setLoadProductCount(true);
$this->setCollection($collection);
}
So the above successfully gets these categories in a collection:
- Cabinets
- Appliances
- Accessories
- Storages
- Beds
- Blinds
- Fittings
- Tiles
- Flooring
- Seating
- Electricals
- Lighting
Now i need to be able to filter these categories by their attributes - in the same way the layered navigation works on products. The filtering needs to be done on the categories themselves not the products within.
For one example all these categories have a custom attribute of section.
Only Lighting
and Blinds
have
section: lower
All the other categories have
section: upper
Is it possible to add layered navigation into the left sidebar so i can filter the categories by section (and others)?