Copied to clipboard

Flag this post as spam?

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


  • Kyle Eck 130 posts 280 karma points
    Dec 10, 2021 @ 02:25
    Kyle Eck
    0

    Get Product Attributes for Product Category

    Matt,

    How am I able to reference/get all of the Product Attributes for a given product category? I am looking to get the product attributes for filtering the product within that category using a combination of ajax and surface controllers

    Thanks

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Dec 10, 2021 @ 08:44
    Matt Brailsford
    0

    Hi Kyle,

    Hmmm, the only way really is to loop through all the products in those categories and extract all of their in-use attributes and then do a distinct over them but this is not going to be performant.

    Best other option I could think of is to do some custom lucene indexing, or have some event handlers track this so that you can more easily query them.

    Matt

  • Kyle Eck 130 posts 280 karma points
    Dec 10, 2021 @ 11:54
    Kyle Eck
    0

    Matt,

    I know it was asked once more, however, I wanted some additional clarification on the matter.

    Essentially the way to retrieve product attributes is not performant unless you do a license indexer etc?

    Is there a plan to implement product filters based on the product attributes etc?

    Could someone potentially write a stored procedure to capture the data and then retrieve it that way?

    This is sort of a bummer as I was hoping I could get these for in a performant way, but seeing as how a product could have a content picker that holds categories I see how it becomes problematic.

    Do you have any documentation on your license index that handles this?

  • Matt Brailsford 4123 posts 22194 karma points MVP 9x c-trib
    Dec 10, 2021 @ 12:03
    Matt Brailsford
    0

    Hi Kyle,

    We have ways of extracting the attributes for a single product which would be used on the product pages (see example here https://github.com/vendrhub/vendr-demo-store/blob/v2/netframework/main/src/Vendr.DemoStore.Web/Views/ProductPage.cshtml#L136), what we don't have though is a way to get all attributes used by all products in a category. The only way you can possibly know this is by looking over all the products in some way, either at request time, or, in some way behind the scenes when a product is saved.

    Because categories can be implemented in lots of different ways, it's not something we address, rather leave it up to the implementor. This is what I was saying when I suggested looking into a Lucene Index (not License). By this I meant use the built in Lucene / Examine features of Umbraco to create some custom lookup that might be more performant. Or, use some Umbraco event handler to detect products being saved and do the lookup then and store it somewhere you can reuse later.

    You could create some kind of stored procedure yes and that would be a great solution. Again though, it's not something we would necessarily do though as we don't dictate how categorisation would actually be implemented on your site.

    Hope this helps clarify.

    Matt

  • Kyle Eck 130 posts 280 karma points
    Dec 10, 2021 @ 12:10
    Kyle Eck
    0

    Matt,

    I understand what you are saying and get your approach to this. I’m on mobile so autocorrect took over, apologies for the spelling issues.

    I know this can be done, just finding the most logical/performant method is what’s tripping me up at the moment.

    Looping products is not ideal as the catalog can become large rather quickly.

    Thanks for your input in regards to this. We can mark it resolves so we don’t muddy the forum further.

Please Sign in or register to post replies

Write your reply to:

Draft