Magento – How to use filters on custom product listing

magento-1magento-1.7theme

I need to use filters on different type of product listings not just on category page.

Let me give and example i have the product listing of mostly-viewed products . I have created a CMS page and assigned it a template file say mostly-viewd.phtml. Now i want to show filters on it.

So far i did this :

I made a custom module where,

Block/List.php

    <?php
    class Company_Filter_Block_List extends Mage_Catalog_Block_Product_List
    {
        protected function _getProductCollection()
        {
        $collection = parent::_getProductCollection();

                    /* Need to work here */

        return $collection;
        }
    }

Now i am able to use this block and getting the product list of category i am using root category here so i am getting all the products of store now i want to filter them and show only those products , which have atleast 30 views.

Any idea how should i do this.

Thanks in advance.

Best Answer

There is no need to rewrite this block.

You can just hook into catalog_block_product_list_collection and add your filters.

Related Topic