5

I am trying to expand some code suppled by Mark Croxton in another thread to create a list of Matrix results from a related entry but without success. This is with Stash 2.3.5 on ExpressionEngine 2.5.3.

Here is my SET code from my main template:

    {exp:stash:set_list name="landing_slideshow" parse_tags="yes" parse_depth="2"}

      {exp:channel:entries channel="slideshow" sort="date" dynamic="no" disable="member_data|pagination" parse="inward"}

        {stash:stash_entry_id}{entry_id}{/stash:stash_entry_id}
        {stash:title}{title}{/stash:title}
        {stash:landing_slideshow_image}{landing_page_slideshow_image}{/stash:landing_slideshow_image}

        {exp:stash:set_list:nested name="lb_slideshow_credits_{entry_id}" parse_tags="yes"}
          {related_entries id="related_work_project"}
            {work_team}
              {stash:lp_slideshow_position}{mx_position}{/stash:lp_slideshow_position}
              {stash:lp_slideshow_person}{mx_person}{/stash:lp_slideshow_person}
            {/work_team}
          {/related_entries}
        {/exp:stash:set_list:nested}

      {/exp:channel:entries}

    {/exp:stash:set_list}

And here is the GET code I have in an embeded template:

  {exp:stash:get_list name="landing_slideshow"}
    <ul class="normal">
      <li>{stash_entry_id}</li>
      {exp:stash:get_list:nested name="lb_slideshow_credits_{entry_id}"}
        <li><span class="">{lp_slideshow_position} | </span> {lp_slideshow_person}</li>
      {/exp:stash:get_list:nested}
    </ul>
  {/exp:stash:get_list}

The Stashed values set outside the {related_entries} loop — {stash_entry_id}, {title} and {landing_slideshow_image} are all displaying as expected. Nothing in the {related_entries} loop is displaying or appears to be stashed.

Does using related entries change things enough that answers in the other thread aren't applicable?

2
  • 1
    Are you using the latest Matrix? There was a bug in an older version that prevented it being captured by Stash. That aside, it looks like you actually need 3 levels of nested lists, since there may be multiple related entries and multiple matrix rows per related entry. Commented Dec 21, 2012 at 23:49
  • 1
    Well, there will be 8-10 entires in the slideshow channel, but each entry will have one related entry and, yes, the Matrix field will have multiple rows. Where would the third set_list go? I tried placing it just inside {work_team} — so a new set_list for each Matrix field — but that seemed to break all Stash parsing. I just upgraded from Matrix 2.5.1 to 2.5.2. Commented Dec 22, 2012 at 0:34

1 Answer 1

2

I solved this by removing Stash from the equation and instead using two {exp:channel:entries} tag. After 53 views of this question, my assumption is this is not a common use for Stash and thus the tradeoff between performance and supporting my own code 6 months down the line is low.

2
  • Can you make sure to select your answer as the correct one by clicking on the checkmark to the left.
    – Anna_MediaGirl
    Commented Jan 10, 2013 at 4:56
  • I woud @AnnaBrown_MediaGirl, but I'm not sure if that is a correct answer — I didn't have time to mess with it any longer — but it was more tossing my hands in the air and giving up. Would be nice to know if this were actually possible but that's academic for me. Commented Jan 10, 2013 at 5:40

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.