I have a category which uses a custom product collection and layered navigation. Everthing is working fine except the price filter (Magento 1.9). It displays the correct price ranges, but does not filter the products when clicked.
I am also using the Amasty Improved Navigation plugin, so instead of extending the core directly, I extended the plugin's classes which in turn extend the core. Basically I modified the getLayer()
function in
Mage_Catalog_Block_Layer_View
Mage_Catalog_Block_Product_List
to use my custom collection and applyFilterToCollection()
, _getItemsData()
in addition to adding a custom function to get my custom collection in
Mage_Catalog_Model_Layer
Mage_Catalog_Model_Category
Mage_Catalog_Model_Layer_Filter_Attribute
This gets me a working toolbar, pagination and layered navigation except for the price filter - the filters are working correctly for any other attribute. But using the price filter, it returns a page with the correct URL, but in the Product_List Block I get the same, unfiltered products.
Looking into the core, I found the following function which looked promising at first:
Mage_Catalog_Model_Resource_Layer_Filter_Price
applyPriceRange($filter) {
...
$select = $filter->getLayer()->getProductCollection()->getSelect();
...
}
However, "injecting" my custom function/collection did not change anything (I tried extending the plugin's classes as well as the core with the plugin disabled). I also looked into _getSelect($filter)
in Mage_Catalog_Model_Resource_Layer_Filter_Price
but without success.
Where can I hook into to make the price filtering work with my custom collection? How does the Layered Navigation Price Filter work, does use it use its own method to get the product collection?