Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig P 9 posts 90 karma points
    Jul 01, 2021 @ 14:53
    Craig P
    0

    Returning only nodes that appear in a tag list?!

    Hi,

    I have a product section with hundreds of produc nodes. Each has a product code. I have created a document type which allows an editor to create their own bespoke category list page by giving the category a name and content and then a list of products which should appear under it.

    The pseudo code is below to give an idea of what I am looking for but I have tried different ways and come up with nothing that works.

    var selection = Umbraco.Content(Guid.Parse(theGUID))
    .ChildrenOfType("product")
    .Where([PRODUCTCODE IS IN TAGLIST X)
    .Where(x => x.IsVisible())
    

    I have also tried googling searching nodes that appear in tag list but it just comes up with lots of articles about searching nodes which contain something in their taglist. Any help or pointers would be appreciated.

    Thanks

  • Brendan Rice 501 posts 915 karma points
    Jul 01, 2021 @ 15:50
    Brendan Rice
    0
    var myFilteredArticles = articles.Where(x => x.Value("category") != null && ((string[])x.Value("category")).Any(y => y.ToLower().Contains(category.ToLower())));
    
Please Sign in or register to post replies

Write your reply to:

Draft