大家先看我的购物网站数据库表设计:
category表:
id
code
name
descriptionclient表
id
username
password
email
phoneorder表
id
ownerid
no
cdate
udate
receiver
address
phone
comments
status
reason
cancelerid

order_item表

id
oid
pid
amount
price
famountproduct表
id
cid
name
code
price
description
image
onsale我想问的是这个购物车应该如何设计?与购物车相关的类是saleline和shoppingcart,entity包里还有个order类,这几个类中应该分别写什么呢?对购物车的流程还是有点模糊,能说一下大体流程吗?谢谢大家啦

解决方案 »

  1.   

    实体类: 
    1.商品类 goodsInfo 保存商品信息,例如: 编号,单价,类型等
    2.购物车类 shopcart, 属性: 商品类 对象,数量用户浏览商品时,点击 放入购物车
    这时先获取商品信息,然后保存在商品类对象中,数量为1
    session保存的key是商品类对象,value是商品数量
    保存前先判断session保存的value是否为空,
    如果为空,就把数量赋1,否则就加1