You are here:  » search content fields


search content fields

Submitted by shaunmac on Wed, 2012-05-16 17:56 in

How can I search content fields? I would like to display my seeds but group each into female, and male. I have a content field for this but not sure how to group them together.

Submitted by support on Wed, 2012-05-16 18:28

Hi Shaun,

This is straight forward for a niche site where full text indexing isn't required; so the first step would be to disable that (at least within the plugin) by setting the $config_useFullText to FALSE (wp-admin > Settings > PriceTa[estry.org, then scroll down to the External section)

Next, in pto_search.php, look for the following code beginning at line 272:

if ($pto_config_searchDescription)
{
  $where .= " OR description LIKE '%".$wpdb->escape($word)."%'";
}

..and REPLACE with:

$where .= " OR gender LIKE '%".$wpdb->escape($word)."%'";
if ($pto_config_searchDescription)
{
  $where .= " OR description LIKE '%".$wpdb->escape($word)."%'";
}

Cheers,
David.
--
PriceTapestry.com

Submitted by shaunmac on Mon, 2012-05-28 15:28

The only file I found was search not pto_search is this the same file? Also in the search file I found

if ($config_searchDescription)
            {
              $where .= " OR description LIKE '%".database_safe($word)."%'";
            }

is this the text I need to change?

Submitted by support on Mon, 2012-05-28 15:49

Hi Shaun,

Ah, yes - that's standalone Price Tapestry, but you have identified the exact similar portion of code - (search.php standalone is equivalent to pto_search.php in the plugin) - so to include gender in the search, the replacement would be:

$where .= " OR gender LIKE '%".database_safe($word)."%'";
if ($config_searchDescription)
{
  $where .= " OR description LIKE '%".database_safe($word)."%'";
}

Cheers,
David.
--
PriceTapestry.com