0

I'm trying to Stash the Solspace Tags for a Channel Entry as a list and then get them on the view template. However, the view template is not displaying any tags, even though there are some assigned.

This is how i'm setting the lists (notice the nested list for the Solspace Tags);

{exp:stash:set_list name="place-{segment_1}" parse_tags="yes" parse_depth="10" save="yes" scope="site"}
    {exp:channel:entries
        channel="places"
        status="open"
    }

        {stash:place_title}{title}{/stash:place_title}
        {stash:place_entry_id}{entry_id}{/stash:place_entry_id}

        {exp:tag:tags
            entry_id="{entry_id}"
            backspace="2"
            orderby="tag_name"
            sort="asc"
        }
            {exp:stash:set_list:nested context="{place_entry_id}" name="place-{segment_1}-tags" parse_tags="yes" save="yes" scope="site" refresh="60"}

                {stash:tag}{tag}{/stash:tag}

            {/exp:stash:set_list:nested}
        {/exp:tag:tags}

    {/exp:channel:entries}
{/exp:stash:set_list}

This is how i'm trying to get the Tags;

{exp:stash:get_list name="place-{segment_1}"}

    {place_title}

    {exp:stash:get_list:nested context="{place_entry_id}" name="place-{segment_1}-tags"}
        {tag}
    {/exp:stash:get_list:nested}

{/exp:stash:get_list}

I would be grateful for any assistance. :)

1 Answer 1

1

You're nearly there. Just got the nested list tags the wrong way round, and you have to use the {entry_id} from the channel entries tag as the unique context when setting the list since {place_entry_id} is only available when getting the list:

{exp:stash:set_list name="place-{segment_1}" parse_tags="yes" parse_depth="3" save="yes" scope="site"}
    {exp:channel:entries
        channel="places"
        status="open"
    }
        {stash:place_title}{title}{/stash:place_title}
        {stash:place_entry_id}{entry_id}{/stash:place_entry_id}

        {exp:stash:set_list:nested context="{entry_id}" name="place-{segment_1}-tags" parse_tags="yes" save="yes" scope="site" refresh="60"}
            {exp:tag:tags
                entry_id="{entry_id}"
                orderby="tag_name"
                sort="asc"
            }
                {stash:tag}{tag}{/stash:tag}
            {/exp:tag:tags}
        {/exp:stash:set_list:nested}

    {/exp:channel:entries}
{/exp:stash:set_list}
2
  • Hey Mark, thanks very much for the reply. I've modified my code but it still doesn't appear to be pulling out the tags. :/ Commented Jun 25, 2014 at 21:47
  • Hey Mark, did a bit more digging and noticed I also had to add 'site="default_site"' to the exp:tag:tags because I'm trying to pull them to a 2nd site. Commented Jun 25, 2014 at 22:19

Your Answer

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

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