filtering out if a custom field is empty
I have want to check if a custom field exists {my_postcode} and if it does output results that contain this field.
Is there a way to do this within the search parameter or would I be switching out inside the results tag
{if my_postcode}
//do something here
Replies
Low 20 May 2014 10:04
Adding this parameter to the Results tag will only display entries that have my_postcode filled out:
Using the conditional will show all entries.
Both options work just like the native channel:entries tag.
Ross Hulford 20 May 2014 10:24
great one last thing I have a custom checkbox (yes/no) if it is checked I want to turn off my distance:to parameter
I set it like this
Can I overwrite this in the results tag?
{if low_search_mycustomparam}
// turn off the distance:to param here
{/if}
Low 20 May 2014 12:04
If you don't submit the distance:to param, the distance filter won't be executed. So yeah, using a custom param like that could work for you.
Ross Hulford 20 May 2014 13:07
still trying this is what I have
{exp:low_search:results status="not closed" show_expired="yes" dynamic="off" limit="5" paginate="bottom" {if low_search_homelearning == 'yes'} search:classroom_postcode="IS_EMPTY" {if:else}search:classroom_postcode="not IS_EMPTY"{/if} }
I want to check for the classroom_postcode and filter if it is empty.
Low 20 May 2014 13:23
You can't use variables made available by a tag to show/hide parameters of that tag. To make the Results tag parameters dynamic, use the Form and submit it.
If you need help implementing Low Search for your site, I also offer a bespoke Implementation Aid service. Email me for more info on that.