0

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"}
   <tr>
       <td>{store_name}</td>
       <td>{address_1}, {postal_code} {city}</td>
       <td>{country}</td>
       <td>{phone}</td>
       <td>{fax}</td>
   </tr>
{/exp:stash:get_list}

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.

1
  • 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. Sep 7, 2017 at 15:00

1 Answer 1

0

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.

3
  • 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, 2017 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. Sep 8, 2017 at 9:55
  • That's it indeed! I also moved my #( )# to the get_list, rather than the set variable. Thanks.
    – Rien
    Sep 9, 2017 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.