0

The following returns entries correctly:

{% paginate craft.entries.section('sectionName').customField(':notempty:').limit(10) as products %}
    {% for product in products %}
        {% include 'incs/_productSnippet' %}
    {% endfor %}
{% endpaginate %}

But the following returns empty:

{% set params = { section: 'sectionName', customField: ':notempty', limit: 10} %}
{% paginate craft.entries(params) as products %}
    {% for product in products %}
        {% include 'incs/_productSnippet' %}
    {% endfor %}
{% endpaginate %}

It's the latter I'm after because the customField I want to check varies. Removing the customField: ':notempty', from params in the second example returns entries, so I'm guessing it's the way I'm using customField within params?

Clive Portman
  • 2,908
  • 17
  • 36

1 Answers1

3

You’re just missing the : at the end of :notempty: in your second example. This will work:

{% set params = { section: 'sectionName', customField: ':notempty:', limit: 10} %}
Brandon Kelly
  • 34,307
  • 2
  • 71
  • 137
  • Thank you. Is there any documentation on this? Similar example here: http://craftcms.stackexchange.com/questions/452/return-entries-where-field-is-not-empty – Clive Portman Oct 09 '15 at 08:40