Site Search - Strip Dashes From Search Phrase


Any idea which variable in which file that I can apply a str_replace to strip dashes out of the site search value? I've played with $piece in the fn.catalog.php in various places but it just seems to break it.

The need is because customers type in the product codes incorrectly. Such as 'HUB-4816' when the actual product code is 'HUB48-16'. I want to strip dashes so the search phrase becomes 'HUB 4816' which will at least display products instead of the No Products Found result. TIA


You should handle the "get_products_pre" hook

Please try

$params['q'] = preg_replace("/\-/", " ", $params['q']);

Remember that product search divides the string by spaces and searches for each piece.

Best regards