开发者

Shopping Cart design in ASP.NET

开发者 https://www.devze.com 2023-02-09 09:07 出处:网络
I\'m designing an ASP.NET store with shopping cart capabilities. A shopping cart consists of cart items which themselves consist of a 开发者_Go百科of a ProductID, Qty, UnitPrice.

I'm designing an ASP.NET store with shopping cart capabilities. A shopping cart consists of cart items which themselves consist of a 开发者_Go百科of a ProductID, Qty, UnitPrice.

Right now, I save the information about user's shopping cart in a session variable. The problem is, when the user clicks on checkout, he/she will be redirected to a third party site (e.g Paypal) to complete the process. So, I have to save the data to DB for later references and because session state may expire until the user comes back from the payment page.

I think a solution would be to save the cart information with a time stamp on DB just before redirecting user to the third party site and delete expired cart items (e.g. + 30 minutes old) in db periodically.

  1. I'd like to know if there's a better approach that you suggest.
  2. If my approach is acceptable, where would you recommend I put the code for checking the expired carts on db?


Another solution would be to save the shopping cart to DB and delete it only after the order will be processed successfully. In this way the user can log out and login again and keep the shopping cart between the sessions. I think this is a common solution for this. You can try this on amazon and some other similar sites.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号