You are here:  » No Search Results

Support Forum



No Search Results

Submitted by Jejos on Mon, 2019-01-21 11:13 in

Hi,

I've successfully installed PT for Wordpress but the search function is not displaying anything - not even the "No Results" message. I tried doing a keyword search in both PT search widget, and the search form from /shopping/ ({link saved}) but the result is the same.

Everything functions normally except for search. I can view the merchant, brand, and category pages just fine. See links below:

{links saved}

One more thing, is it possible to use WP search widget/form and still show PT results (virtual)?

Submitted by support on Mon, 2019-01-21 11:51

Hello Jejos,

That's strange - it appears as if the GET variables (pto_q in this case) are not being loaded into the global scope by WordPress. Please can you try the following edit of the plugin file pto.php - look for the following code at line 500:

  $pto_q = (isset($pto_q)?pto_common_normalise($pto_q,":\.\/"):"");

...and REPLACE with:

  $pto_q = (isset($_GET["pto_q"])?pto_common_normalise($_GET["pto_q"],":\.\/"):"");

If that does the trick, can you confirm what WordPress version you are using and I'll check it out further on my test server against that version.

Regarding integration of WordPress search with virtual product results, a number of people have asked about this - it's not totally straight forward as a result of how WordPress performs the search and presents the results (by default search outputs as a normal post index e.g. search posts by category) but I am experimenting with this in development...

Cheers,
David.
--
PriceTapestry.com

Submitted by Jejos on Mon, 2019-01-21 15:05

Hi David,

Replaced the code at line 500 but the result is the same. I'm using WP 5.0.3.

Could it be server-related? We're using nginx instead of Apache and just tried this fix when the permalinks are showing 404 error (or /shopping/ in this case). Here's the fix we used on our server: https://www.digitalocean.com/community/questions/404-when-using-pretty-permalinks-on-new-wordpress-site-on-lemp-nginx

Also, I initially did a test using imported (everything is working) , then I switched back to virtual. Not sure if this is the cause.

Regards,
Jejos

Submitted by support on Tue, 2019-01-22 08:01

Hi Jejos,

Could you perhaps try creating a couple of test WordPress posts just containing a bit of text, and then try the built-in WordPress search to find the posts as it relies on query string parameters also (?s=...)

Thanks,
David.
--
PriceTapestry.com

Submitted by Jejos on Tue, 2019-01-22 08:21

Hi David,

Done. It returns post results in the search results page. See here: {link saved}

Jejos

Submitted by support on Tue, 2019-01-22 09:15

Thanks Jejos, I'll follow up by email.

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Thu, 2019-01-24 20:41

Hi David,

It seems I have the same problem with WordPress 5.03. Also the pto shortcode with a search query is not working. This is the search page: {link saved}

Is there something I should update?

Cheers, Ivo

Submitted by support on Fri, 2019-01-25 08:13

Hello Ivo,

The issue above was specific to Nginx which the user has resolved, and I see that your search page is now working so you have may have resolved your issue but if still having problems using the shortcodes let me know and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by ivohofland on Fri, 2019-01-25 08:33

Ah ok. I was indeed able to solve it myself by looking into the error log and replacing the following code on pto_common.php on line 20

//$text = preg_replace('/[^A-Za-z0-9'.$allow.' ]/e','',$text);
$text = preg_replace('/[^A-Za-z0-9'.$allow.' \.]/','',$text);

Submitted by support on Fri, 2019-01-25 08:40

Hello Ivo,

Ah yes - that would imply you are running version 2 as that's a PHP 7 deprecation - the /e modifier (deprecated in PHP 7) is not in version 3.

Cheers,
David.
--
PriceTapestry.com