Copied to clipboard

Flag this post as spam?

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


  • Philip Hayton 98 posts 435 karma points
    Mar 14, 2023 @ 16:51
    Philip Hayton
    0

    How to filter a VirtualSubTree within Vendr by Store Id

    Hi Matt,

    Is it possible to perform contextual filtering on a collection based on the place it's being rendered?

    For example, I have one particular collection that is used in both a ContextApp AND as a Vendr VirtualSubTree at Commerce > Stores > {StoreName} > My Collection.

    The collection contains models like this:

    [PrimaryKeyColumn(AutoIncrement = false)]
    [Column("Id")]
    public Guid Id { get; set; } = Guid.NewGuid();
    
    [Column("contentUdi")]
    public string? ContentUdi { get; set; }
    
    [Column("storeId")]
    public Guid? StoreId { get; set; }
    
    [Column("productId")]
    public Guid? ProductId { get; set; }
    

    I am able to successfully filter the ContextApp using ContentUdi as a foreign key.

    However I'm having trouble filtering the VirtualSubTree in Vendr. I only want to show models where StoreId matches the current Store (which is a parent of the VirtualSubTree).

    Is there anyway of doing that?

    Any help is greatly appreciated! 🙏🏻

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 15, 2023 @ 10:55
    Matt Brailsford
    0

    What does your virtual sub tree configuration look like?

  • Philip Hayton 98 posts 435 karma points
    Mar 17, 2023 @ 10:45
    Philip Hayton
    0

    Gah, don't worry, I think I've solved it.

    I had to store all IDs as a string instead of a Guid.

Please Sign in or register to post replies

Write your reply to:

Draft