Exclude keyword from search results

Hi,

I need to exclude a brand name of products from the CMS search results without deleting the actual pages. I only need to exclude the name of the brand. Does anyone know how this can be accomplished or what the code it I need to add?

Re: [waterdancer] Exclude keyword from search results

By Dave - August 19, 2011

Maybe with a where option?

'where' => " brand != 'xerox' ",
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Exclude keyword from search results

Hi Dave,

Where exactly do I place that code? Is this the exact code I use? 'where' => " brand != 'xerox' "; (change xerox to the name I need to exclude)

I know HTML, but not so much PHP.

Thank you.

Re: [waterdancer] Exclude keyword from search results

By Dave - August 20, 2011

Hi waterdancer,

Replace "brand" with the fieldname you use to store brands in, and "xerox" with the brand you want to exclude, and then add that line to your getRecords() code at the top of your viewer page.

Give that a try and if it doesn't work attach your viewer page with the "Upload Attachment" feature and I'll take a look at the code for you.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Exclude keyword from search results

Hi,

I don't have a viewer page. Are you talking about search-results.php?

Re: [waterdancer] Exclude keyword from search results

By Dave - August 21, 2011

Hi waterdancer,

Yes, we call the pages with the generated code "viewer pages", but search-results.php is likely it.

Any luck adding the code?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Exclude keyword from search results

Doesn't work. I receive a blank page with this: MySQL Error: Unknown column 'type' in 'where clause'

Re: [waterdancer] Exclude keyword from search results

By Dave - August 22, 2011

Can you attach your page with the "Upload Attachment" feature and I'll take a look at the code for you? Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Exclude keyword from search results

Hi Dave,

Let me know if you receive the upload. First time doing this in a forum.
Attachments:

search-results.php 8K