0

I am new to the stash plugin so i am probably doing something wrong.

At the top of a layout template, i have a channel entry loop that sets a stash variable like so:

    {exp:stash:set
    save="yes" 
    scope="user" 
    parse_tags="yes"
    replace="yes" 
    refresh="60"
    output="no"
}
    {exp:channel:entries
        channel="subscribers"
        disable="categories|category_fields|member_data|pagination|trackbacks"
        dynamic="off"
        limit="1"
        author_id="CURRENT_USER"
    }
        {subscriber_children search:child_active="=YES" limit="1"}
            {stash:child_name}{child_name}{/stash:child_name}
            {stash:year_group}{year_group}{/stash:year_group}
        {/subscriber_children}
    {/exp:channel:entries}
{/exp:stash:set}

In the page, there is a dropdown that allows the user to change the active_child, so on /page1 the user can select child2 to set to active, this jumps to /switch-child/entry_id where it sets the child to active, then redirects back to /page1. What i am seeing is that i have to manually refresh /page1 again to update the stash variable (child_name)

{exp:stash:get name="child_name"}

How do i get it to update when /page1 loads?

4
  • I've narrowed this down to parse order. I am trying to make the values child_name and year_group accessible across various template partials hence the need to query it once and stash it.
    – BillyMedia
    Commented Feb 5, 2015 at 20:18
  • Try adding process="end" parameter to your exp:stash:get tag. Commented Feb 5, 2015 at 21:30
  • Perfect. I knew it would be something simple. Thanks.
    – BillyMedia
    Commented Feb 6, 2015 at 8:57
  • Great, went ahead and added it as the answer! Commented Feb 6, 2015 at 13:49

1 Answer 1

0

The stash:get is probably being run in the template parse order before it's value is available. One fix is to have the stash:get run later using process="end" parameter:

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

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.