I'm working on an old EE site (v2.5.2) which for reasons I won't go into I cannot update to a newer version.
I am trying to set a Stash variable based on whether or not a condition evaluates to true. But, because of the way this version of EE handles conditionals the Stash variable is always being set regardless of the actual condition.
Simplified code snippet:
{exp:stash:set_value name="sample" value="no"}
-- loop starts here --
{if entry_id==''}
{exp:stash:set_value name="sample" value="yes"}
Other stuff here
{if:else}
Other stuff here
{/if}
-- loop ends here --
No matter whether entry_id is empty or not, the Stash variable always shows as "yes".
I've tried using Switchee and If:else but have had absolutely no luck getting this apparently simple thing to work.
How can I get around this? It's driving me nuts.
Real code snippet (using Cartthrob's cart_items_info loop) and following information found at https://devot-ee.com/add-ons/support/switchee/viewthread/6566
{exp:stash:set parse_conditionals="true" parse_tags="yes" process="start"}
{exp:cartthrob:cart_items_info}
{exp:switchee variable="{item_options:sample}" parse="inward"}
{case value="true"}
{stash:sample}yes{/stash:sample}
{/case}
{case default="yes"}
{!-- nothing going on here --}
{/case}
{/exp:switchee}
{/exp:cartthrob:cart_items_info}
{/exp:stash:set}
{exp:stash:get name="sample"}
That loop will output the correct information based on the value of {item_options:sample}. But the Stash variable is ALWAYS set to "yes" no matter what.