You get that strange url because of the method getSearchPostUrl
in the advanced search form class. It looks like this:
public function getSearchPostUrl()
{
return $this->getUrl('*/*/result');
}
This means that the url where the search form will be sent is {current_module}/{current_controller}/result
.
You have to options here.
Clone catalogsearch/advanced/form.phtml
into an other template file, use that for rendering the block and change inside it:
<form action="<?php echo $this->getSearchPostUrl() ?>" method="get" id="form-validate">
to <form action="<?php echo $this->getUrl('catalogsearch/advanced/result') ?>" method="get" id="form-validate">
Create a new block class that extends Mage_CatalogSearch_Block_Advanced_Form
, use that for your homepage, and change the getSearchPostUrl
to return $this->getUrl('catalogsearch/advanced/result')
.
I would go with option 1. Less work.
If you want to remove the links you can via the Layout XML:
<layout version="0.1.0">
<default>
<reference name="footer_links">
<!-- Remove 'Advanced Search' -->
<action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl" /></action>
</reference>
</default>
</layout>
To disable the controller itself (while not the cleanest approach is the quickest) create a copy of:
app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php
Into the local code pool app/code/local/Mage/CatalogSearch/controllers/AdvancedController.php
And overwrite the local copy to:
class Mage_CatalogSearch_AdvancedController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->_redirectUrl('/');
}
public function resultAction()
{
$this->_redirectUrl('/');
}
}
Any requests will be redirected to home.
Best Answer
To add this, you will need to override the following files:
At below code in Form.php, add:
Add below function in Form.php:
In Advanced.php, replace the getSearchCriterias() function with the code below:
replace getProductCollection() function, with:
Now search this function addFilters. In this function you can see following condition code,
replace above with following code:
In form.phtml, after
endforeach
line i.e. line no 122 add below code:(Above code will show 1st level categories.)
Now You can see category filter in Advanced Search.