Category filter

Search
Other Bug Reports questions
Forum

Category filter - "Current" option in Articles Field

Filip Jovic's Avatar Filip Jovic
Hi Peter,
not sure if this is bug, but it throws an error in Joomla dashboard, so people may be confused...
Recently I needed category filter option "Current", which is great and obvious. I use free version. I checked, you stated that category filter is available there. Anyway, it may be your decision to offer this option in PRO version only, but since it's selectable one might click on it and activate it. Then it throws error since getCurrentCategoryId() from Filters.php actually does not work anything.

I was able to put code needed there myself, but most users will get error... You might either make definition for this function or disable "Current" option in category filter. In my opinion it would be better to have it fully in code for free version, since it's rarely used, but completes the category filtering you offered in free version.

Also, you always had extensions that offer so much even in free versions, so I thank you for the 100th time for that! Great development. Whatever you decide - it's thumbs up from me! Cheers!
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Filip Jovic's Avatar Filip Jovic
Tried it, works like a charm!
Thank you, Peter!
Peter van Westen's Avatar Peter van Westen ADMIN
Ok, great 🙂
The fix will be included in the next release.
Please post a rating at the Joomla! Extensions Directory
Filip Jovic's Avatar Filip Jovic
Hi Peter,
I am sorry, but I was not quite right when I said it works! I made mistake by testing it only on already saved articles! When you edit an existing article, changing category filters articles field list to current, i.e. to articles of the category that you choose, but when you are CREATING NEW article, list is not filtered before you hit Save / Save and Close, it's empty no matter what category you choose. So "current" filter now works better, but I suppose it reacts only if $isNew is false. Did not dig around yet, I hope (know) you have quick idea about how to fix it in no time.

Sorry about misinforming you.
Cheers, thank you!

*EDIT: this lines in Filters.php, from getCurrentCategoryId()

if ( ! $id)
{
return 0;
}

I don't think it's necessary, if article is new, it'll filter category ID from category field in form, article id is 0. If it's not new, it'll return some value and then catid comes from database query, right? So just deleting that IF statement above solves this. I hope I'm right, this works as expected.

it keeps it in return 0 forever if article is new.
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases
Please post a rating at the Joomla! Extensions Directory
Filip Jovic's Avatar Filip Jovic
Yes, problem I noticed is solved by this version. I tested on both "edit-existing" and "add-new" article tasks. Change of category now reflects articles to be filtered to exactly that category if CURRENT category filter is selected for your plugin.
Thank you very much for responding so promptly again, Peter!
You can only post on this forum if you log in