New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix backend articles manager not listing articles in sub-categories when categories filter is active #18179
Conversation
…hen categories filter has only 1 category
i don't think this fix is correct |
Even if this is perhaps just a side effect of the multi-select funtion, so I find that now better so. I have previously missed seeing only the articles of a category without subcategories. If you want to see the articles of the subcategories too, then better by selecting it additional. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
The fix is very correct in terms that it restores the old and expected behaviour
it is very bad UX to select a category and not be able list articles in sub-categories In my own extension i have implemented also listing records in sub-categories even when selecting multiple categories (combining the max-level filter) |
To restore the old behavior, this patch is correct. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
@ggppdk in your own extensions you are free to do whatever you want, |
What you describe about multiple categories, Doing what you ask is possible but e.g. @alikon believes otherwise only the specific categories should be listed and also the max-levels filter in single category starts at the level of the category
|
This is bug fix of previous / expected behaviour, Also i do not care so much for this PR, |
We have a UX team - why not let them make the decision? |
👍 |
Sure, how to behave with single category selected ?
how to behave with multiple category selected ?
|
Not really in favour of that. |
Imho items from subcategories have to be shown when there is no level filter set. That is the old behavior and thus the expected one. Doesn't matter if one category is selected or multiple. The behavior has to be the same. |
In my opinion, with the multi-selective of the categories, the level filter field has become obsolete. For me personally this bug is welcome. Finally, ONLY the items appearing in the selected category are displayed. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
I have tested this item ✅ successfully on 92d7844 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
We discovered this bug too. Today a client and myself was wondering about the new "feature" or the bug. My client called me and asked me, where to find his articles, listed in sub categories of a higher category. I said him, he should use the filter field "max level filter". He did. But couldn't find the expected articles. Why? I tested it, and must agree to him: this filter has broken! I agree with Bakuals posting. Irrespective of the multi category filter mode, the "max level filter" should work like before. This is very important! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
Ok fixed previous behaviour for multiple categories too now we will have J3.7.x behaviour in case of filtering by multiple categories Fixed the max level filter is usage too, |
|
||
$baselevel = 1; | ||
$subcat_items_where = array(); | ||
foreach($categoryId as $filter_catid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space after foreach
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the review
: $baselevel; | ||
$subcat_items_where[] = '(c.lft >= ' . (int) $categoryTable->lft . ' AND c.rgt <= ' . (int) $categoryTable->rgt . ')'; | ||
} | ||
$query->where(implode($subcat_items_where, ' OR ')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameters are reversed. It should be: $query->where(implode(' OR ', $subcat_items_where));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implode accepts them in this order too (historical reasons),
but yes better to place them as official function signature
My test:
Note: I can't change the order of the root categories in the filter. I guess the order depends on their id.
|
thanks for review, testing |
I have tested this item 🔴 unsuccessfully on d1abe63 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
I think you have missed reading a part of the description what you got was the expected / intended behaviour according to the above description
|
I have tested this item ✅ successfully on d1abe63 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
the alternative is to create 1 join to the categories DB table per category selected in the category filter if you would want this, i could do |
Another option to make this consistent is always use depth from top |
You maybe right.
|
yes i agree it can be confusing, re-thinking of it , i think , maybe it is possible to do without extra joins |
done , now the (max) level filter is applied to every category individually |
Also i found a bug in categories manager linking to article manager with wrong level filter, i will make a different PR |
I have tested this item ✅ successfully on fc7803e root + sub1sub1 [ level: 2 ] => 11 hits sub1sub1 [ level: 2 ] => 23 hits root + sub1sub1 [ level: 2 ] && sub1sub1 [ level: 2 ] => 34 hits - identical to single filtering GREAT! THANK YOU AGAIN FOR YOUR EFFORTS!!! This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
@infograf768 can you please retest? |
I have tested this item ✅ successfully on fc7803e This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
{ | ||
$categoryId = ArrayHelper::toInteger($categoryId); | ||
$query->where('a.catid IN (' . implode(',', ArrayHelper::toInteger($categoryId)) . ')'); | ||
$categoryTable = JTable::getInstance('Category', 'JTable'); | ||
$subcat_items_where = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable should be camel case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@mbabker |
I thought this fix was included in Joomla 3.8.2 but the feature still doesn't seem to be fixed This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
@bobr666 can you please open a new issue with that thing that don't work for you (please explain with as mach as possible detail) so we can keep track on open issues. Thanks! |
I only noticed this on a site we just updated to 3.8.6 and seem the problem still persists? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
This was a fix for the DB model of the backend articles manager, |
Sorry, I misread this, I'll test further & start a new issue, as think this is a bug. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18179. |
Pull Request for Issue #18178
Summary of Changes
Listing articles in sub-categories when categories filter is active is no longer working
This quite a big annoyance for people that need it,
Bug was introduced when category filter in articles manager was converted to multi-value
This PR fixes
Testing Instructions
In a Joomla installation that e.g. has testing articles
filter by category "Joomla" and you will notice that only 11 articles are shown , those that belong to category "Joomla"
also please test with
Expected result
Those that belong to subcategories should also be listed (when max level filter is not set)
Actual result
Those that belong to subcategories are not listed (despite max level filter not set)
Documentation Changes Required
None