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?

  • 1
    Seems you're missing the closing colon :notempty: in the 2nd example. – Brad Bell Oct 8 '15 at 15:39
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} %}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.