Hi Jan
I am using a very large number of categories. I know there is a "fill out yourself" filter but it would be very useful ( and quicker ) to have a filter with a drop down filtering menu like Joomla has for articles etc. ie giving access to the category tree. Unless there is a tool for doing this and I cannot see it.
many thanks
Wayne
Filtering in the back end
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filtering in the back end
Hi, I don't understand correctly what you mean. Which view you mean?
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 11
- Joined: 19 Apr 2009, 08:44
Re: Filtering in the back end
It's in the "Phoca Gallery Categories ". It would be useful to filter by parent categories and different sub category levels below them via a drop down, similar to the filter on the "Phoca Gallery Images ".
I have fifty or so categories but most are sub categories and sub sub categories even sub sub sub categories.
I know there is a filter input field but some categories are very long to type in.
eg On the Land>>2010 Rodeo championship>>Bull Riding Finals 20.10.2010
I hope you see what i mean ?
I's not a big issue and I might seem a bit lazy but it would help with workflow.
Many thanks
Wayne
I have fifty or so categories but most are sub categories and sub sub categories even sub sub sub categories.
I know there is a filter input field but some categories are very long to type in.
eg On the Land>>2010 Rodeo championship>>Bull Riding Finals 20.10.2010
I hope you see what i mean ?
I's not a big issue and I might seem a bit lazy but it would help with workflow.
Many thanks
Wayne
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filtering in the back end
Hi, there was the select box for displaying only specific category, the problem is, categories are stored in tree, so there were some unexpected problems with this filtering and it produces outcomes which can be confusing for users, this is why it was removed from there. So I think this needs to be customized to fit exactly your needs
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 13
- Joined: 17 Sep 2010, 11:09
Re: Filtering in the back end
I noticed when a filter word is given, the SQL actually returned the correct dataset but in the function _categoryTree, those dataset is eliminated. Instead of trying to play around the recursive function _categoryTree, I let the SQL to retrieve all categories regardless of the filter word and looping through the array to filter base on the filter word.
Below is my code changes:
Phoca Gallery version 2.7.4
File: \Joomla\administrator\components\com_phocagallery\models\phocagallerycs.php
add the function filterArray inside the phocagallerycs.php
Below is my code changes:
Phoca Gallery version 2.7.4
File: \Joomla\administrator\components\com_phocagallery\models\phocagallerycs.php
Code: Select all
function _buildContentWhere() {
blah blah
//~ we want to retrieve all datas then later filter the element by $search using code
//~ if ($search) {
//~ $where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%');
//~ }
if ( $filter_state ) {
Code: Select all
function getData() {
global $mainframe;
if (empty($this->_data)) {
blah blah
$this->_data = $this->_categoryTree($this->_data, $tree, 0, $text, -1);
//added begin
$search= $mainframe->getUserStateFromRequest( $this->_context.'.search', 'search', '', 'string' );
$search= JString::strtolower( $search );
//filter the result with $search text
$this->_data = $this->filterArray($this->_data, $search);
//added end
return $this->_data;
Code: Select all
//~ return a copy of $collection which is filtered by $filterText
function filterArray($collection, $filterText) {
if ($filterText=='') {
return $collection;
}
foreach($collection as $key=>$value){
if (stripos($value->title, $filterText)===FALSE)
unset($collection[$key]);
}
return $collection;
}
Last edited by dethisandthat on 11 Jun 2011, 00:10, edited 1 time in total.
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filtering in the back end
Hi, thank you for this guide, I will take a look at it.
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 1
- Joined: 01 Oct 2013, 12:31
Re: Filtering in the back end
Have a situation with more than 700 categories and search function was important.
Thanks, dethisandthat. Made some updates in code for version 3.2.6 and Search filter became to work for categories with any level.
Thanks, dethisandthat. Made some updates in code for version 3.2.6 and Search filter became to work for categories with any level.
- Jan
- Phoca Hero
- Posts: 48416
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Filtering in the back end
Ok, will be great to get info about the changes.
Jan
Jan
If you find Phoca extensions useful, please support the project