Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Layered Navigation in custom module
 
quickfoxz
Jr. Member
 
Total Posts:  7
Joined:  2009-10-26
 

Hi All,

I’ve written a custom module that show a productlist based on a specific brand.
I have written a class that extends Mage_Catalog_Block_Product_List with a method called _getProductCollection()

_getProductCollection() sets the stores productcollection based on my custom filters in that method. At the front-end my module shows me the right products. Now i want to show the layered navigation on that same page. I’ve added this to my layout file and the layered navigation is showing up, but with the wrong filters.

How can i set the layered navigation to show only the filters that are based on my productcollection.

protected function _getProductCollection(){
        
if (is_null($this->_productCollection)) {
            $_category
Mage::getModel('catalog/category')->load($this->getRequest()->getParam('cid'));
            
$collection Mage::getResourceModel('catalog/product_collection');
            
$this->_productCollection $collection
                
->addAttributeToSelect('required_options')
                ->
addAttributeToFilter('brand'$this->getRequest()->getParam('bid'))
                ->
addCategoryFilter($_category)
                   ->
addStoreFilter()
                ->
setPageSize(30)
                ->
setCurPage(1);
            ;
    
            
$this->_addProductAttributesAndPrices($this->_productCollection);
            
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_productCollection);
            
        
}
    
        
return $this->_productCollection;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top