0

I am sure there is an easy fix for this: just I'm unable to find it...

I have this simple code structure that puts values from a Low_Reorder set into a stash list. It works just fine.

{exp:stash:set_list name="process" parse_tags="yes"}
    {exp:low_reorder:entries set="training_courses" disable="categories|member_data|pagination" parse="inward"}
         {stash:title}{title}{/stash:title}
         {stash:resource_hero_image}{resource_hero_image:url}{/stash:resource_hero_image}
         {stash:url_title}{url_title}{/stash:url_title}
     {/exp:low_reorder:entries}
{/exp:stash:set_list}

However, when I now add a conditional within the Low_Reorder, I get no output at all. Vis:

{exp:stash:set_list name="process" parse_tags="yes"}
    {exp:low_reorder:entries set="training_courses" disable="categories|member_data|pagination" parse="inward"}
    {if segment_2 != url_title}
         {stash:title}{title}{/stash:title}
         {stash:resource_hero_image}{resource_hero_image:url}{/stash:resource_hero_image}
         {stash:url_title}{url_title}{/stash:url_title}
     {/if}
     {/exp:low_reorder:entries}
{/exp:stash:set_list}

The only change is adding the conditional - and if you remove the {stash} structure this code works flawlessly.

So the issue is to do with the {if} statement - I'm guessing that it is not being processed within the {stash} terms.

So I tried adding parse_conditionals="yes" to the set_list tag, and then adding parse_depth="3" - (so the opening stash tag eventually became {exp:stash:set_list name="process" parse_tags="yes" parse_conditionals="yes" parse_depth="3"} but these changes didn't help at all.

Can anyone help me with whatever the correct thing to do here is?

Thanks in advance for whatever help you can provide.

1

Whilst I'm not sure why your current code doesn't work (have you tried removing parse="inward" on the Low Reorder tag?), I would approach this in a slightly different way by filtering out the current page prior to fetching the data for it - in other words something like this on your opening Low Reorder tag:

{exp:low_reorder:entries url_title="not {segment_2}" ...}

You could equally do the filtering during your stash:get_list process using match and against, but makes most sense to not fetch the data in the first place if you're never going to use it.

(Also worth noting that Stash's parse="yes" parameter is a handy shorthand for switching on both parse_tags and parse_conditionals.)

| improve this answer | |
  • Hi James. The idea of adding url_title="not... is very helpful - it works just fine in the 'non stash' version, and I agree with the idea of simply not pulling the data if not needed. However it doesn't fix this... when I try this (and I've tried many variants) {stash} stores simply the value I don't want (i.e. it stores one entry - the one where url_title == segement_2. Have no idea what is going on. As ever {stash} remains the add-on that has mystical potential but almost no practical application. Grr! – JCOGS Design Oct 27 '16 at 10:10
  • Try adding dynamic="no" to your low_reorder:entries tag. – James Smith Oct 31 '16 at 11:12

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.