? ? ? Success

User tests: Successful: Unsuccessful:

avatar tonypartridge
tonypartridge
22 Sep 2018

Pull Request for Issue #19101 .

Summary of Changes

Added Tag Parent filter in tags view.

Testing Instructions

Have nested tags, filter by parent all tags below should show. Also test max levels, parent tag should by level 1 and so on.

@richard67 @ggppdk @Septdir @rgblogs can we get some tests please :-)

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar tonypartridge tonypartridge - open - 22 Sep 2018
avatar tonypartridge tonypartridge - change - 22 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 22 Sep 2018
Category com_tags Administration Language & Strings
avatar tonypartridge tonypartridge - change - 22 Sep 2018
Labels Added: ? ?
avatar Septdir
Septdir - comment - 22 Sep 2018

I have tested this item successfully on 7cabf95

Works good.But I do not like how select looks
It is possible not to get out the name of the parent but just use it -
For example

Level 1
- Level 2
-- Level 3
- Level 2
Level 1

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.
avatar Septdir Septdir - test_item - 22 Sep 2018 - Tested successfully
avatar ggppdk
ggppdk - comment - 22 Sep 2018

This needs a little more work

  • the max levels filter is applied twice once according to parent menu item, and once according to top-most level

please remove the existing code of

		// Filter on the level.
		if ($level = $this->getState('filter.level'))
		{
			$query->where('a.level <= ' . (int) $level);
		}

and append it as an ELSEIF to the parent ID filter:

		if (!empty($parentId))
		{
				// ... this is correct
				// here the max level filter will be applied according to currently chosen parent id
		}

		// Filter on the level.
		elseif ($level = $this->getState('filter.level'))
		{
			$query->where('a.level <= ' . (int) $level);
		}
avatar tonypartridge
tonypartridge - comment - 22 Sep 2018

@ggppdk of course it does, thanks I've updated it now.

avatar tonypartridge
tonypartridge - comment - 26 Oct 2018

@Septdir @ggppdk would you be kind enough to test and let’s get this ticked off?

avatar Septdir
Septdir - comment - 26 Oct 2018

I have tested this item successfully on f37b10b

Test on Joomla! 3.9.0 RC 2

P.S Maybe the parent tag itself should also be displayed after filtering?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.

avatar Septdir Septdir - test_item - 26 Oct 2018 - Tested successfully
avatar rogercreagh
rogercreagh - comment - 12 Nov 2018

The filter field is using the type=tag. This will give a list of all tags, which is not helpful if you have a few hundred tags.
Selecting a tag which has no children as the parent filter is meaningless.
A better solution might be to only show tags that are parents in the filter dropdown.
eg:

<field
	name="parent_id"
	label="Parent"
	description="Select parent tag to filter by"
	onchange="this.form.submit();"
	default=""
	query="SELECT DISTINCT c.`parent_id`, p.id AS value, p.title AS parent, p.published 
        	FROM `#__tags` AS c 
		LEFT JOIN `#__tags` AS p ON c.`parent_id` = p.`id` 
		WHERE p.published
		ORDER BY p.lft"
	>
	<option value="">Select parent</option>
</field>

Obviously you need language strings for the Label, Description and Default value, but I think you have those.

Also I find it is very helpful to have the parent tag visible at the top of the list so I use

// Filter on the level.
if (($level = $this->getState('filter.level')) AND !($parent = $this->getState('filter.parent')))
// if we have set a parent then don't do the simple level filter
{
    $query->where('a.level <= ' . (int) $level);
}
// Filter on the parent.
if ($parent = $this->getState('filter.parent'))
{
    if (($level>1) AND ($lim = self::getPlftPrgt($parent))) { //if level is empty or 1 then only show the direct children 
        $query->where('a.lft BETWEEN '.$lim);
    } else {
        $query->where('a.parent_id = ' . (int) $parent. ' OR a.id = '.(int) $parent );
        //the OR ensures that the selected parent is show if level is not set
    }		   		    
}

where getPlftPrgt($parent) is a function to return the lft and rgt limits as a string eg "97 AND 101" rather than use a subquery

protected function getPlftPrgt($pid)
{
    $db1 = JFactory::getDBO();
    $qry = 'SELECT p.lft, p.rgt FROM #__tags AS p WHERE p.id = '.$pid;
    $db1->setQuery($qry);
    $ans = $db1->loadObject();	    
    if (!$db1->query()) {
    //    throw new Exception($db->getErrorMsg(), 500); //could provide a better error trap than simply ignoring it
        return false;
    }
    if (isset($ans->lft) && isset($ans->rgt)) {
       return $ans->lft.' AND '.$ans->rgt;
    }
    return false;
}

I implemented this on my sites a while back but never realised it was a feature request - sorry about that.
This version addresses the issue of the selector for the filter getting cumbersome if you have many tags and also ensures that the parent is always show at the top of the list


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.

avatar kofaysi
kofaysi - comment - 18 Jan 2019

I have tested this item successfully on f37b10b

J3.9.2

I think it works as stated and expected.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.

avatar kofaysi kofaysi - test_item - 18 Jan 2019 - Tested successfully
avatar viocassel
viocassel - comment - 3 Feb 2019

I have tested this item successfully on f37b10b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.

avatar viocassel viocassel - test_item - 3 Feb 2019 - Tested successfully
avatar Quy Quy - change - 3 Feb 2019
Status Pending Ready to Commit
avatar Quy
Quy - comment - 3 Feb 2019

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/22322.

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Category com_tags Administration Language & Strings Administration com_tags
avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Title
Feature - Added in tag parent id filter as per request in #19101
Feature - Added in tag parent id filter
avatar franz-wohlkoenig franz-wohlkoenig - edited - 11 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Title
Feature - Added in tag parent id filter as per request in #19101
Feature - Added in tag parent id filter
avatar joomla-cms-bot joomla-cms-bot - change - 11 Apr 2019
Category com_tags Administration com_tags Administration Language & Strings
avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Category com_tags Administration Language & Strings Administration com_tags
avatar HLeithner
HLeithner - comment - 5 Jun 2019

Because this PR is a new feature it can't be merged into 3.9, please create a new PR for Joomla! 4.

avatar HLeithner HLeithner - change - 5 Jun 2019
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2019-06-05 17:05:36
Closed_By HLeithner
avatar HLeithner HLeithner - close - 5 Jun 2019
avatar joomla-cms-bot joomla-cms-bot - change - 5 Jun 2019
Category com_tags Administration com_tags Administration Language & Strings
avatar tonypartridge
tonypartridge - comment - 5 Jun 2019

There will be 3.10 will there not?

On Wed, 5 Jun 2019 at 18:05, Harald Leithner notifications@github.com
wrote:

Because this PR is a new feature it can't be merged into 3.9, please
create a new PR for Joomla! 4.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/joomla/joomla-cms/pull/22322?email_source=notifications&email_token=AAKWBFTAJEZRHAKPGQSAIF3PY7W6PA5CNFSM4FWUW5B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXAL53Q#issuecomment-499171054,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAKWBFQQ2RE636OM4J2I5ITPY7W6PANCNFSM4FWUW5BQ
.

avatar HLeithner
HLeithner - comment - 6 Jun 2019

3.10 will not have new features. It's a compatibility version for upgrading to Joomla 4.0

avatar viocassel
viocassel - comment - 6 Jun 2019

?

Add a Comment

Login with GitHub to post a comment