PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Issue with apostrophe in "search by text" field

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
12

Hi,

When I search for existing product by the title which contains apostrophe, such as “Egyptian Daisy’s”, there will be no results, and the text in the search field will be switched to “Egyptian Daisy\’s” – \ will be added before apostrophe.

When I search for any other product without apostrophe in its title, results are fine.

I've tried these solutions, but without luck:
https://wordpress.org/support/topic/search-by-text-filter-doesnt-work-with-apostrophes/
and
https://wordpress.org/support/topic/apostrophe-in-title-label/

Can you please help?

To replicate the issue, you need to be logged in - details sent in private data popup.

 

Thank you very much!
Damir

Hello Damir

Ok!  Please  add  FTP access( https://c2n.me/43SC6rb.png ->https://c2n.me/42BAoj4.png)  I will  fix  it

Hi Pablo, thanks for your reply.

 

Unfortunately this website is hosted on some kind of AWS instance where FTP is not allowed.
Can you try to explain what do I need to change? I am a developer as well, so I can do the changes myself, if you can explain it here.

I didn't want to change plugin files so the changes doesn't disappear after the plugin update, and I couldn't figure out how to fix it from the theme / functions.php file.

Hello

Ok!  In file  - \wp-content\plugins\woocommerce-products-filter\ext\by_text\index.php - change  these lines - https://c2n.me/4akpwvc.png

$woof_text = stripslashes($woof_text);
$woof_text = str_replace("'","\'", $woof_text);

Hi Pablo,

I've added both lines but unfortunately your code doesn't seem to help. I'm not sure if I understand it correctly - I see you remove slash in the first line, but you are adding it back in the next line?

I also tried this variant:
KEPT THIS: $woof_text = stripslashes($woof_text);
REMOVED THIS: $woof_text = str_replace("'","\'", $woof_text);
But without luck.

But, I've figured out that the slash is not being added when I turn off the"Autocomplete" option. Does this helps?

 

Thank you,
Damir

 

Hello  Damir

Drop me  a screenshot  of  this file  with  your changes

Hi Pablo,

I've copied the website locally, where I already have the first local version of website, on which I am doing testings. So now I have two versions locally, on the same configuration, server, platform.

First one (old) work normally, while the second one (new, the one I've created from the live site backup) is not working.

This seems like encoding issue, because plugin versions are the same, and I also tried deactivating all other plugins in order to see if some of them is making a conflict. Please see screenshots:

First local website: https://salondart.org/wp-content/uploads/salon1.png
Second local website: https://salondart.org/wp-content/uploads/salon2.png

Does this help?
Database encoding and tables encoding seems the same as well. Can you suggest what else I can check?

 

P.s. screenshot of how I edited the file (I've reverted it back):
https://salondart.org/wp-content/uploads/edit.png

Hello

You edited the code incorrectly. This is my fault (formatting the message).

please check this screenshot and do the same code - https://c2n.me/4akpwvc.png

Your  screenshot - https://clip2net.com/s/4am2qLb

Hi Pablo,

Yes, I already tried that as well. It's not working.

I also tried to do a simple, obvious str_replace (replace"Da" with"Ne"), outside the if statement, it's also not working...

Please see screenshot:
https://salondart.org/wp-content/uploads/edit2.png

Keep in mind"autocomplete" option is enabled for this field.

Hello

Please  check  this  screenshot - https://c2n.me/4akpwvc.png   please change  your  code - https://c2n.me/4amEPSj.png

Hi Pablo,

Sorry, I've corrected my code, but it still doesn't work.

I've also tried to correct the code here, in the ELSE part of the statement, because I'm not sure if the woo_text_search_like_option is enabled or not, but without luck (reverted it back):

Also, please note my statement from the previous comment - I've tried to do a simple, obvious str_replace() even before this IF statement, but it didn't work.

I am clearing cache manually before each try (deleting the cache folder from the server), and clearing browser cache as well.

In  this case I  need  FTP  access  to your  test site

Hi Pablo,

Unfortunately I didn't got approval from the client to provide access for the website.

If you would like me to share screen and follow your instructions, we can do that.

Otherwise you can close the ticket and thank you very much for your willing to help.

 

Regards,
Damir

Hello Damir

In this  case  just  replace  this  file -  \wp-content\plugins\woocommerce-products-filter\ext\by_text\index.php

New  file - https://drive.google.com/file/d/1D1RlxaQ9TZqn65dV2bK0ktiPL9wsOi7K/view?usp=sharing

 

Hi Pablo,

I've replaced the file, but unfortunately this didn't help.

Please note that we have changed the"by text" search to consider only the excerpt field content. Maybe it's behaving unexpected because of this.

Also, I have an older backup of the website, and the search by text works fine on it. In the meantime we exported and imported products etc. Maybe DB/tables encoding was changed during this process.

 

Regards,
Damir

 

Hello Damir

 Maybe it's behaving unexpected because of this. - it cannot affect such a problem

Unfortunately I have no more ideas

Yeah, I understand.

Thank you very much for your willing to help!

Welcome;)

Hi Pablo,

 

Just wanted to give it another try.

I have two versions of the website locally - working (old) and non-working one.
I noticed apostrophes are saved in different way in these two databases:

Working (old site, my local installation):

Not working (live site):

 

Does this maybe can help you?

When I use the old database on the current live site, the issue with apostrophe is gone.

Keep in mind our"search by text" is configured to search only through"excerpt" field.

Another thing Pablo - we agreed with client that we will create a staging / testing environment for you to take a look at this.

Can you please confirm you are still willing to take a look, so we can start creating it?

 

Thank you!

12