Use setState filter in module

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
kairoen
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Mar 23, 2016 7:58 am

Use setState filter in module

Post by kairoen » Wed Nov 15, 2017 1:26 pm

I have extended the module mod_article_latest, and I was wondering if it possible to limited the output data to a specific item from "Custom fields"? I have made a radio button, and would like to view items for specific value in this radio button.

Let say I have 50 articles with value "1" from radiobutton (custom fields in a article), and I would only display these articles marked with either one of the value of the radiobutton.

User avatar
effrit
Joomla! Guru
Joomla! Guru
Posts: 846
Joined: Sun Nov 12, 2017 2:21 pm
Location: middle of Russia
Contact:

Re: Use setState filter in module

Post by effrit » Wed Nov 15, 2017 2:24 pm

i guess you can.
but its not about filtering output but filtering data picking from database (otherwise it can produce huge load).

you must modify msql query and gat only articles with have '1' in this table corresponding to article ID and radiofield ID.
_fields_values

i am personally not good enough in MySQL

kairoen
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Mar 23, 2016 7:58 am

Re: Use setState filter in module

Post by kairoen » Wed Nov 15, 2017 2:35 pm

I was thinking if it possible to set similar to:

Code: Select all

$model->setState('filter.featured', 'only');
But instead of "filter.featured" have another filter.
Like:

Code: Select all

$model->setState('filter.customfield', 'value');

User avatar
effrit
Joomla! Guru
Joomla! Guru
Posts: 846
Joined: Sun Nov 12, 2017 2:21 pm
Location: middle of Russia
Contact:

Re: Use setState filter in module

Post by effrit » Wed Nov 15, 2017 2:52 pm

i think you must just read about JOIN MySQL command and make fix as i mentioned before.
i doubt your examples will work because before use something you must made mechanism for it.

actually, i tried figured out how setState work and find local thread about 'can i use filter.created_by' (filtering articles by author) and answer was 'You must first make DB request' so seems its dead end.

kairoen
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Wed Mar 23, 2016 7:58 am

Re: Use setState filter in module

Post by kairoen » Wed Nov 15, 2017 2:56 pm

Yes, but the module doesn't use a query, so it is not easy to modify the code.
It seems that the module must be rewritten to make it work. Too bad, this feature would be a nice function to have in Joomla core.


Locked

Return to “Joomla! 3.x Coding”