Posted on 17/12/2021 03:30:30
Hi,
Thank you for the respond.
I am trying to use add Multi for reorder function based on Cart Commands (dynamicweb.com) in Swift and it does not work. Perhaps I am doing it wrong?
Code:
<form method="post" class="col-md-12">
@foreach (var orderline in order.OrderLines)
{
if(orderline.ProductId != "")
{
Count = Count +1;
string ProductLoopCounter = "ProductLoopCounter" + Count;
string ProductIDCounter = "ProductID" + Count;
string QuantityCounter = "Quantity" + Count;
<input type="text" name="@ProductLoopCounter" id="@ProductLoopCounter" value="@Count" />
<input type="text" name="@ProductIDCounter" id="@ProductIDCounter" value="@orderline.ProductId" />
<input type="text" name="@QuantityCounter" value="@orderline.Quantity" />
}
}
<!--One button to add to cart-->
<button class="btn btn-primary pull-right" type="submit" name="CartCmd" value="addmulti">Addmulti</button>
<button class="btn btn-primary pull-right" type="submit" name="CartCmd" value="setmulti">Setmulti</button>
</form>
But when I try to use CartCmd=Add, it is working.
Code:
@foreach (var orderline in order.OrderLines)
{
if(orderline.ProductId != "")
{
<p>@orderline.ProductName</p>
<form method="post" class="col-md-12">
<input type="hidden" name="ProductId" value="@orderline.ProductId" />
<input type="hidden" name="VariantId" value="@orderline.ProductVariantId" />
<button class="btn btn-primary pull-right" type="submit" name="CartCmd" value="Add">Add</button>
</form>
}
}
I attached the code file just in case.
Thank you and regards,
Rivan