Disable phoca search for some categories
-
- Phoca Enthusiast
- Posts: 75
- Joined: 13 Apr 2011, 16:28
Disable phoca search for some categories
i'd like to disable the search for some categories. How can i do this? Thanks for helping
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Disable phoca search for some categories
Hi, there is no such option, so this needs to be customized directly in the code:
plugins\search\phocagallery\phocagallery.php
Jan
plugins\search\phocagallery\phocagallery.php
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Enthusiast
- Posts: 75
- Joined: 13 Apr 2011, 16:28
Re: Disable phoca search for some categories
Hi Jan
can you give me a example to disable categories 10 and 16. Witch part of phocagallery.php i have to change?
Thanks a lot
can you give me a example to disable categories 10 and 16. Witch part of phocagallery.php i have to change?
Thanks a lot
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Disable phoca search for some categories
Hi, you need to change the SQL query so e.g. add:
$wheres2[] = ' (c.id <> 10 AND c.id <> 16)';
But will be different for different SQL commands there.
Jan
$wheres2[] = ' (c.id <> 10 AND c.id <> 16)';
But will be different for different SQL commands there.
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Enthusiast
- Posts: 75
- Joined: 13 Apr 2011, 16:28
Re: Disable phoca search for some categories
Thanks.
i was not able to bring in a workable version, i'm not fit on php and SQL.
But, when change the query line 177 to the categories that i want to search, is this a solution?
i mean not excluding, i mean including, search only in categories 1, 5, 15
Line 177 is
Can you make a example for searching in categories 1, 5 15?
Thanks a lot
i was not able to bring in a workable version, i'm not fit on php and SQL.
But, when change the query line 177 to the categories that i want to search, is this a solution?
i mean not excluding, i mean including, search only in categories 1, 5, 15
Line 177 is
Is this the right place?$query->from('#__phocagallery_categories AS a');
Can you make a example for searching in categories 1, 5 15?
Thanks a lot
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Disable phoca search for some categories
Hi, I didn't do such modification yet, so unfortunatelly I don't have any examples. But it is just standard SQL command, so you can include or exclude the categories, like you need "IN(1,5,15)" or "NOT IN(1,5,15)"
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Enthusiast
- Posts: 75
- Joined: 13 Apr 2011, 16:28
Re: Disable phoca search for some categories
Hi Jan
i tried but i was not able to get a working version.
Can you help me please? Just make a example include or exclude 2 categories, thanks
This is the part from original file from plugins\search\phocagallery\phocagallery.php
Thanks for helping
i tried but i was not able to get a working version.
Can you help me please? Just make a example include or exclude 2 categories, thanks
This is the part from original file from plugins\search\phocagallery\phocagallery.php
Thanks for helping
Code: Select all
// Categories
// - - - - - -
$query = $db->getQuery(true);
$query->select('a.id, a.title AS title, a.alias, a.date AS created, a.access, a.accessuserid, t.id as tagid, t.title as tagtitle, t.alias as tagalias,'
. ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug,'
. ' a.description AS text,'
. ' CONCAT_WS( " / ", '.$db->quote($section).', a.title ) AS section,'
. ' "2" AS browsernav');
$query->from('#__phocagallery_categories AS a');
//$query->innerJoin('#__categories AS c ON c.id = a.catid');
//$query->where('('.$where.')' . ' AND a.state in ('.implode(',',$state).') AND a.published = 1 AND a.approved = 1 AND a.access IN ('.$groups.')');
$query->leftJoin('#__phocagallery_tags_ref AS tr ON tr.imgid = a.id');
$query->leftJoin('#__phocagallery_tags AS t ON t.id = tr.tagid');
$query->where('('.$where.')' . ' AND a.published = 1 AND a.approved = 1 AND a.access IN ('.$groups.')');
$query->group('a.id');
$query->order($orderC);
// Filter by language
if ($app->isClient('site') && $app->getLanguageFilter()) {
$tag = JFactory::getLanguage()->getTag();
$query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
//$query->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
}
$db->setQuery( $query, 0, $limit );
$listCategories = $db->loadObjectList();
$limit -= count($listCategories);
if(isset($listCategories)) {
foreach($listCategories as $key => $value) {
// USER RIGHT - ACCESS - - - - - - - - - - -
$rightDisplay = 1;//default is set to 1 (all users can see the category)
if (!empty($value)) {
$rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $value->accessuserid, $value->access, $user->getAuthorisedViewLevels(), $user->get('id', 0), $display_access_category);
}
if ($rightDisplay == 0) {
unset($listCategories[$key]);
} else {
$listCategories[$key]->href = $link = JRoute::_(PhocaGalleryRoute::getCategoryRoute($value->id, $value->alias));
}
// - - - - - - - - - - - - - - - - - - - - -
}
}
$rows[] = $listCategories;
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Disable phoca search for some categories
Hi, to include or exclude some items in sql query, IN is used:
$wheres2[] = 'a.id IN(1,2)';// only 1 or 2 catid will be selected
$wheres2[] = 'a.id NOT IN (3,4)';// all excepct categories 3 and 4 will be selected
Jan
$wheres2[] = 'a.id IN(1,2)';// only 1 or 2 catid will be selected
$wheres2[] = 'a.id NOT IN (3,4)';// all excepct categories 3 and 4 will be selected
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Enthusiast
- Posts: 75
- Joined: 13 Apr 2011, 16:28
Re: Disable phoca search for some categories
Hi Jan
thanks.
whene i put
$wheres2[] = 'a.id NOT IN (16,17,21,22,23,24,25,26,27,28,29,30,31)';
on line 161, i get a empty picture from all excluded categories on top.
But i'm not able to get a working version. Tried to put it on various places in the file, no way found.
Do you have a working version to compare for me?
Thanks a lot
thanks.
whene i put
$wheres2[] = 'a.id NOT IN (16,17,21,22,23,24,25,26,27,28,29,30,31)';
on line 161, i get a empty picture from all excluded categories on top.
But i'm not able to get a working version. Tried to put it on various places in the file, no way found.
Do you have a working version to compare for me?
Thanks a lot
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Disable phoca search for some categories
Hi, unfortunately, I didn't do such modification yet, so all the advices are just advices without testing
Jan
Jan
If you find Phoca extensions useful, please support the project