关于购物车的代码修改~~小女子请求帮助~~~
二次开发的项目~~ 我要在这个基础上修改
1.原来它的代码是 它接收一件商品的id通过页面传值过来,到这里
ProfileCommon Profile = new ProfileCommon();
string itemId = Request.QueryString["addItem"];
if (!string.IsNullOrEmpty(itemId))
{
Profile.ShoppingCart.Add(itemId);
HttpContext.Current.Profile.Save();
Response.Redirect("~/ShoppingCart.aspx", true);
}
2..............ProfileCommon()是这个里面的
public virtual YXShop.BLL.Cart ShoppingCart
{
get
{
return ((YXShop.BLL.Cart)(HttpContext.Current.Profile.GetPropertyValue("ShoppingCart")));
}
set
{
this.SetPropertyValue("ShoppingCart", value);
}
}
3..YXShop.BLL.Cart里面的
public void Add(string ProId)
{
CartItemInfo cartItem;
if (!cartItems.TryGetValue(ProId, out cartItem))
{
Item item = new Item();
ItemInfo data = item.GetItem(ProId);
if (data != null)
{
CartItemInfo newItem = new CartItemInfo(data.Makeprice, data.ProductName, 1, (decimal)data.Price, data.CategoryId, Convert.ToInt32(ProId), data.Integral, data.Image, data.NeedIntegral, data.NeedDummyMoney, data.PutoutTyID, data.PutoutID);
cartItems.Add(ProId, newItem);
}
}
else
{
cartItem.Quantity++;
}
}
4..这是前台显示购物车的代码
#region 购车信息
public static string ShoppingCartControl()
{
ProfileCommon Profile = new ProfileCommon();
StringBuilder shtml = new StringBuilder();
ICollection<CartItemInfo> cart = Profile.ShoppingCart.CartItems;
if (cart.Count > 0)
{
YXShop.Common.SystemicParameter.SystemicParameters();
if (YXShop.Common.SystemicParameter.GeldMode == 1)
{
shtml.Append("<div id=\"ShopInfo\">");
foreach (CartItemInfo info in cart)
{
shtml.Append("<ul class=\"shop4\">");
shtml.Append("<li class=\"shop4-1\"><input type=\"checkbox\" name=\"ShoppCartID\" value=\"" + info.ProductId + "\"></li>");
shtml.Append("<li class=\"shop4-2\"><img src=\"" + YXShop.Common.SystemicParameter.DummyList + info.Image + "\" width=\"83px\" height=\"60px\"></li>");
shtml.Append("<li class=\"shop4-3\">" + info.ProductName + "</li>");
shtml.Append("<li class=\"shop4-4\"><span style=\"color:#FF6600\">" + info.MarckerPricr + "</span></li>");
shtml.Append("<li class=\"shop4-7\"><span style=\"color:#FF6600; font-w