• Resolved divinebox

    (@divinebox)


    Hi there,

    Thanks for this great plugin!

    If product contains apostrophe ‘ and i type the name of the product in the search bar, results will then appear. That’s fine.

    But if a product contains apostrophe ’ (which is not the same as ‘), then no results will appear.

    Is this normal ? Could you fix this ?

    I have tried to dig, but it seems that according to the user agent, the apostrophe typed into the search bar will not be the same…

    Thanks

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Kris

    (@c0nst)

    Hi @divinebox

    A good way out of this situation will be to standardize this apostrophe character in product titles and in other fields where they appear.
    Probably the first version of this character??will be good. I see that your store doesn’t have a lot of products, so I suggest you do it manually.

    Then, in the FiboSearch search engine, we will replace the second apostrophe with the correct one before it goes to the engine with the first one. Here is the code that will do it:

    add_filter( 'dgwt/wcas/phrase', function( $keyword ) {
    
    	if ( strpos( $keyword, "'" ) !== false ) {
    		$keyword = str_replace( "'", "'", $keyword );
    	}
    
    	return $keyword;
    
    }, 10 );

    Regards,
    Kris

    Thread Starter divinebox

    (@divinebox)

    Thanks ! Here is my final code to fix the pb on 2 apostrophe, working on my side

    add_filter( 'dgwt/wcas/phrase', function( $keyword ) {
    
        if ( (strpos( $keyword, "’" ) !== false )
          || (strpos( $keyword, "‘" ) !== false )) {
          $keyword = str_replace( "’", "'", str_replace( "‘", "'", $keyword ));
      }
    
      return $keyword;
    
    }, 10 );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pb with apostrophe : ’ or ‘’ is closed to new replies.