1

I have the following Stash variable list to get the related author of an article

{exp:stash:set_list name="my_list" parse_tags="yes" parse_depth="2"}
    {exp:playa:children var_prefix="children" entry_id="{entry_id}"}

        {stash:author_name}{children:title}{/stash:author_name}
        {stash:author_bio}{children:profile_bio}{/stash:author_bio}
        {stash:item_entry_id}{children:entry_id}{/stash:item_entry_id}

    {exp:stash:set_list:nested name="related_entries" context="{children:entry_id}" parse_tags="yes"}
        {!-- Matrix tag pair --}
        {profile_social_media}
            {stash:related_title}{url}{/stash:related_title}
        {/profile_social_media}
    {/exp:stash:set_list:nested}

    {/exp:playa:children}
{/exp:stash:set_list}

but struggling to then get the social media profiles contained within a Matrix field for that related author.

Then in the wrapper we have

 {exp:stash:get_list name="my_list"}
    <div class="{switch='row|rowAlt'}">
        <h1>{author_name} (item {count} of {absolute_results})</h1>

    {author_bio}

    {exp:stash:get_list:nested name="related_entries" context="{item_entry_id}" prefix="nested"}
            <div class="{nested:switch='row|rowAlt'}">
                {related_title} (Related item {nested:count} of {nested:absolute_results})
            </div>
        {/exp:stash:get_list:nested}

    </div>
{/exp:stash:get_list}

Author name and bio are fine, just not the Matrix rows.

0

So my Stash logic here was correct in so much that it was setting the var correctly, but the var_prefix was where the setting of the var was failing.

So the set_list:nested should have been like:

{exp:stash:set_list:nested name="related_entries" context="{children:entry_id}" parse_tags="yes"}
  {!-- Matrix tag pair --}
  {children:profile_social_media}
    {stash:related_title}{children:url}{/stash:related_title}
  {/children:profile_social_media}
{/exp:stash:set_list:nested}

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.