Developer forum

Forum » Dynamicweb 10 » Show lowest variant price per master (Live Integration)

Show lowest variant price per master (Live Integration)

Jelle Deridder
Reply

Hi all,

On our PLP in Dynamicweb (Swift) we list masters only (no variants shown).
Per master, we want to display a "from price": the lowest variant price for that master, using Live Integration pricing.

We can see in the Live Integration logs (when loading the PLP) that the variant prices are being retrieved already.

What is the recommended approach/configuration in DW10 Swift to render the correct lowest variant price on the master?

Thanks,
Jelle


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jelle

In Swift-v2_ProductPrice.cshtml it should already be supported. The product contains a variantinfo that holds that information:

string? priceMin = product?.VariantInfo?.PriceMin?.PriceFormatted;
string? priceMax = product?.VariantInfo?.PriceMax?.PriceFormatted;
string price = !string.IsNullOrEmpty(unitId) ? product.GetPrice(unitId).Price.PriceFormatted : product?.Price.PriceFormatted;
price = priceMin != priceMax ? price = priceMin + " - " + priceMax : price;

The 'price' variable is the one we render.

The product viewmodel it self contains a sub viewmodel called variantinfo where you can drill down to the variants of a product - e.g. Color, material and sizes. It is a tree structure - the variantinfo contains information about the minimum or maxprice further down the tree. E.g. the cheapest and most expensive variant of a t-shirt will be on the top variantinfo sitting on the product viewmodel. Drilling further down you can get the cheapest/most expensive of the green t-shirt and the same for the red t-shirt - given that green and red t-shirts comes in different sizes or e.g. materials where the price differes. Hope that makes sense...

 
Jelle Deridder
Reply

Hi Nicolai,

Thanks for the quick reply!

Small nuance: we’re currently running Swift v1 (DW10). 
Is VariantInfo.PriceMin/PriceMax (as in Swift v2) also available/supported in Swift v1?
If not: what is the recommended approach/configuration in Swift v1 to show the minimum variant price at master level (without rendering variants on the PLP)?

Thanks in advance!

Best regards,
Jelle

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Yes - it is the same.

 

You must be logged in to post in the forum