New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem using modifier/parameter on Collection Loop within Taxonomy Loop #705

intrepidws opened this Issue May 24, 2016 · 2 comments


None yet
3 participants

intrepidws commented May 24, 2016

Steps to reproduce

  1. Create a taxonomy of categories.
  2. Create a collection of products, with a collection field type in the fieldset to link to the categories.
  3. Try the following template code:
{{ taxonomy:product_category show="all" sort="title" }}
    <a href="{{ url }}">{{ title }}</a>
    <ul class="sub-categories">
        {{ collection }}
        <li><a href="{{ url }}">{{ title }}</a></li>
        {{ /collection }}
{{ /taxonomy:product_category }}
  1. That code should work, and display each taxonomy product category, along with a sub-listing of all associated products. However, if you change the inner loop to be, {{ collection sort="title" }}, this change breaks it entirely. It seems like any attempt at applying a modifier/parameter (sort, limit, offset, etc) like this has the same outcome. For instance, changing the inner loop to be {{ collection limit="1" }} or {{ collection offset="1" }} has the same problem.

Expected behaviour

The inner loop should be alphabetized with the addition of sort="title". Or limited to 1 result with the addition of limit="1". Or offset by 1 result with the addition of offset="1".

Actual behaviour

Adding sort="title", limit="1" or offset="1" to the inner loops seems to break the loop entirely. Instead of looping through all items in the collection that are related to the taxonomy, it will simply loop once and display the title of the outer loop (rather than the title of the inner loop).

Server configuration

Operating system:
Ubuntu 14.04
Web server:
PHP version:
Statamic version:
Updated from an older Statamic or fresh install:
Fresh install
List of installed addons:


Web server error log

Nothing shows in Web server error log.

Statamic error log (/local/storage/logs/statamic.log)

Nothing shows in Statamic error log.

Browser log

Nothing shows in Browser log.


This comment has been minimized.

intrepidws commented May 24, 2016

I don't think it's expected behavior, but I was able to get the following code to work:

{{ collection|sort:title }}
    <li><a href="{{ url }}">{{ title }}</a></li>
{{ /collection|sort:title }}

This comment has been minimized.


jasonvarga commented Aug 24, 2016

This is fixed for the next release. You'll be able to use the inner collection tag as you'd expect.

{{ taxonomy:product_category }}
  {{ collection sort="title" }}
  {{ /collection }}
{{ /taxonomy:product_category }}

@jackmcdade jackmcdade closed this Aug 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment