如何实施购物车系统 [英] How to implement cart system

查看:84
本文介绍了如何实施购物车系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在尝试在我的网站中实施购物车系统.为此,我允许客户选择多种产品.他们还可以删除所选的产品.因此,请告诉我如何以及在何处存储所选值信息,以便可以访问下一页,所有已选择产品的内容.

谢谢

Hi I am trying to implement shopping cart system in my website. For that I am allowing a customer to select the multiple product.they can also remove the selected product. So please tell me how and where to store selected value information so that It can be accessed to next page, what are all the product has selected.

Thank You

推荐答案

如果您 ^ ]可能会找到一些帮助.
If you look here[^] you may find some help.


您可以创建一个处理CartItem并将其存储在Session上的类.这样,您可以在其他页面上访问它.

类CartItem
You can create a Class that will handle the CartItem and store it on a Session. That way, you can access it on your other page.

Class CartItem
public class CartItem {
   public decimal TotalCost { get; set; }
   public List<string> Items { get; get; }
}
</string>



第1页



Page 1

Session["CartItems"] = cartItems;



第2页



Page 2

CartItems itemsFromPage2 = Session["CartItems"] != null ? (CartItems)Session["CartItems"] : null;


这篇关于如何实施购物车系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆