0

I'm using GwCategories to get all subcategories from a certain parent category (in this case, main_cat_id). Within this list, I'm adding a nested list, training_list_{cat_id}.

In my template, I can see the categories listed, but the nested list shows nothing. Now, I know that one of the subcategories has the ID 60. I replace {cat_id} in the example below by a hard-coded 60, the list does show. So I'm having a bit of a parsing issue here, I guess.

This is my (somewhat stripped) code:

{exp:stash:set_list name="categories_list" parse_tags="yes"}
    {exp:gwcode_categories custom_fields="yes" channel="channel" cat_id="{main_cat_id}" depth="2"}
        {stash:category_name}{cat_name}{/stash:category_name}
        {stash:category_id}{cat_id}{/stash:category_id}

        {exp:stash:set_list:nested name="training_list_{cat_id}" parse_tags="yes"}
            {exp:channel:entries channel="channel" dynamic="no" category="{cat_id}"}
                {stash:entry_id}{entry_id}{/stash:entry_id}
                {stash:title}{title} - {cat_id}{/stash:title}
            {/exp:channel:entries}
        {/exp:stash:set_list:nested}
    {/exp:gwcode_categories}
{/exp:stash:set_list}

Thanks!

2 Answers 2

0

I think this is a parse order issue, you may need to add parse="inward" to your nested set_list. Using this means that it will parse the variable in your name parameter early on.

0

You need to add parse_depth="2" to the outermost set_list tag.

This is required so that both the gwcode_categories tag and the inner set_list tag are parsed before the outermost set_list captures it's row data.

As per example here: https://github.com/croxton/Stash/wiki/Lists#three-and-more-dimensional-lists

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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