Page 1 of 1

Listit2 get row if field not empty [solved]

Posted: Tue Mar 24, 2015 3:52 pm
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

Re: Listit2 get row if field not empty

Posted: Sat Apr 04, 2015 11:33 am
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}

Re: Listit2 get row if field not empty

Posted: Sat Apr 04, 2015 6:49 pm
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).

Re: Listit2 get row if field not empty

Posted: Tue Apr 14, 2015 7:44 am
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... ;-)

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

Posted: Tue Apr 14, 2015 8:12 am
by velden
I wouldn't hold my breath.... ListIt2 isn't under active development anymore.

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

Posted: Tue Apr 14, 2015 9:46 am
by staartmees
ListIt2 has discontinued, EasyList is a fork of it
http://dev.cmsmadesimple.org/projects/easylist

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

Posted: Fri Apr 17, 2015 9:53 am
by HarmO
Ok, great news. will check Easylist.

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

Posted: Fri Apr 17, 2015 9:57 am
by staartmees
EasyList is only for CMSMS 2.0, for CMSMS 1.12 you still have to use ListIt2

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

Posted: Tue Apr 28, 2015 10:43 am
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?

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

Posted: Tue Apr 28, 2015 10:51 am
by staartmees