Support-Forum

jDownloads for Joomla 3.x => jDownloads 3.9 => Bugs => Topic started by: mmerrell on 14.06.2021 14:21:16

Title: Warning: Attempt to read property "id"null any Category page [fixed in 3.9.8]
Post by: mmerrell on 14.06.2021 14:21:16
Hello,

Fresh install on Joomla 3.9.27, Maria DB 10.4.17, PHP 8.0.2.  Each Category displays the following error:

Warning: Attempt to read property "id" on null in C:\xampp\apps\joomla\htdocs\components\com_jdownloads\views\category\view.html.php on line 326

Thought maybe it was something to do with the defaul Uncategorized menu, but I get the same error on a category that I made.  This error does not appear in the download links or in the overview, only at the Category view.

Install log reports no errors.
Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: ColinM on 15.06.2021 11:03:18
Hi
Have you created a ajD menu item "list All Categories"? Noticed you are running on XAMPP - I use this a lot for my test sites Normally this is a location such as C:\xampp\htdocs\jdx391\ where in this case jdx391 is the location of Joomla!You have C:\xampp\apps\joomla\htdocs\components\should it be something like C:\xampp\htdocs\apps\joomla\components\  ?
Colin
Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: mmerrell on 15.06.2021 16:35:13
Yup, followed the instructions to create the default category.  I even deleted the menu item and recreated it with the same result

This is the bit of code referenced:

while (($menu->query['option'] != 'com_jdownloads' || $menu->query['view'] == 'download' || $id != $category->id) && $category->id > 1){
            $path[] = array('title' => $category->title, 'link' => JdownloadsHelperRoute::getCategoryRoute($category->id, true));
            $category = $category->getParent();

Attached pictures of the setup and the error in action.

Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: ColinM on 15.06.2021 18:01:03
Hi
Still concerned about the localhost address C:\xampp\apps\joomla\htdocs\components\   :(
jD does require access to various Joomla! servicesIn jD Options 'Path Settings' tab what are the contents of option 'Upload directory path'  ?

Similarly in Joomla! Global Configuration -System tab what are the contents of 'Path to Log Folder' option?
Colin
Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: mmerrell on 15.06.2021 18:30:11
Upload director path = C://xampp//apps//joomla//htdocs//jdownloads
(I tried changing it to C:/xampp/apps/joomla/htdocs/jdownloads) - everything still works after the change.

Log folder is here:  C:/xampp/apps/joomla/logs
(I do see the jdownloads install log file and joomla log file)

I am able to upload / add files without issue.  They download perfectly as well.  So core functions are working, just have the error. 

That error ONLY appears under a Category page.  It never appears any other time (not on overall categories page, not on download pages).
Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: Arno on 16.06.2021 12:20:18
Hi,
please try the (unzipped) attached file. Copy it to \components\com_jdownloads\views\category\
Try it then again and post here your result. Thanks.
Title: Re: Warning: Attempt to read property "id" on null on any Category page
Post by: mmerrell on 16.06.2021 16:08:09
Thank you so very much! 

Replacing the file with the one you attached completely resolved the error.  All other functions appear to be working normally (I uploaded files, downloaded files, and created a category without issue)!

I appreciate your assistance so very much!

Merrell