Hi
When trying to add variants as BOM items by product number the main product is added instead. I also tried submitting a Product ID / Variant ID combination found in template tags with the same result. What am I missing? :)
Please have a look at the code below.
Kind regards,
Roald
<table>
@foreach (LoopItem bomconfig in GetLoop("BOMConfigurators"))
{
var productItemId = bomconfig.GetString("Ecom:Product.Configurator.ID");
var productItemDataReader = Dynamicweb.Data.Database.CreateDataReader("Select ProductItemId, ProductItemQuantity FROM EcomProductItems WHERE ProductItemID = '" + productItemId + "'");
<tr>
<td class="padding-none u-no-border u-padding-bottom--lg">
<h6>@bomconfig.GetString("Ecom:Product.Configurator.Name")</h6>
<select name="@bomconfig.GetString("Ecom:Product.Configurator.ID")" required class="u-w220px">
<option disabled selected value="">@Translate("Select")</option>
@foreach (LoopItem configproduct in bomconfig.GetLoop("ConfiguratorProducts"))
{
bool isVariantMaster = configproduct.GetBoolean("Ecom:Product:Field.ProductIsVariantMaster");
bool disabled = disableBomProductsOutOfStock && configproduct.GetInteger("Ecom:Product.Stock") <= 0;
string productName = configproduct.GetString("Ecom:Product.Name");
string shortDescription = null;
...
<option value="@configproduct.GetString("Ecom:Product.Number")" @configproduct.GetString("Ecom:Product.Configurator.Selected") @(disabled ? "disabled" : "")> @productName, @shortDescription </option>
}
</select>
@while (productItemDataReader.Read())
{
<input type="hidden" name="@bomconfig.GetString("Ecom:Product.Configurator.ID")Quantity" value="@productItemDataReader["ProductItemQuantity"].ToString()" />
break;
}
</td>
</tr>
}
</table>