首页 / PHP / 商城-如何把相同的订单号合并到一起?
商城-如何把相同的订单号合并到一起?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了商城-如何把相同的订单号合并到一起?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4694字,纯文字阅读大概需要7分钟。
内容图文
![商城-如何把相同的订单号合并到一起?](/upload/InfoBanner/zyjiaocheng/245/bdd5ca8398d3421cb9e86d06930fa35d.jpg)
/**********定单基本信息表******************/
drop table if exists sh_order;
create table sh_order
(
id mediumint unsigned not null auto_increment,
order_sn char(16) not null comment '定单编号',
member_id mediumint unsigned not null comment '会员id',
addtime int unsigned not null comment '下单时间',
pay_status enum("是","否") not null default '否' comment '支付状态',
post_status enum("是","否") not null default '否' comment '发货状态',
total_price decimal(10,2) not null comment '总价',
postage decimal(10,2) not null comment '邮费',
pay_time int unsigned not null default '0' comment '付款时间',
pay_method enum("支付宝") not null default '支付宝' comment '支付方式',
post_method enum("顺风","圆通") not null comment '配送方式',
shr_name varchar(30) not null comment '收货人',
shr_province varchar(30) not null comment '收货人省',
shr_city varchar(30) not null comment '收货城市',
shr_area varchar(30) not null comment '收货地区',
shr_address varchar(150) not null comment '收货地址',
shr_postcode varchar(30) not null comment '收货邮编',
shr_mobile varchar(30) not null comment '收货人手机',
primary key (id),
key member_id(member_id),
key order_sn(order_sn),
key addtime(addtime)
)engine=InnoDB default charset=utf8 comment '定单基本信息表';
/****************订单商品表**************************/
drop table if exists sh_order_goods;
create table sh_order_goods
(
id mediumint unsigned not null auto_increment,
order_id mediumint unsigned not null comment '定单id',
goods_id mediumint unsigned not null comment '商品id',
goods_name varchar(60) not null comment '商品名称',
goods_attr_id varchar(150) not null default '' comment '商品属性id',
price decimal(10,2) not null comment '购买时的价格',
goods_number int unsigned not null comment '购买的数量',
primary key (id),
key order_id(order_id),
key goods_id(goods_id)
)engine=InnoDB default charset=utf8 comment '定单商品表';
/**************商品表*******************/
drop table if exists sh_goods;
create table sh_goods
(
id mediumint unsigned not null auto_increment,
sm_logo varchar(150) not null default '' comment 'logo的缩略图路径(150*150)',
logo varchar(150) not null default '' comment 'logo的路径',
sm_show_pic varchar(150) not null default '' comment '展示图的缩略图路径(150*150)',
show_pic varchar(150) not null default '' comment '展示图的原图路径',
goods_brand_id mediumint unsigned not null comment '商品品牌id',
goods_name varchar(60) not null comment '商品名称',
market_price decimal(10,2) not null comment '市场价',
shop_price decimal(10,2) not null comment '本店价',
is_on_sale enum('是','否') not null default '是' comment '是否上架',
goods_number mediumint unsigned not null default '0' comment '库存量',
type_id mediumint unsigned not null default '0' comment '类型id',
goods_desc text comment '商品描述',
order_num tinyint unsigned not null default '100' comment '排序数字',
addtime int unsigned not null comment '添加时间',
primary key (id),
key shop_price(shop_price),
key is_on_sale(is_on_sale),
key addtime(addtime),
key order_num(order_num)
)engine=MyISAM default charset=utf8 comment '商品';
/**************商品属性表************************/
drop table if exists sh_goods_attr;
create table sh_goods_attr
(
id mediumint unsigned not null auto_increment,
goods_id mediumint unsigned not null comment '商品id',
attr_id mediumint unsigned not null comment '属性id',
attr_value varchar(150) default '' not null comment '属性的值',
primary key (id),
key goods_id(goods_id),
key attr_id(attr_id)
)engine=MyISAM default charset=utf8 comment '商品属性';
// Model模型中,根据会员ID从数据库中取出会员自己的订单,
public function getOrder($mid)
{
$orderModel = M('Order');
$orderData = $orderModel->field('a.order_sn, a.addtime, a.shr_name,
c.goods_name, c.sm_logo, b.goods_number,
b.price, d.attr_value, a.postage, a.post_status')
->alias('a')->join('LEFT JOIN sh_order_goods b ON a.id = b.order_id')->
join('LEFT JOIN sh_goods c ON b.goods_id = c.id')->
join('LEFT JOIN sh_goods_attr d ON b.goods_attr_id = d.id')
->where('a.member_id='.$mid)->select();
}
//在Controller控制器用户中心里调用
public function center()
{
if(session('id'))
{
$mid = session('id');//session('id')就是会员ID
$memberModel = D('Member/Member');
$orderData = $memberModel->getOrder($mid);
$this->assign('orderData',$orderData);
}
else
{
redirect('login');
}
$this->display();
}
HTML页面中输出:
$v):?>
取消订单
怎样把订单号相同的合并起来呢,我该怎样改变数组结构呢?类似淘宝的订单
内容总结
以上是互联网集市为您收集整理的商城-如何把相同的订单号合并到一起?全部内容,希望文章能够帮你解决商城-如何把相同的订单号合并到一起?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。