I'm trying to add a configurable product to the basket, but I'm struggeling with getting the options into the basket.
I have this structure:
- Main product (PROD1)
- First Config Group
- Option 1 (OPT11)
- Option 2 (OPT12)
- Second Config Group
- Option 1 (OPT21)
- Option 2 (OPT22)
- First Config Group
I have no problem listing the product, config groups and options. But I cant find out how the form fields should look.
This is what I got now:
<form method="post" action="/Default.aspx?ID=@GetPageIdByNavigationTag("CartService")&LayoutTemplate=Swift_MiniCart.cshtml">
<input type="hidden" name="redirect" value="false" />
<input type="hidden" name="cartcmd" value="add" />
<input type="hidden" name="ProductId" value="PROD1">
<input type="hidden" id="Quantity" name="Quantity" value="1" />
<button type="button" onclick="swift.Cart.Update(event)" class="btn btn-primary js-add-to-cart-button" title="Add to cart" id="AddToCartButtonBom_PROD1">Add</button
</form>
And it does add my main configurable product to the basket, but no options.
So I added the options:
<input type="hidden" name="redirect" value="false" />
<input type="hidden" name="cartcmd" value="add" />
<input type="hidden" name="ProductId" value="PROD1">
<input type="hidden" id="Quantity" name="Quantity" value="1" />
<!-- Loop config groups -->
<select name="">
<!-- Loop config group options -->
<option name="" value="">Option name</option>
<!-- Loop config group options end -->
</select>
<!-- Loop config groups end -->
<button type="button" onclick="swift.Cart.Update(event)" class="btn btn-primary js-add-to-cart-button" title="Add to cart" id="AddToCartButtonBom_PROD1">Add</button
</form>
The thing I'm missing I guess is the name and value for the options, and the name for the select.
What values should be there? Does anyone have an example of the produced HTML for a configurable product?