So I have the following code snippet which is working fine:
{exp:stash:set name="market_ids" parse_tags="yes"}
{exp:query sql="select GROUP_CONCAT(entry_id SEPARATOR '|') as market_ids from exp_channel_data where channel_id=3 AND field_id_12 LIKE CONCAT('%', DAYNAME(from_unixtime({exp:stash:delivery_day})), '%')" parse="inward"}
{market_ids}
{/exp:query}
{/exp:stash:set}
This sets a value for the markets that I use later on in the page.
However, sometimes the stash value inside the SQL statement ({exp:stash:delivery_day}) wont be set. Typically if the user has clicked a link and not entered the site through our pre-determined route.
I've tried adding a conditional around whole statement, but it doesn't appear to be working because it's still executing the SQL statement:
{exp:stash:set name="market_ids" parse_tags="yes"}
{if "{exp:stash:not_empty name='delivery_day'}"}
{exp:query sql="select GROUP_CONCAT(entry_id SEPARATOR '|') as market_ids from exp_channel_data where channel_id=3 AND field_id_12 LIKE CONCAT('%', DAYNAME(from_unixtime({exp:stash:delivery_day})), '%')" parse="inward"}
{market_ids}
{/exp:query}
{/if}
{/exp:stash:set}
Anyone offer any advice on the best way to get this working?