• Resolved Narek

    (@narstepanian)


    Hi dear Adv. Woosearch team. I have catalogue site and need relevant search for it. I need the search plugin to ignore spaces in search. F. e. I have “MAHLE LX 735” in my product description and want to find it using request “MAHLELX 735”, “MAHLELX735” and “MAHLE LX735”. Is it possible? Regards.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Please try to use following code snippet:

    add_filter( 'aws_search_terms', 'aws_search_terms' ); 
    function aws_search_terms( $terms ) { 
        if ( $terms ) { 
            foreach ($terms as $term) { 
                preg_match_all('/([0-9]+|[a-zA-Z]+)/',$term,$matches); 
                if ( ! empty( $matches ) ) { 
                    $terms = array_merge( $terms, $matches[0] ); 
                } 
            } 
        } 
        return $terms; 
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Also, after adding this code you will need to go to the plugin settings page and click the ‘Clear cache’ button.

    Regards

    Thread Starter Narek

    (@narstepanian)

    Thanks for your fast answer, but snippet contains some errors, can’t activate it. Regards.

    Plugin Author ILLID

    (@mihail-barinov)

    Strange. I double checked this code and it must work fine.

    Please tell me – what error message do you see? Also – how do you add this code snippet? Do you add it inside your theme functions.php file?

    Regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Ignore spaces’ is closed to new replies.