1

I have an advanced search form on all pages. If you search nothing, it takes you to a results page with 'Please specify at least one search term.'.

The problem is, this results page contains an advanced form, so I end up with two forms.

How do I removed this extra form?

Note: If you do use a search term, you get your results and the extra form is not there.

1

The advanced search redirects to /catalogsearch/advanced if no search term is specified. This is the page that contains the advanced search form. But as you don't need this page, you could either

  1. remove the form from this page (it will be empty, just containing the error message), using layout XML:

    <catalogsearch_advanced_index>
        <remove name="catalogsearch_advanced_form" />
    </catalogsearch_advanced_index>
    

    OR

  2. make the search redirect back to the previous page on error instead of the form. You can override Mage_CatalogSearch_AdvancedController::resultAction() and use _redirectBack() or specify a different redirect URL on error. Or better, write a post dispatch observer for this action to change the redirect target.

    More info: Magento 1 : how to override/rewrite a core controller class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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