Some components such as jDownloads use their own Categories because they need to hold different information but they retain important fields in their database that are consistent with Joomla! categories. For example id, asset-id, parent-id, published and so on. In the jDownloads context the equivalent to an Article is a Download
The function getTagItemsQuery in TagsHelper.php is designed to see the if the Category which 'contains' the Article is published. If it is not published the tagged item does not appear. In the jDownloads context it is whether the jDownloads Category which 'contains' the Download is published.
Regrettably the getTagItemsQuery function makes an explicit reference to the Joomla! Articles Category table '#__categories' in line 599 or thereabouts which reads
// Join over categories for get only tags from published categories
->join('LEFT', '#__categories AS tc ON tc.id = c.core_catid')
It does not contemplate the possibility of other type of category playing a similar role.
As a result the tagged Download only gets listed if there is a published Article category with the same id !! This is obviously not the result intended.
We have tested all is OK otherwise by adding, _as a test measure only, extra lines as below
// Join over the jDownloads categories for get only jDownloads items with tags from published categories
->join('LEFT', '#__jdownloads_categories AS jtc ON jtc.id = c.core_catid')
These lines were added immediately following the other ->join('LEFT' line at or around line 599.
There appears no clean mechanism to inform the code about which 'category table' should be used. The most appropriate table for such information would possibly be the #__content_types table as that is created by the component on installation. Perhaps the 'field_mappings' field in the #__content_types table could be modified to include such a reference. Or perhaps another field could be added with a Null or zero entry if the type did not use containing categories, otherwise with the name of the relevant table to use.
In any eventuality the code in the getTagItemsQuery function will need to be modified if Joomla! is to fully support Extensions.
Because the problem line is in the middle of a very complex database query it seems to me to be challenging to find a generic working solution but I am sure there are some who can rise to the problem.
Requires installation of the jDownloads component. Create some Categories and Downloads in jDownloads. Ensure each jDownloads Category has one or more Downloads. Add one or more Tags to each Download (one is sufficient, which could be the same tag, to demonstrate. Note the ids of the jDownloads Categories.
Create a few Article Categories and compare the ids of these categories with those of the jDownloads Categories.
Use say Popular Tags module ot Menu Item List All Tags to show the tags. Those where there are no matching category ids will not show. You can control which tagged items appear by publishing/unpublishing Article categories! Publishing or unpublishing jDownloads Categories makes no difference, as would be expected with this bug.
The tagged Download is listed (using Popular Tags module is helpful)
the tagged Download is not listed
latest Joomla! and jDownloads
Priority | Urgent | ⇒ | Medium |
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-09 12:47:22 |
Closed_By | ⇒ | brianteeman |
There is no such thing as an articles category. The category table stores the categories for all components. Just look at the raw table and you will see that on a clean install it contains the categories for articles, contact, banners, newsfeeds and users
So from the sound of things jDownloads is not using the core categories table but using its own table and that is why you are facing these issues. As this is not a core issue I am closing it here and suggest that you contact the makers of jDownloads