Keyword

Hiding K2 Categories from Joomla Search

  • Jeff Chastain
  • Jeff Chastain's Avatar Topic Author
  • Offline
  • New Member
More
12 years 8 months ago #61394 by Jeff Chastain
Hiding K2 Categories from Joomla Search was created by Jeff Chastain
I am playing around with creating a "hidden" K2 category that uses the base site template, content, etc. but is only called from a different url for use in a Facebook iFrame. So far, it is working out quite well with one exception - the base Joomla search is returning results from this K2 category.

In searching, I found the following plug / override for the Joomla search to exclude sections and categories. However, it only works for base Joomla categories, not K2 categories.

www.toolboxcreations.com/articles/development/71-article-search-with-exclusions-plug-in-for-joomla-15

In tracing the code, it appears that the onSearch function in the /plugins/search/k2.php file is what is being called somehow by the Joomla search to get the K2 matches. This is about the limit to my tracing ability though, so has there been any attempt before to exclude certain K2 categories from the Joomla search? So far Google is not giving me any pointers.

Thanks!

Please Log in or Create an account to join the conversation.

  • Concerto Designs Inc.
  • Concerto Designs Inc.'s Avatar
  • Offline
  • Junior Member
More
12 years 3 months ago #61395 by Concerto Designs Inc.
Replied by Concerto Designs Inc. on topic Re: Hiding K2 Categories from Joomla Search
This has been a longstanding challenge for me - I found a solution by adding this line of code to line 56 of the Acesearch K2 plugin (commercial extensions) :
adminisrtator/components/com_acesearch/extensions/com_k2.php

Go to line 53 where you will see the following code:

if ($this->site) {
$where[] = 'a.published = 1';
$where[] = 'a.trash = 0';

Now add this code immediately below:

$where[] = 'NOT a.catid = yourCatidGoesHere';

Took some trial and error - with Acesearch caching, ymmv...
Hope this helps -
Alan

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum