-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 articles limit for category view #32626
Fix articles limit for category view #32626
Conversation
Thanks for the effort! Unfortunately, I tested this unsuccessfully. This results in this error when viewing a category with 0 articles displayed: 0 - Call to a member function getPagination() on null |
@AndySDH Will look at it later. |
@joomdonation should we return empty array at category model when or return empty array on |
I have to look at it again but I think it is working like that for category model at the moment
It is a backward-incompatible change, so we are not allowed to do that. Further more, in Joomla!, look like we want all records returned when no limit is set. |
I think we only need change line 251 of from to |
I don't think that's enough. It will cause no articles being displayed when access to a category from Articles - Categories module (with no menu items linked to categories or category view). Also, if we just change that, there are still unnecessary code executed ($model->setState commands) when we do not need to query database to get articles. I will try to review code carefully later. |
Correct me if i'm wrong. Your code is trying to resolve unlimited items on two cases: 1. Menu com_content, view=category and all settings are set to 0 item
2. You access com_content, view=category without any menu
// Set limit for query. If list, use parameter. If blog, add blog parameters for limit. |
I've found a mistake at my point. That you can change layout of category itself to But if category layout is |
Why was this PR closed, @joomdonation @Quy ? This is still an issue in Joomla 4. |
Pull Request for Issue #18529 and #32612 .
Summary of Changes
This PR proposes a solution to fix the two issues #18529 and #32612. Basically, it now will only load articles if limit > 0 (users want to display articles using the category layout)
See #18529 and #32612 to understand the actual issue. However, this PR has a backward incompatible change, so I'm unsure if it should be accepted (especially for staging).
Testing Instructions
Backward Incompatible Changes
Please note that there is a backward incompatible changes here then the site has no menu item to link to one of the three menu item types (basically, no suitable menu item could be found to link to a category)
For example, when you unpublish all menu items (keep home menu but links to a different component than com_content) and access to a category display in Articles - Categories. Before this PR, it will display all articles from that category, after this PR, only number of articles will be displayed (controlled by Default List Limit parameter in Global Configuration)