News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Custom fields not loaded ($item->jcfields) - [Fixed in 4.0.25]

Started by michpaule, 13.04.2023 11:30:26

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

michpaule

Problem:
{jdfield_title ID} and {jdfield ID} always empty.

Tested on:
jDownloads Versions 3.9.8.7 and 4.0.24

See related report:
https://www.jdownloads.com/forum/index.php?topic=12898.0

Observation:
jcfields array always empty.
Example:
            // Insert the Joomla Fields data when used
            if (isset($items[$i]->jcfields) && count((array)$items[$i]->jcfields)){


Workaround:
Patch function getItems() in /components/com_jdownloads/src/Model/DownloadModel.php (or downloads.php for 3.9)
            // Get the tags
            $item->tags = new TagsHelper;
            $item->tags->getItemTags('com_jdownloads.download', $item->id);

            // Populate jcfields
            $item->jcfields = FieldsHelper::getFields('com_jdownloads.download', $item, true);
           
            // Build the multilingual association hints
            if ($item->params->get('show_associations')){
                $item->associations = AssociationHelper::displayAssociations($item->id);
            }           


@Arno: Could it really be the case that this problem has been in the code for so long?
Or did I miss something?

Best regards

Michael
  •  

Arno

Hi,
thanks for this bug report.

I have no idea why I had always overlooked this before. Sorry.
It's fixed now in jD 4.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •