I have a custom module for ajax layered navigation with multiple filters which has a price slider. I don't want a price slider on the search result page.

my config.xml rewrites block like this


without this price block overriden, everything works fine (ofcourse with no price slider). If I override Price Block Royal_Layerednav_Block_Catalog_Layer_Filter_Price, category listing page works fine, with price slider. But in catalog search page price slider is appearing with wrong values.

I admit that I did not design the Price block to collect prices in search result page. But I don't need to show a price filter on search page.

So My question is: Is there a way, that catalogsearch does not take my overriden price block, instead it should use the default Price block Mage_Catalog_Block_Layer_Filter_Price

I don't know what to do to accomplish this. Can anyone please help?

1 Answer 1


I don't know how your extension is built, so I cannot provide any code but here is an idea on wow you can do it.
In a search page this piece of code will return null always:


In a category page this will return a category instance. You can use this in your own block. So for each method you override you can do the followin check before doing something. Let's say your method is called doSomething(). In your block it could look like this:

public function doSomething($someParam) {
    if (!Mage::registry('current_category')){//not on category page
        //call the default behavior
        return parent::doSomething($someParam);
    //your custom behavior here

You can even change the template that renders the block this way:

public function __construct()
    //by default the template 'catalog/layer/filter.phtml' will be set
    if (Mage::registry('catalog_category')){//if category page
        //set your custom template with price slider.
  • Actually the extension I used, renders the price slider in Price.php (Block) itself. So, I followed your idea to render it on a phtml, and now I also made some changes to Price.php, to get the correct minimum and maximum prices Woila! now price slider also works on search page. I'm lost with the changes I made. I'll present it as the answer soon. Thank you!
    – Shathish
    Commented Jul 26, 2013 at 8:17
  • so can't we use custom price block for catalog only and not for catalogsearch?
    – Shathish
    Commented Jul 26, 2013 at 8:19
  • You can use different block. Just override the method Mage_CatalogSearch_Block_Layer::_initBlocks(). That's how the search uses different blocks for attributes.
    – Marius
    Commented Jul 26, 2013 at 8:23

Your Answer

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

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