No Code Attached Yet bug
avatar AndySDH
AndySDH
8 Nov 2017

POST UPDATED TO JOOMLA 5

Steps to reproduce the issue

  • Have a category with many articles (hundreds? the more the better to see the performance impact. for this example I'll use a random number of 432 articles)
  • Create a Category Blog Menu Item of that category, but in "Blog Layout" options set 0 articles to display in all four inputs.
  • Visit this menu item in the frontend.

Expected result

I would expect the page to load super fast because there is no article data to load whatsoever.

Actual result

The loading is VERY SLOW, taking dozens of seconds, if not minutes, depending on the amount of articles and content within those articles. Why? Because Joomla is loading in the background the data from ALL those 432 articles as if they were all displayed at the same time in that one page with no pagination, despite the fact you're actually displaying 0!

Additional comments

Still happening as of Joomla 5

Additional comments

To top it off, obviously, if in the options you put to only display "1" article, of course it loads super fast because it only loads 1 article, correctly. You put "20" articles? It displays quite fast because it only loads 20 articles, correctly. You put "0" articles? It loads incredibly slow because it loads all 432 articles in the background (and then showing 0 at the end of the loading). This can't be intended behavior.

In an old comment, someone suggested to put "-1" instead of "0" articles in the Menu options to work around the problem, and while it worked before, now in Joomla 5 it's no longer possible because it's impossible to save a menu item with a "-1" as the value. So now there is not even a workaround anymore.

PS: You may ask, why would you want to input 0 articles in the first place? Well, it could be useful for cases when you might want to only display the description of the category, or if you want to display the articles via other means (content plugins or modules) and you don't want to display them natively. Plus, the use case shouldn't even matter, it's just a wrong/flawed behavior regardless.

avatar AndySDH AndySDH - open - 8 Nov 2017
avatar joomla-cms-bot joomla-cms-bot - change - 8 Nov 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Nov 2017
avatar AndySDH AndySDH - change - 8 Nov 2017
The description was changed
avatar AndySDH AndySDH - edited - 8 Nov 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Nov 2017
Category com_content Feature Request
avatar csthomas
csthomas - comment - 8 Nov 2017

Because $limit = 0 usual means no limit there is hard to change it in J3.x.

It can help only in the blog:

diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php
index 50c66d0efa..a4f4128daa 100644
--- a/components/com_content/models/category.php
+++ b/components/com_content/models/category.php
@@ -190,6 +190,13 @@ class ContentModelCategory extends JModelList
                if (($app->input->get('layout') === 'blog') || $params->get('layout_type') === 'blog')
                {
                        $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links');
+
+                       if ($limit === 0)
+                       {
+                               // We want 0 articles but 0 means no limit
+                               $limit = -1;
+                       }
+
                        $this->setState('list.links', $params->get('num_links'));
                }
                else
avatar franz-wohlkoenig franz-wohlkoenig - change - 8 Nov 2017
Status New Discussion
avatar ggppdk
ggppdk - comment - 8 Nov 2017

@csthomas

So you are saying that limit zero for DB model

  • means 'retrieve all'

but then

  • some com_content layouts will show zero items (blog layout)
  • and all other layots will show all of them

Since the category DB model already has special handling for blog layout as you are showing above
I think your fix suggestion is valid

avatar csthomas
csthomas - comment - 8 Nov 2017

If this is OK then I will make PR when I have more time.

avatar AndySDH
AndySDH - comment - 8 Nov 2017

That sounds like a good fix, simple and effective :)

avatar csthomas
csthomas - comment - 10 Nov 2017

The fix is not complete because there is a second query SELECT COUNT(*)..., which still is executed.

avatar AndySDH AndySDH - change - 10 Nov 2017
The description was changed
avatar AndySDH AndySDH - edited - 10 Nov 2017
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar jwaisner
jwaisner - comment - 11 Mar 2020

@AndySDH Can you confirm this issue still exists in J3?

avatar jwaisner jwaisner - change - 11 Mar 2020
Status Discussion Information Required
avatar jwaisner jwaisner - change - 11 Mar 2020
Category com_content Feature Request com_content
avatar AndySDH
AndySDH - comment - 11 Mar 2020

Yup still an issue

avatar jwaisner jwaisner - change - 11 Mar 2020
Status Information Required Confirmed
avatar rdeutz rdeutz - change - 9 Mar 2021
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2021-03-09 20:38:23
Closed_By rdeutz
avatar rdeutz rdeutz - close - 9 Mar 2021
avatar rdeutz
rdeutz - comment - 9 Mar 2021

Closing this because it is expected behaviour.

To be a bit more specific: A value of 0 means no limit. A Category Blog Menu Item is for displaying articles of a category. If you want to show only the category description you can create a special view by copy the view to your template and remove the showing of articles.

avatar AndySDH
AndySDH - comment - 9 Mar 2021

@rdeutz Sorry but that's stupid. If 0 meant no limit, then entering 0 would show all articles. But it doesn't.

Instead, entering 0 shows 0 articles. While still loading all their data in the background as if it was showing all.

It should be either one way (show 0 articles, load 0 data), or the other (show & load all articles)

Currently it's inconsistent and a mess

avatar trananhmanh89
trananhmanh89 - comment - 10 Mar 2021

#32612 new way to get this issue.

It happends on my site. I'm using com_content to store articles, but doesn't use it to display. If someone know this issue, he can easily break my site. So i have to block access to com_content.

So annoying.

avatar rdeutz
rdeutz - comment - 10 Mar 2021

For me it is a missuse of the Category Blog for something that it is not made for. But I am open to look at a PR so that we can check what the side effects are.

avatar AndySDH
AndySDH - comment - 10 Mar 2021

@rdeutz

For me it is a missuse of the Category Blog for something that it is not made for.

Maybe, but then it should be made consistent when you enter the '0' value. Right now it's not even consistent, as explained in my previous post and opening post.

But I am open to look at a PR so that we can check what the side effects are.

Then maybe don't go around closing tickets on your own volition? :) Otherwise, a PR will never be made.

avatar rdeutz
rdeutz - comment - 10 Mar 2021

Like it or like it not, it's my job to make decisions on issues. PRs can be made without an issue, but seems it is not so important, even in 4 years we haven't seen a PR.

avatar AndySDH
AndySDH - comment - 10 Mar 2021

PRs can be made without an issue

Nobody will make a PR if there's no issue opened for it.

avatar rdeutz
rdeutz - comment - 10 Mar 2021

Nobody will make a PR if there's no issue opened for it.

Maybe, same as the last 4 years.

avatar rdeutz rdeutz - change - 10 Mar 2021
Labels Removed: J3 Issue
avatar rdeutz rdeutz - unlabeled - 10 Mar 2021
avatar joomdonation
joomdonation - comment - 10 Mar 2021

PR here #32626 . But it is an backward incompatible change, so I don't think it will be accepted :) .

avatar AndySDH
AndySDH - comment - 16 Oct 2023

@joomdonation Why is this issue and PR closed? This is still an issue in Joomla 4 and 5...

avatar richard67
richard67 - comment - 16 Oct 2023

Reopening as the pull request has been closed.

avatar richard67 richard67 - change - 16 Oct 2023
Status Closed New
Closed_Date 2021-03-09 20:38:23
Closed_By rdeutz
Labels Added: No Code Attached Yet
Removed: ?
avatar richard67 richard67 - reopen - 16 Oct 2023
avatar AndySDH AndySDH - change - 16 Oct 2023
The description was changed
avatar AndySDH AndySDH - edited - 16 Oct 2023
avatar Hackwar Hackwar - change - 27 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 27 Mar 2024
avatar AndySDH AndySDH - change - 27 Feb 2025
The description was changed
avatar AndySDH AndySDH - edited - 27 Feb 2025
avatar AndySDH AndySDH - change - 27 Feb 2025
Title
All articles data is loaded in Category Menu when 0 articles are set to be displayed - performance impact
[J5] All articles data is loaded in Category Menu when 0 articles are set to be displayed - performance impact
avatar AndySDH AndySDH - edited - 27 Feb 2025
avatar AndySDH
AndySDH - comment - 27 Feb 2025

I updated this post because, after 8 years, this issue is still affecting my sites' performance in Joomla 5. I plead for this issue to be addressed guys.

Add a Comment

Login with GitHub to post a comment