I'm having trouble with a stash list that should be filtered.

My list itself looks like this:

{exp:stash:get_list name="stores_list" parse_tags="yes" parse_depth="3" parse="inward" match="{exp:stash:get name='applicable_countries_list'}" against="country"}
       <td>{address_1}, {postal_code} {city}</td>

The value in match against returns exactly this: #(FRANCE|REUNION)#

When I just use this exact variable in the match parameter, it works perfectly, and only stores in France and Reunion are shown. When using the stash variable though, nothing show up.

I've tried wrapping the list with a stash:parse tag, and also tried {stash:applicable_countries} as a variable. No luck yet though.

  • Couple of other tests you might run: 1) add process="end" param to getting stores_list. 2) for match use match="#({exp:stash:get.........})#", and just return the piped value list in applicable_countries_list. – Romans-8---31-39 Sep 7 '17 at 15:00

When you set the variable applicable_countries_list you need to ensure that you are not capturing the whitespace around each value. Close up the space manually and/or use the trim="yes" parameter when setting the variable.

  • This is how I set the variable: {stash:applicable_countries_list}#({cf_applicable_countries}{cf_applicable_countries:title}{if cf_applicable_countries:total_results != cf_applicable_countries:count}|{/if}{/cf_applicable_countries})#{/stash:applicable_countries_list} There's no whitespace as far as I can tell. – Rien Sep 8 '17 at 6:13
  • 1
    I'd guess those if/else conditionals are being captured literally - check your template debug output to see what Stash is capturing for that variable. You can use parse="yes" (or just parse_conditionals="yes") on the stash:set to tell Stash to parse the content before capturing. – Mark Croxton Sep 8 '17 at 9:55
  • That's it indeed! I also moved my #( )# to the get_list, rather than the set variable. Thanks. – Rien Sep 9 '17 at 6:11

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.