1

So i'm trying to stash a category custom field from within a categories tag pair that is within a Playa parents tag pair, and then retrieve it for use outside of the Playa parents tag pair.

Here's what I've got so far.

{exp:channel:entries channel="campus" category="not 156" orderby="title" sort="asc"}
   {exp:playa:parents channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}
{/exp:channel:entries}

{exp:stash:get name="wufoo_id" process="end"}

Not sure why this isn't working. process="end" should be forcing the get to wait to parse until the set has parsed, even though it is before the set in the parse order.

Any thoughts?

EE 2.5.1, Playa 4.3.3 & Stash 2.1

2 Answers 2

2

Mike above is right that you need Stash 2.2.0 or later to use process="end".

However, your code has another problem. You are looping over channel entries, then looping over the parents of each entry, then finally looping over the categories assigned to each parent. Let me show you how that would be parsed:

{!-- Start --}
{exp:channel:entries channel="campus" category="not 156" orderby="title" sort="asc"}
   {exp:playa:parents channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}
{/exp:channel:entries}



{!-- After first pass, if 2 entries --}

   {exp:playa:parents entry_id="1" channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}

   {exp:playa:parents entry_id="1" channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}


   {!-- During second pass, if 2 parents for each entry --}


      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}


   {!-- During second pass, if 2 categories for each parent --}

         {exp:stash:set name="wufoo_id"}
            1
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            5
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            2
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            7
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            9
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            2
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            1
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            9
         {/exp:stash:set}

However, you appear to be trying to capture only a single variable. Did you instead want a list?

1
  • Mark, It's a single variable, to be used within the context of a large list. Specifically, a list of campuses, with a list of classes under each campus. I omitted some of my markup to give the most simple version for the sake of clarity. Thanks, Commented Jun 22, 2013 at 12:20
1

process="end" looks like the correct approach, unfortunatly that was not implemented into Stash until version 2.2 - looks like you will need to upgrade stash to use that feature :D

Heres the snippet from the changelog... https://github.com/croxton/Stash#new-in-v220

New in v2.2.0

{stash:embed} - embed a Stash template file at different points in the parse order of the host template: start (before template parsing), inline (normal), end (post-process after normal template parsing has completed).

4
  • I'll update to the most recent version as soon as I can get my EE install up to date. Thanks Mike! Commented Jun 22, 2013 at 12:21
  • Mike, I've updated to 2.3.6, but now i'm getting something funky when I try to get my stored variable. It's parsing the set variable as "{adad9c4f909beb8d83d09308fc5318171684217298}" when I try to get it in another context... Commented Jun 23, 2013 at 19:56
  • Did you clear all the Cache's? Commented Jun 24, 2013 at 14:04
  • I did, but I've found another way to do what I was trying to do, without the use of stash. Commented Jun 24, 2013 at 17:50

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.