Developer forum

Forum » Ecommerce - Standard features » Matrix view of orderlines in Cart

Matrix view of orderlines in Cart

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a project running DW 9.7.x where I have received a request to display the orderlines in a matrix view like this screenshot: https://www.screencast.com/t/3yfZuHEdfW

Any idea how I should approach this grouping it in the most efficient way?

Maybe some cart API that would help me get what I need?

Thank you,
Adrian

 


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Adrian,

I think you need to handle this in your template by looping through the order lines and group them by product id and variant id / variant options.
This can be done by using dictionaries or some LINQ-fu. Once you have the information grouped then it should be simple to traverse this and render the matrix view.

You might be able to use the VariantInfos loop, which is rendered for each product, but I think you need an upgrade in order to use that.

It seems that your example would only work if...

  • All products have two levels of variants (color and size).
  • All variants of a product has the same unit price (850,00).
  • Units and stock locations are not being used.
  • There is no other important information on each order line, like points or custom order line details.

You should also consider how to present additional order lines, like discounts and taxes, if you are using any of those.

Best regards,
Morten

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Morten,

Thank you very much for your suggestion.

What minimum version is needed to have access to VariantInfos loop?

Thank you,

Adrian

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

The VariantInfos loop was introduced in Dynamicweb.Ecommerce 1.8.12 and is part of the 9.8.2 release.
However, there has been several improvements and bug fixes since then, so I would recommend that you upgrade to the latest version possible.

/Morten

 

You must be logged in to post in the forum