I want to ignore special characters while catalog search. When a user enters any special character in the search box, the search shall find results for the combination both with and without special characters, even a whitespace. e.g searching for 122hj7 12w will search for 122hj7 12w results as well as 122hj712w results.
Magento – Ignoring special characters during catalog search
catalogsearchmagento-1.9
Best Answer
Need to some change in helper file
app\code\core\Mage\CatalogSearch\Helper\Data.php
from
To
We have add only one line code in above function
$this->_queryText = preg_replace('/[^A-Za-z0-9\-\']/', '', $this->_queryText);
Note: first move core file to local
app\code\local\Mage\CatalogSearch\Helper\Data.php
after add above change or rewrite a helper classMage_CatalogSearch_Helper_Data
to local click here to rewrite helper steps