Listit2 get row if field not empty [solved]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
HarmO
Power Poster
Power Poster
Posts: 251
Joined: Thu Jan 26, 2012 3:22 pm
Location: Belgium

Listit2 get row if field not empty [solved]

Post by HarmO »

hi,

i'm looking if it is possible to use the search_* function, that ships with the LISTIT2 module, in such a way that i can look for rows where a certain field is not empty.

For example:
i have a LISTIT2 inctance which is a list of products, each product has a non mandatory field for the upload of a technical sheet.

Can i then get only the products that have technical sheets whith the module tag OR do i need the create a if statement in my template?

the disadvantage of the if state ment is that if there are products, but none with the technical sheet, the template loop will be run anyway.

I tried this code but it returns an error

Code: Select all

{ListIt2products search_dop!=""}
I tried this code but it returns no items at all

Code: Select all

{ListIt2products search_dop="*"}
Kind regards
Last edited by HarmO on Tue Apr 14, 2015 7:57 am, edited 1 time in total.
Kind regards,
HarmO
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: Listit2 get row if field not empty

Post by psy »

Get all items from your search filter but only output those you need, eg:

Code: Select all

{foreach from=$items item=item}
  {if $item->fielddefs->myfield->value != ''}
    ... do your output...
  {/if}
{/foreach}
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Listit2 get row if field not empty

Post by velden »

I did have a look at the code/query and it doesn't use the 'like' operator. This means you cannot search for an 'is not empty' value by default.

psy's solution seems the best you can get (though not efficient).
HarmO
Power Poster
Power Poster
Posts: 251
Joined: Thu Jan 26, 2012 3:22 pm
Location: Belgium

Re: Listit2 get row if field not empty

Post by HarmO »

Thanks Psy & velden, that is what i tought, but i had hoped there was a more efficient way.

Posted a feature request for this: http://dev.cmsmadesimple.org/feature_request/view/10494

and i'll keep my fingers crossed... ;-)
Kind regards,
HarmO
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Listit2 get row if field not empty [solved]

Post by velden »

I wouldn't hold my breath.... ListIt2 isn't under active development anymore.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Listit2 get row if field not empty [solved]

Post by staartmees »

ListIt2 has discontinued, EasyList is a fork of it
http://dev.cmsmadesimple.org/projects/easylist
HarmO
Power Poster
Power Poster
Posts: 251
Joined: Thu Jan 26, 2012 3:22 pm
Location: Belgium

Re: Listit2 get row if field not empty [solved]

Post by HarmO »

Ok, great news. will check Easylist.
Kind regards,
HarmO
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Listit2 get row if field not empty [solved]

Post by staartmees »

EasyList is only for CMSMS 2.0, for CMSMS 1.12 you still have to use ListIt2
HarmO
Power Poster
Power Poster
Posts: 251
Joined: Thu Jan 26, 2012 3:22 pm
Location: Belgium

Re: Listit2 get row if field not empty [solved]

Post by HarmO »

staartmees wrote:EasyList is only for CMSMS 2.0, for CMSMS 1.12 you still have to use ListIt2
ListIT2 does not seem to work on every install of CMSMS 1.12.
So for now, no List module .... till CMSMS 2.0 gets out?
Kind regards,
HarmO
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Listit2 get row if field not empty [solved]

Post by staartmees »

Post Reply

Return to “Modules/Add-Ons”