Update multiple cart items quantity. Spring Boot – Thymeleaf

I need help with updating a list of Cart Items quantity in my cart from a submit button, I’m clueless. I have successfully added the cart items on the carts page, I just help and tips with updating the List of Cart Items when changes are been made to the quantity of the individual items. Thanks

//Iterating over the cartItems to be displayed on the carts page

<tr th:each="cartItem : ${cart.cartItems}">                                                  <td class="product-name">                             <h2 class="h5 text-black" th:text="${cartItem.product.productName}">Polo Shirt</h2>                         </td>                         <td th:text="${'₦' + #numbers.formatDecimal(cartItem.product.newPrice, 0, 'COMMA', 0, 'POINT')}">$49.00</td>                         <td>                             <div class="input-group mb-3"  style="max-width: 120px;">                                 <div class="input-group-prepend">                                     <button class="btn btn-outline-primary js-btn-minus qty-down" type="button">−</button>                                 </div>                                 <input type="number" class="form-control quantity text-center" th:value="${cartItem.quantity}" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">                                 <div class="input-group-append">                                     <button class="btn btn-outline-primary js-btn-plus qty-up" type="button">+</button>                                 </div>                             </div>                          </td>                         <td th:text="${'₦' + #numbers.formatDecimal(cartItem.price, 0, 'COMMA', 0, 'POINT')}"></td>                         <td><a th:href="${'/cart/removeCartItem/' + cartItem.cartItemId}" class="btn btn-primary height-auto btn-sm">X</a></td>                     </tr>   <div class="col-md-6 mb-3 mb-md-0">                     <button class="btn btn-primary btn-sm btn-block">Update Cart</button>                 </div>                          
Professor Asked on October 18, 2020 in Android langue.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.