I have multiple channels with different field groups, but several duplicate fields. For example:


  • products_bikes
  • products_skateboards
  • products_trikes


  • bikes_summary
  • skateboards_summary
  • trikes_summary

I use the same detail template to output info for all of the channels, but with the duplicate fields, I have to repeat the "summary" field 3 times:




And this isn't the only field that's repeated. So that can get pretty hairy, especially if I need to check if a field is empty or not, or if I want to add another product type in the future.

So ideally I'd be able to set a channel prefix, and use it in a single field tag:


I can't use the channel_short_name because it doesn't match up, so I figured Stash might be able to do it. I tried:

    {if channel_short_name == 'products_bikes'}
    {if channel_short_name == 'products_skateboards'}
    {if channel_short_name == 'products_trikes'}


But that output the text "{bikes_summary}" rather than parsed the field tag. I figure parse order has to do with it, but I'm not sure how to fix it - or if it's possible.

Thanks for any help!

3 Answers 3


The first thing I would ask is do you really need a fieldgroup for each product channel? Multiple channels can share the same fieldgroup and you can use publish layouts to hide the fields that are not relevant to a particular product. Using the same fieldgroup will also force you to generalise the fields you use which can be a good thing for rationalising your data structure.

If not then you could adopt the following approach. It does requires that you use a consistent naming scheme for your fields, e.g. channel_fieldname:

{!-- make a list of your channel prefixes --}
{exp:stash:set_list name="channels"}

{!-- make a list of your common field suffixes --}
{exp:stash:set_list name="fields"}

{!-- map channels and fields to generate tag pairs --}
{exp:stash:set name="mapped_fields" parse_tags="yes" parse_depth="2" type="snippet"}
   {exp:stash:get_list name="fields"}
         {exp:stash:get_list:nested name="channels"}

{!-- capture the data --}
{exp:stash:set parse_tags="yes" type="snippet"}
      channel='{exp:stash:get_list name="channels" backspace="1"}{channel}|{/exp:stash:get_list}'



{!-- example of using the data in your view template (Stash embed or EE embed) --}
{if summary}{summary}{/if}

{!-- example of using the data in the *same* template you capture the data --}
{if summary}{exp:stash:get name="summary" type="snippet"}{/if}

To make this even more robust, you could list the channels automatically using a plugin like Get Channels.

{exp:stash:set_list name="channels" parse_tags="yes"}
  • Yikes, that's almost more complicated than just duplicating the fields!
    – kmgdev
    Commented Jul 31, 2013 at 21:53
  • 1
    Super minor, but could you perhaps elaborate on the capturing and usage example? I have this {exp:stash:get name="date_to_use" type="snippet"} inside of a channel entries loop in the same template as the data capture, but no luck.
    – jpea
    Commented Oct 21, 2014 at 16:47

Stash doesn't work for this because their tow instances are parsed on the same parsing stage. So, when you call stash:channel_prefix its value isn't available yet.

Your better option is to remove the "products_" prefix from the short names of the channels.


I think basically if you wrap the second part in a {exp:stash:parse parse_vars="yes" parse_depth="2"} - it will be like the categories bit in my router basically.


Your Answer

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

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