I’m stumped on something. I’m trying to (using AJAX) allow users to filter events by their location. So you can choose either Region or Country from selects that are populated with the addon REEgion Select. Whatever you select then becomes segment_3
. Pretty straightforward. If you chose a Region, it’s no problem to just use that segment as the search, but because there’s some overlap between the two letter codes (CA is Canada and California), I created a conditional to determine what is being returned, and am trying to use stash to get that conditional variable into the search function of the {exp:calendar:events}
tag.
This is that tag:
{exp:calendar:events event_limit="30" channel="calendar_events" date_range_start="today" date_range_end="1 year" search:address='{exp:stash:get name='region_search' random}' dynamic="no”}
Here’s the stash variables I created:
{exp:stash:set name="region_stash"}{exp:reegion_select:countries}{if segment_3 == "{region_alpha3}"}{region_alpha2}{/if}{/exp:reegion_select:countries}{/exp:stash:set}
{exp:stash:set name="region_search"} {if '{exp:stash:get name="region_stash" random}' == ''} "region":"{segment_3}" {if:else} "country":"{exp:stash:get name="region_stash" random}" {/if} {/exp:stash:set}
{exp:stash:get name="region_search" random}
outside of the tag, this stashed variable works great and renders no problem. Do you guys know what I’m doing wrong?
Here it is in action. Thank you!
search:address=""
are parsed and do not instead show all (or part of) the unparsed Stash code. Also make sure youraddress
field is set to be searchable in EE.