Exclude keyword from search results
13 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: August 23, 2011 (RSS)
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
'where' => " brand != 'xerox' ",
interactivetools.com
Re: [Dave] Exclude keyword from search results
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
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!
interactivetools.com
Re: [Dave] Exclude keyword from search results
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
Yes, we call the pages with the generated code "viewer pages", but search-results.php is likely it.
Any luck adding the code?
interactivetools.com
Re: [Dave] Exclude keyword from search results
Re: [waterdancer] Exclude keyword from search results
By Dave - August 22, 2011
interactivetools.com
Re: [Dave] Exclude keyword from search results
Let me know if you receive the upload. First time doing this in a forum.
Re: [waterdancer] Exclude keyword from search results
By Jason - August 22, 2011
The code would look something like this:
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'perPage' => '10',
'where' => "brand != 'xerox'",
));
In this example, we are saying don't return any records from the products section that have "xerox" in their brand field. All you should need to do is replace "brand" with the name of the field where you are storing your brands, and "xerox" with the name of the brand you want to exclude.
Give this a try and let me know if you run into any problems.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/