2014-03-26 5 views
1

ASP.NET MVC에서 View ShoppingCart을 만들었습니다. 4. ProductName, Price 및 Quantity에 대한 텍스트 상자를 완전히 만들었습니다. Quantity 레이블에서 Ajax을 사용하여 사용자가 제품의 quanity를 입력하고 업데이트 할 수있는 버튼을 만들었습니다. 이제 각 Product에 대해 Sub-Total을 생성하려고합니다. 부탁을 들어 줄 수 있겠 니? 쇼핑 카트의장바구니에 소계 추가

요약 :

@{int ix = 0;} 

    @foreach (var item in Model.CartItems) 
    { 
     <tr id="[email protected]"> 

      <td> 
       @Html.ActionLink(item.Product.Name, "Details", "Bike", new {id = item.ShoppingCartItemID},null) 
      </td> 
      <td> 
       @item.Product.ListPrice 
      </td> 

      <td> 
       @Html.TextBoxFor(model => model.CartItems[ix].Quantity, new {Styles = "width:3px; text-align:right; size:2" }) 
      </td> 

      <td> 
       <a href="#" class="RefreshQuantity" data-id="@item.ShoppingCartItemID" data-txt-id="[email protected](ix)__Quantity" >Update</a> 
       &nbsp;|&nbsp; 
       @Html.ActionLink("Remove","RemoveCart","ShoppingCart", new {id = item.ShoppingCartItemID},null) 

      </td> 
      <td> 
       //Sub-Total ??? 
      </td> 

    </tr> 
    ix++; 
} 

답변

1

이 쉽게 기존의 일부 쇼핑 카트를 사용하지 않을까요? 예 : nopCommerce