Posted on 22/08/2025 11:21:12
Hi John
When using items, you get all of them. When you use a group, you can only select one of them. So if the user should be able to only choose one add-on, use the group, if they need to be able to add more of them, use single items.
When you add a group to a bom product, the products in that group acts as the options. So you can add a 'product' called none with a 0 price. When you add the group you can also specify which of the products in that group should be default selected. Here you will choose the none product. But this will only work if the user can select only one add-on, and not all of them.
When adding a bundle to cart, Dynamicweb will always add one for each item - if you have not defined a default product for a BOM group, first or default will be added.
Instead you can try to override the quantity - and set that to 0:
PRODITEM32Quantity=0&PRODITEM33Quantity=0
So your template would be something like this:
<form action="" method="post">
<input type="hidden" name="productid" value='@GetValue("Ecom:Product.ID")' />
<input type="hidden" name="cartcmd" value="add" />
<input type="hidden" name="quantity" value="1" />
@foreach (LoopItem bomGroup in GetLoop("BOMConfigurators"))
{
<label>
<h4>@bomGroup.GetValue("Ecom:Product.Configurator.Name")</h4>
<input type="hidden" name='@bomGroup.GetValue("Ecom:Product.Configurator.ID")Quantity' value="0">
<select name='@bomGroup.GetValue("Ecom:Product.Configurator.ID")'>
<option value="">@bomGroup.GetValue("Ecom:Product.Configurator.NoneSelected.Text")</option>
@foreach (LoopItem bomProduct in bomGroup.GetLoop("ConfiguratorProducts"))
{
<option value='@bomProduct.GetValue("Ecom:Product.ID")'>
@bomProduct.GetValue("Ecom:Product.Name")
</option>
}
</select>
</label>
}
<button type="submit">Buy now</button>
</form>
Then you just have to make some logic to set quantity to 0 for none and 1 for all other items...