0
{exp:stash:set_list name="related_skus" parse_tags="yes"}
    {exp:tag:related_entries channel="men_clothing" tag="t shirt" orderby="title" sort="asc" limit="6" paginate="bottom"}
            {exp:switchee variable="{channel_short_name}" parse="inward"}
                {case value="men_clothing"}
                    {stash:related}
                    <div class="each_ritems">
                        <div class="ritems_img">
                          {men_clothing_image limit="1"}<a class="image" href="{path='shop/product/{channel_short_name}/{url_title}}" title="View more"> <img src="{image:url:small}" alt=""></a>{/men_clothing_image}
                        </div>
                        <div class="each_rwrapper">
                          <div class="ritems_title">{exp:stash:get name="small_title"}</div>
                          <div class="ritems_price"> From: <div class="sus-rupee">{men_clothing_vendor:lowest column="mc_sales_price"}</div> To <div class="sus-rupee">{men_clothing_vendor:highest column="mc_sales_price"}</div></div>
                          <div class="ritems_details">{title}</div>
                        </div>
                    </div>
                    {/stash:related}
                {/case}
            {/exp:switchee} 
    {/exp:tag:related_entries}
{/exp:stash:set_list}

{exp:stash:get_list name="related_skus"}
      {related}
{/exp:stash:get_list}

i have tried this without Stash and passing channel name and nothing is working. need your expert advice

1 Answer 1

1

tag:related_entries accepts an entry_id parameter, not a tag parameter. This is because it looks for entries which have many shared tags in common to the entry you pass to it. (Hence, entries which are "related.")

If you simply want to display a list of entries which belong to a specific tag, use tag:entries instead.

6
  • Hi Derek, thanks for the answer,, adding tag parameter is part of trial and error and without also i am not getting output from related entries. there are entries with t shirts tag and that channel still no output.
    – sus
    Jan 29, 2015 at 20:13
  • Are you passing a valid entry_id? Jan 29, 2015 at 21:24
  • I am having this related entries tag in single post page and outside channel entries tag. Do i need to pass entry id to work correctly.
    – sus
    Jan 30, 2015 at 1:02
  • When i move this code inside channel entries now i have oupt put , but all of them are same entries of entry id {exp:stash:set_list name="related_skus" parse_tags="yes"} {exp:tag:related_entries channel="men_clothing" entry_id="{entry_id}" orderby="title" sort="asc" limit="6" paginate="bottom"} {exp:switchee variable="{channel_short_name}" parse="inward"} {case value="men_clothing"} {stash:related}
    – sus
    Jan 30, 2015 at 1:18
  • Ah, right, it can't go inside of a channel:entries loop due to the variable names clashing. But if you put it outside of the channel:entries loop in the same template, Tag will infer the current entry_id from the URL and it should work. Otherwise, you'll need to embed your tag:related-entries loop and pass the entry_id via an embed parameter. Jan 30, 2015 at 12:32

Your Answer

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

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