Ok I have brands for products stored as a Playa so I can do various things with them...obviously simple things like:
{cf_paper_brand}
{title}
{/cf_paper_brand}
However, later I want to include a list of articles based on that product's brand. I am storing these related articles in low variables(of playas) -
lv_brand1_articles, lv_brand2_articles
etc.
Thus my basic issue is I want to retrieve/choose the appropriate low variable based on the playa brand field.
This seems like it should be easy, and certainly I can do it with a bunch of conditionals I guess. But I am thinking there must be a more elegant solution...basically, I just need to get the brand title once and then use this in a few spots as a 'stub' when retrieving the low variable
In pseudo code:
if cf_product_brand == "brand1" then
{exp:low_variables:parse var="{lv_brand1_articles}" var_prefix="brand_articles"}
{brand_articles:title}
{/exp:low_variables:parse}
else if cf_product_brand == "brand1"
{exp:low_variables:parse var="{lv_brand2_articles}" var_prefix="brand_articles"}
{brand_articles:title}
{/exp:low_variables:parse}
else if....
etc... but for a LOT of brands, and I have related articles, links, and files. So I will end up with a block of 30+ conditionals - which sucks. Basically, I want to keep this mess of conditionals out of my template or at least in one spot in the template.
SO - If could set a stub of the brand title somehow, then retrieve {lv_{stub}_articles} - that would work....but I can't seem to do this. I have tried with stash but I am new to all the parse order issues and getting confused. I am thinking maybe I need to use a low variable with a pre_parse thing but can't quite seem to get it ...
Any help much appreciated!! I am relatively new to EE and Stack Exchange etc. Hope I have asked correctly!
(And note - the brand is not available in the segment_x variables as it's not in the URL. I could in theory put it there, but I'd really prefer not to)