0

I'm using Stash 3.0.3 (from the EE3 branch) with EE 3.4.2 and I'm having some issues getting the Stash variables to display.

I have a page setup that is using the following EE template:

{!-- Get the page layout --}
{stash:embed:layouts:range}

{!-- Get the page model --}
{stash:embed:models:range stash:url_title="{segment_1}"}

The first piece of code is correctly getting the page layout as I can see this when I go to the particular page in the browser.

However, none of the stash variables on the page are actually displaying what they're supposed to - instead they're just showing for example:

{stash:rangeTitle}

Here's the code for this in the {stash:embed:models:range stash:url_title="{segment_1}"} template:

{exp:channel:entries channel="product_ranges" url_title="{stash:url_title}" dynamic="no" limit="1" disable="member_data|pagination" cache="yes" refresh="10080"}
    {exp:stash:set name="rangeTitle"}{title}{/exp:stash:set}
{/exp:channel:entries}

And then the code in the layout {stash:embed:layouts:range}:

{stash:rangeTitle}

I have these exact templates on an EE 2.9 site (but using the latest version of Stash for EE2) and they work perfectly. But I can't seem to get this working on EE3.

I have also tried simply replacing the url_title to the actual page url title to discount this and the variables still didn't display properly.

I was wondering if anyone else has had such an issue?

1 Answer 1

0

cache="yes" refresh="10080"

That tells EE to cache and return the output of the channel entries tag, however there is no output from a stash:set. On subsequent views of the template containing this tag, the stash set will not run.

I'd guess you may have had tag caching disabled on the EE 2.x site so didn't notice.

5
  • Hey Mark, thanks for the update. I've removed the tag and refreshed the pages but sadly there's no change to the output. :/ Commented Sep 28, 2016 at 9:54
  • 1
    Have you tried clearing your EE caches in the control panel? Commented Sep 29, 2016 at 16:08
  • Cleared the caches but still the same. So confusing. :/ Commented Sep 29, 2016 at 19:25
  • I recreated your code above using a fresh install of EE 3.4.3 and Stash 3.0.3 and it works as expected. There was a minor bug with the way global variables were parsed in EE 3.4.2 which may be a possible issue so probably worth upgrading. Other than that, check Stash is installed properly and no other add-ons are throwing PHP errors. Commented Sep 30, 2016 at 16:43
  • Finally managed to get this working. All I did, after upgrading EE to 3.4.3 was to switch the Layout and Model around in the EE template (first code sample). It works fine in EE2 but I guess things are more particular in EE3. Commented Oct 1, 2016 at 13:59

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.