You are here:  » multiple item search in PTO shortcode?

Active Forum Topics


multiple item search in PTO shortcode?

Submitted by lowndsy on Thu, 2021-08-26 11:49 in

Afternoon chaps. I'm back after 10 years!

I am rebuilding a very old website that was built using PT php. The new one uses Wordpress and the PT plugin with PT on the same database.

It's selling printer ink so the new Wordpress site has 10,000 static pages (one for each printer), each of which contains the PTO search shortcode to display the correct cartridges.

I have it working using the printer name:
[pto search="Epson Stylus SX610FW"]

You can see it here: {link saved}

But it would be better if I could get it to use several values, like the old site did:

[pto search="Epson Stylus SX610FW,C13T07114011,C13T07114011"]

I have tried comma delimited, spaces and URL encoded with +. Is it possible to tweak how the search works a bit? Where would I look?

Thanks,
Steve

Submitted by support on Fri, 2021-08-27 08:41

Hi Steve,

Make sure that the checkbox alongside $config_useFullText is set to TRUE under the External section of the plugin settings (wp-admin > Settings > PriceTapestry.org) and then uses spaces in the query e.g.

[pto search="Epson Stylus SX610FW C13T07114011 C13T07114011"]

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by babrees on Wed, 2021-09-15 13:26

Hi David

What about if you have multiple 2 words?
ie bbq cover, barbecue cover, barbeque cover

Submitted by support on Thu, 2021-09-16 08:35

Hi,

In this scenario with "bbq" being below the FULLTEXT minimum word length the basic search would be triggered which uses logic AND by default - you _could_ change that to logic OR by editing pto_search.php and look for the following code at line 249:

        $where = implode(" AND ",$wheres);

...and REPLACE with:

        $where = implode(" OR ",$wheres);

However I think you mentioned elsewhere changing the FULLTEXT minimum word length to 3 in which case, if not already edit pto_search.php and look for the following code at line 177:

          if (strlen($word) <= 3 || in_array(strtolower($word),$pto_stopwords))

...and REPLACE with:

          if (strlen($word) <= 2 || in_array(strtolower($word),$pto_stopwords))

Cheers,
David.
--
PriceTapestry.com