如何实现ASP.NET购物车?

时间:2022-09-02 13:29:44

I tried to find similar questions but with no luck. Anybody can give me an idea how to build a Shopping Cart in ASP.NET the best practice way?

我试图找到类似的问题,但没有运气。任何人都可以告诉我如何在ASP.NET中构建购物车的最佳实践方式?

I know a wayto use Session but I think it would be painful to maintain the Session across pages. I've heard also to use Profile.

我知道使用Session的方法,但我认为跨页面维护Session会很痛苦。我也听说过使用Profile。

So which one do I have to choose? Which one is the best and most recommended solution?

那么我必须选择哪一个?哪一个是最好的和最推荐的解决方案?

3 个解决方案

#1


10  

I've built many using the following methods:

我使用以下方法构建了许多:

  • Create a Database Table Called ShoppingCart
  • 创建一个名为ShoppingCart的数据库表

  • Store a Your ASP.NET session as Foreign Key
  • 将您的ASP.NET会话存储为外键

  • Either Add a ProductID per row or store a list of ProductIDs per row. This usually depends on if you have meta data you need to store about each product, such as quantity or size. The more meta data, the easier it is to manage if you store one product per row.
  • 每行添加一个ProductID或每行存储一个ProductID列表。这通常取决于您是否需要存储有关每个产品的元数据,例如数量或大小。元数据越多,每行存储一个产品就越容易管理。

A good book that covers e-commerce is the APress book "Beginning ASP.NET 2.0 E-Commerce".

一本涵盖电子商务的好书是APress的书“Beginning ASP.NET 2.0 E-Commerce”。

#2


4  

Seems a bit vague question, I presume you asking how to build the whole application which is hard to answer in brief

似乎有点模糊的问题,我猜你问如何构建整个应用程序,这很难简单回答

Googling pulled up an excellent article:

谷歌搜索了一篇优秀的文章:

http://net.tutsplus.com/tutorials/other/build-a-shopping-cart-in-aspnet/

also look at this:

还看看这个:

http://codebetter.com/blogs/david.hayden/archive/2005/03/22/60166.aspx

Regarding session state, from my experience, sessionstate is useful on a single server set up, but if you thinking ahead and need scalability to web farm scenario, additional issues arise with serialising data. This is needed when storing session state in sql server. adding a lot of complexity to your application.

关于会话状态,根据我的经验,sessionstate在单个服务器设置上很有用,但如果您提前思考并需要Web场景的可扩展性,则序列化数据会产生其他问题。在sql server中存储会话状态时需要这样做。为您的应用程序增加了很多复杂性。

#3


0  

I think, that good way is use turn-key e-commerce solution. For example: http://advantshop.com/

我认为,好的方法是使用交钥匙电子商务解决方案。例如:http://advantshop.com/

#1


10  

I've built many using the following methods:

我使用以下方法构建了许多:

  • Create a Database Table Called ShoppingCart
  • 创建一个名为ShoppingCart的数据库表

  • Store a Your ASP.NET session as Foreign Key
  • 将您的ASP.NET会话存储为外键

  • Either Add a ProductID per row or store a list of ProductIDs per row. This usually depends on if you have meta data you need to store about each product, such as quantity or size. The more meta data, the easier it is to manage if you store one product per row.
  • 每行添加一个ProductID或每行存储一个ProductID列表。这通常取决于您是否需要存储有关每个产品的元数据,例如数量或大小。元数据越多,每行存储一个产品就越容易管理。

A good book that covers e-commerce is the APress book "Beginning ASP.NET 2.0 E-Commerce".

一本涵盖电子商务的好书是APress的书“Beginning ASP.NET 2.0 E-Commerce”。

#2


4  

Seems a bit vague question, I presume you asking how to build the whole application which is hard to answer in brief

似乎有点模糊的问题,我猜你问如何构建整个应用程序,这很难简单回答

Googling pulled up an excellent article:

谷歌搜索了一篇优秀的文章:

http://net.tutsplus.com/tutorials/other/build-a-shopping-cart-in-aspnet/

also look at this:

还看看这个:

http://codebetter.com/blogs/david.hayden/archive/2005/03/22/60166.aspx

Regarding session state, from my experience, sessionstate is useful on a single server set up, but if you thinking ahead and need scalability to web farm scenario, additional issues arise with serialising data. This is needed when storing session state in sql server. adding a lot of complexity to your application.

关于会话状态,根据我的经验,sessionstate在单个服务器设置上很有用,但如果您提前思考并需要Web场景的可扩展性,则序列化数据会产生其他问题。在sql server中存储会话状态时需要这样做。为您的应用程序增加了很多复杂性。

#3


0  

I think, that good way is use turn-key e-commerce solution. For example: http://advantshop.com/

我认为,好的方法是使用交钥匙电子商务解决方案。例如:http://advantshop.com/