简单购物车的实现
2011-11-01 22:42
381 查看
购物车的实现
1、http://www.taobao.com
2、功能
1)商品展示――相关资料(基本描述、价格、名称、供应商情况、图片等)
2)购物车功能
购物车相当于现实中超市的购物车,但是网页实现的是虚拟的一种行为。用户可以在购物网站不同页面之间任意跳转,选购自己喜欢的商品――点击购买――订单 息――统一到付账台结账
购物车功能包括
1)添加商品――订购
2)删除商品
3)修改商品的购买数量(小计、总计)
4)清空购物车
3、 订单
详细信息表单
选择支付方式――支付宝接口
第一步:选择方法
关键:服务器要求识别每一个用户并且能维持与他们的联系。
HTTP:无状态(stateless)
Cookie、session session+mysql
Cookie: 是由服务器产生、存储在客户端一段信息记录
包含:域、(客户端浏览器上禁用的是服务器端行为)、路径、生存周期、变量名、变量值等
容量:每个cookie的大小4kb
占用服务器端资源少,浏览器允许存放300个cookie;
Cookie是浏览器内置的功能,浏览器关闭信息也不会丢失。
基于cookie技术实现的购物车需要开启cookie功能;
存在侵权问题;
Session:
特点:
不依赖于客户端设置(存放到服务器端)
Session与cookie更安全、信息更多;
会占用服务器资源
注意:
基于cookie:
使用URL:
Session方法
第二步:创建数据库
Db_shopping_car
用户表:登录(识别身份)
商品表:商品展示
订单表:实现订单
卖家
Createtable admin(
Id int unsigned not null primary key auto_increment,
Admin_name varchar(30) not null,
Admin_password varchar(30) not null,
Admin_photo varchar(100) not null,
Admin_email varchar(30) not null
);
买家
Create table customer(
Id int unsignednot null primary key auto_increment,
C_name varchar(30)not null,
C_pass varchar(30) not null,
C_photo varchar(100) not null,
C_questionvarchar(100) not null,
C_addressvarchar(300)not null,
C_email varchar(100)not null,
C_level char(1) not null,
C_num int not null,
);
客户反馈信息
Create table idea(
Id int unsigned not null primary keyauto_increment,
C_name varchar(30) not null,
C_photo varchar(100)not null,
New_message varchar(100) not null ,
Re_message varchar(100) not null,
New_time date not null,
Re_time date not null,
);
产品表
Create table produnct(
Idint unsigned not null primary key auto_increment,
P_namevarchar(20) not null, 商品的名字
P_type int not null, 商品的类别:日用百货,家电
产品类别表中id 为主键,该字段在 product 里应为外键
P_pricedecimal(10,2) not null, 商品的价格
P_quantityint not null, 商品的数量
P_imagevarchar(100) not null, 商品的图片
P_describevarchar text not null, 商品的简单描述
P_timevarchar(50) not null, // 商品的发布时间
P_zkfloat not null, //商品的折扣
P_publisheripvarchar(50) not null, // 发布得ip
P_updatetimevarchar(30) not null, //最后更新的时间
P_userip varchar(300) not null, //最后更新的用户
);
create table p_type(
Id int unsigned not null primaryu keyauto_increment,
Type_Name varchar(30) not null,
Desc text not null
);
第三部分 订单表
Create tableorders(
Order_id intunsigned not null primary key auto_increment,//订单序列号
Order_numvarchar(50) not null , //订单号------20111031_pid_phone
Order_email varchar(30) not null, 收件人信息
Order_user varchar(30) not null, 收件人姓名
Order_time varchar(50) not null, 订单时间
客户提交订单—商家确认—客户支付—商家发货-product表
Order_status enum (‘0’,’1’,’2’) not null
订单状态:未支付0、已支付未发货1、已支付已发货2
);
详细订单表
Createtable order_detail(
id int unsigned not null primary keyauto_increment,
Order_id int not null,
P_id int not null,
P_price decimal(10,2) not null,
P_des text not null,
P_num int not null,
P_zk float not null,
1、http://www.taobao.com
2、功能
1)商品展示――相关资料(基本描述、价格、名称、供应商情况、图片等)
2)购物车功能
购物车相当于现实中超市的购物车,但是网页实现的是虚拟的一种行为。用户可以在购物网站不同页面之间任意跳转,选购自己喜欢的商品――点击购买――订单 息――统一到付账台结账
购物车功能包括
1)添加商品――订购
2)删除商品
3)修改商品的购买数量(小计、总计)
4)清空购物车
3、 订单
详细信息表单
选择支付方式――支付宝接口
第一步:选择方法
关键:服务器要求识别每一个用户并且能维持与他们的联系。
HTTP:无状态(stateless)
Cookie、session session+mysql
Cookie: 是由服务器产生、存储在客户端一段信息记录
包含:域、(客户端浏览器上禁用的是服务器端行为)、路径、生存周期、变量名、变量值等
容量:每个cookie的大小4kb
占用服务器端资源少,浏览器允许存放300个cookie;
Cookie是浏览器内置的功能,浏览器关闭信息也不会丢失。
基于cookie技术实现的购物车需要开启cookie功能;
存在侵权问题;
Session:
特点:
不依赖于客户端设置(存放到服务器端)
Session与cookie更安全、信息更多;
会占用服务器资源
注意:
基于cookie:
使用URL:
Session方法
第二步:创建数据库
Db_shopping_car
用户表:登录(识别身份)
商品表:商品展示
订单表:实现订单
卖家
Createtable admin(
Id int unsigned not null primary key auto_increment,
Admin_name varchar(30) not null,
Admin_password varchar(30) not null,
Admin_photo varchar(100) not null,
Admin_email varchar(30) not null
);
买家
Create table customer(
Id int unsignednot null primary key auto_increment,
C_name varchar(30)not null,
C_pass varchar(30) not null,
C_photo varchar(100) not null,
C_questionvarchar(100) not null,
C_addressvarchar(300)not null,
C_email varchar(100)not null,
C_level char(1) not null,
C_num int not null,
);
客户反馈信息
Create table idea(
Id int unsigned not null primary keyauto_increment,
C_name varchar(30) not null,
C_photo varchar(100)not null,
New_message varchar(100) not null ,
Re_message varchar(100) not null,
New_time date not null,
Re_time date not null,
);
产品表
Create table produnct(
Idint unsigned not null primary key auto_increment,
P_namevarchar(20) not null, 商品的名字
P_type int not null, 商品的类别:日用百货,家电
产品类别表中id 为主键,该字段在 product 里应为外键
P_pricedecimal(10,2) not null, 商品的价格
P_quantityint not null, 商品的数量
P_imagevarchar(100) not null, 商品的图片
P_describevarchar text not null, 商品的简单描述
P_timevarchar(50) not null, // 商品的发布时间
P_zkfloat not null, //商品的折扣
P_publisheripvarchar(50) not null, // 发布得ip
P_updatetimevarchar(30) not null, //最后更新的时间
P_userip varchar(300) not null, //最后更新的用户
);
create table p_type(
Id int unsigned not null primaryu keyauto_increment,
Type_Name varchar(30) not null,
Desc text not null
);
第三部分 订单表
Create tableorders(
Order_id intunsigned not null primary key auto_increment,//订单序列号
Order_numvarchar(50) not null , //订单号------20111031_pid_phone
Order_email varchar(30) not null, 收件人信息
Order_user varchar(30) not null, 收件人姓名
Order_time varchar(50) not null, 订单时间
客户提交订单—商家确认—客户支付—商家发货-product表
Order_status enum (‘0’,’1’,’2’) not null
订单状态:未支付0、已支付未发货1、已支付已发货2
);
详细订单表
Createtable order_detail(
id int unsigned not null primary keyauto_increment,
Order_id int not null,
P_id int not null,
P_price decimal(10,2) not null,
P_des text not null,
P_num int not null,
P_zk float not null,
相关文章推荐
- tornado websocket编程(1) 初识websocket ——简单购物车实现
- angularjs实现简单的购物车功能
- 简单的购物车实现 +多选框
- 使用session对购物车的简单实现(oracle数据库+数据源)
- 简单购物车的实现
- Servlet的Model2模型详解及简单购物车的实现
- bootstrap+vue.js实现简单的购物车功能
- 购物车的简单实现
- redis 哈希数据类型简单操作(实现购物车案例)
- 用servlet实现一个简单的购物车程序
- jquery学习笔记-购物车表单简单实现
- JavaWeb基础+oracle实现简单简单分页商品浏览与加入购物车系统
- Python Django实现简单购物车功能
- 利用JQuery实现简单的购物车结算
- AngularJs实现简单的购物车
- 用Cookie和Session简单实现购物车
- 一个购物车的简单实现(多层开发)
- JAVAEE中用Session简单实现购物车功能示例代码
- Session对象的应用:实现简单的购物车的功能
- 购物车的简单实现