0

I have a list and nested stash list loading and displaying ok until I try to cache. Once cached they both display fine on first load, but upon reload the nested list disappears.

I'm not clear on how to cache and reload a nested list, could someone please provide an example or modify the code below?

Thanks!

Not Working (Caching)

{!-- Stash list of homes and communities (in nested list) they belong to. Communities are stored in a playa relation within a matrix field. --}
  {exp:stash:set_list 
    name="home_results_{segment_2}" 
    parse_tags="yes" 
    parse_depth="2" 
    parse_conditionals="yes"
    save="yes"
    refresh="1"
    scope="site"
    replace="no"
  }
    {exp:channel:entries 
      channel="homes"
      dynamic="no" 
      category="1"
      disable="member_data|pagination"
    }
    {stash:entry_id}{entry_id}{/stash:entry_id}
    {stash:entry_title}{title}{/stash:entry_title}
    {!-- Nested stuff. Stash the communties that this house is in.  --}
     {exp:stash:set_list:nested 
        name="related_entries_{entry_id}" 
        parse_tags="yes"
        save="yes"
        refresh="1"
        scope="site"
        replace="no"
      }
        {elevations} {!-- Matrix field --}
          {stash:incommunity}
              {elevation_community}{title} - {city_province}{/elevation_community} {!-- Playa field --}
        {/stash:incommunity}
        {/elevations}
      {/exp:stash:set_list:nested}
    {/exp:channel:entries}
  {/exp:stash:set_list}
{!-- End of Home results stash. --}


{!-- Load the nested stash list with communities into content --}
{exp:stash:append name="content"}
    {exp:stash:get_list name="home_results_{segment_2}"}
      <div>
        <strong>{entry_title}</strong><br>
        {!-- Stash get the list of communities the home is built in --}
          {exp:stash:get_list:nested unique="yes" prefix="nested" name="related_entries_{entry_id}"}
           - {incommunity}<br>
         {/exp:stash:get_list:nested} 
      </div>
    {/exp:stash:get_list}
{/exp:stash:append}
  • Try making the nested stash have a longer refresh then the parent stash. I've a smilar issue and that was Mark's thoughts. – stuartmcd69 Apr 17 '13 at 13:40
  • Good idea, no luck though. – Anson LeClair Apr 17 '13 at 13:45
  • Try adding replace=yes to the inner tag as well. – stuartmcd69 Apr 17 '13 at 13:50
1

You would need to use the same scope scope="site" when getting the lists as when setting, unless you have set the stash_default_scope configuration value to 'site'.

| improve this answer | |
  • Thanks for your response Mark, for some reason I didn't get a notice in my email, so haven't checked back until now. I'll give this a try. – Anson LeClair May 2 '13 at 17:44

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.