Hi All,
I am very new to OS so trying to get my head around how to approach things. I am playing around with the Order Management template to learn how it is built and am making a few tweaks to see what does what.
Now, my challenge is, I want to modify it so that on the order detail page for each product that is listed on the order, I want to list the "Product Features" like they are shown on the product page at the bottom (the cards).
I have tried various ways, however the best I have got is the same four features be used for all the products on the order. I think this is because it is filtering the product features by the first product code. How do I get it to look at each product code line by line and display the relevant features?
I haven't shared a download for this as it so messy with my experiments it is easier to download a clean copy from the Forge.
I have created a new aggregate called Get ProductFeatures by Product ID which has just the ProductFeatures table as the source and has a filter of:
ProductFeature.ProductId = GetOrderItemsByOrderId.List.Current.OrderItem.ProductId
When this runs, I get the product features repeating the same for all products, see screenshot attached
How can I approach this differently so that I get the correct features listing for all products on the order detail page?
Hi Joel,
Heres an example of what I meant. Find attached the .oml
In the right div you'll find the ProductFeature block :)
If you have any questions just fire them :)
Hope you'll find it useful.
Kind Regards,
João
Hi there,
First of all, if you are new here, welcome to this amazing community! Hoping you're having a wonderful time around OS platform :)
Altough not seeing in full detail your scope, and if I'm interpreting what you did correctly, when you create a new aggregate, with that filter condition related to the other aggregate you had already (GetOrderItemsByOrderId ) the filter condition will match the GetOrderItemsByOrderId.List.Current.OrderItem.ProductId (which will be the first list item, i.e. the first product) for every row. You will then receive allways the same product features.
If this is the case, a possible solution is to use a block to receive each product ID, and for each product, you can fetch it's features, matching in your aggregate the ProductID from the blocks input param with your ProductFeature.ProductId.
Hope it helps, and please do tell if I'm interpreting anything wrong here.
Kind Regards
Thanks, you are absolutely correct in thinking that is what I am needing to achieve.
How do I use a block to do this please? I thought blocks were just an easy way of bundling varies fields etc together so that they could be easily re-used in other places throughout the app.
You are correct! You are going to reuse the block inside your list or table that will be rendered n times (n = the lenght of your list).
You are going to create a block with a ProductID as an input param. Then you can fecth data using an Aggregate to do the same query you had matching ProductFeature.ProductId = ProductId (input param) like the previous you had.
You can then place it inside of your table/list and match the blocks input parameter as the GetOrderItemsByOrderId.List.Current.OrderItem.ProductId from your list/table.
Hope to help out! If you aren't being able to do it, please say so and I'll try to pop up an example on the Order Management scenario (during today)
Kind regards,
Note that there can be other ways to solve your problem (for instance a subquery that returns the csv of the features, inside the main query in an advanced sql node) and you should use what better suits you.
Thank you, I think I understand the concept but I am struggling to implement it. If you are able to give an example that would be so helpful please.