Developer forum

Forum » Rapido » Rendering size variantoptions

Rendering size variantoptions

Søren Bremholm Jakobsen
Reply

Hi,

trying to modify the rapido product template to render size options based on the variant color selection. It a size variant is sold out the size should be disabled. I have unsuccessfully tried to modify the product feed template to disable the variant option with no stock. Any idears or suggestions?

foreach (LoopItem variantcombination in variantoption.GetLoop("VariantCombinations"))

{

if (variantcombination.GetDouble("Ecom:VariantCombination.Product.Stock") > 0)

{

variantOptionObject.disabled = "";

variantOptionObject.stock = GetDouble("Ecom:VariantCombination.Product.Stock");

}

else

{

variantOptionObject.disabled = "disabled";

variantOptionObject.stock = GetDouble("Ecom:VariantCombination.Product.Stock");

}

}


Replies

 
Nicolai Pedersen
Reply

Default Rapido does that... See http://rapidodemo.dynamicweb-cms.com/products/clothing/men/descente-short-sleeve-jersey

Click size medium.

BR Nicolai

 
Søren Bremholm Jakobsen
Reply

Is it because of the stock status option on the product?

 
Nicolai Pedersen
Reply

You have a loop called variantstockcombinations that will tell you which combinations are in stock. Based on that, it will de-activate combinations that are inactive.

NP

 
Søren Bremholm Jakobsen
Reply

have tried to change to DW standard product and product feed templates in or solution but I'm still able to select combinations that are out of stock

 
Andrew Rushworth
Reply

This only seems to work for combinations (i.e when ther are two dimensions, colour and size, etc). For products with a single dimension (i.e. just colour) it only shows as out of stock when the user selects the option.

 
Andrew Rushworth
Reply

And going through the tags in the variant lists there is no stock available tag.

 
Andrew Rushworth
Reply

Sorry, just found VariantStockCombinations loop that gives the information

 

You must be logged in to post in the forum