我想將購物車中的商品傳遞給paypal並且收到以下錯誤:paypal ipn在mvc音樂商店問題
對象引用未設置爲對象的實例。
我的代碼是:
<%@頁面語言= 「C#」 的MasterPageFile = 「〜/查看/共享/的Site.Master」 繼承= 「System.Web.Mvc.ViewPage」 %> 地址和支付
<h1>Checkout with PayPal</h1>
<form id="PayPal" name="PayPal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="[email protected]" />
<% foreach (var item in Model.CartItems)
{ %>
<%=Html.Hidden("item_name" + item.Count.ToString(), item.Design.Title)%>
<%=Html.Hidden("amount" + item.Count.ToString(), item.Design.Price)%>
<%=Html.Hidden("quantity" + item.Count.ToString(), item.Count.ToString())%>
<%=Html.Hidden("shipping" + item.Count.ToString(), 0)%>
<%=Html.Hidden("handling" + item.Count.ToString(), 0)%>
<% } %>
<input type="image" src="https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image" align="left" />
該錯誤是突出它的foreach em在Model.CartItems中 - 但是在上一頁中,此項目不爲空。似乎這個項目是空的。
您能否請您在控制器中爲這兩個頁面發佈Action代碼。 – 2010-12-05 21:38:56