星联网络专注帝国CMS二次功能插件开发-精品网站模板站长代码素材

  • 最近更新
  • 模板:33
  • 记录:12641|
  • 插件:52|
  • 工具:4|
  • 代码:8|
  • 评论:0

织梦cms二次开发订单导出excel表格

前言

本文主要讲解《织梦cms二次开发订单导出excel表格》的详细内容

可选择导出指定的订单,不选就是导出全部

导出的excle文件按当前时间命名

导出的excel文件请用wps软件打开,office软件下可能会乱码

1、打开 /dede/shops_operations.php 找到

1 elseif($dopost=='delete')

在它上面加入

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 elseif($dopost=='out') { header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=".date("Y-m-d-H-i-s").".xls");echo"<table><tr>";echo"<th>订单号</th>";echo"<th>商品名称</th>";echo"<th>单价(元/单位)</th>";echo"<th>数量</th>";echo"<th>支付方式</th>";echo"<th>配送费</th>";echo"<th>购买时间</th>";echo"<th>收货人</th>";echo"<th>地址</th>";echo"<th>邮编</th>";echo"<th>联系电话</th>";echo"<th>邮箱</th>";echo"<th>留言</th>";echo"<th>合计(元)</th>";echo"<th>状态</th>";echo"</tr>"; $wh='';if(!empty($nid)) { $nids=explode('`',$nid);foreach($nidsas$n) {if($wh=='')$wh="WHEREo.oid='$n'";else$wh.="ORo.oid='$n'"; } } $sql="SELECTo.*,p.title,p.priceasuprice,d.dname,u.*FROMxjq_shops_ordersasoleftjoinxjq_shops_productsaspono.oid=p.oidleftjoinxjq_shops_deliveryasdond.pid=o.pidLEFTJOINxjq_shops_userinfoASuONo.oid=u.oid$wh"; $dsql->SetQuery($sql); $dsql->Execute('t');while($arr=$dsql->GetArray('t')) {echo"<tr>";echo"<td>".$arr['oid']."</td>";//订单号 echo"<td>".$arr['title']."</td>";//商品名称 echo"<td>".$arr['uprice']."</td>";//单价 echo"<td>".$arr['cartcount']."</td>";//数量 echo"<td>".GetsType($arr['paytype'])."</td>";//支付方式 echo"<td>".$arr['dname']."费用:".$arr['dprice']."元</td>";//配送费 echo"<td>".GetDateTimeMk($arr['stime'])."</td>";//购买时间 echo"<td>".$arr['consignee']."</td>";//收货人 echo"<td>".$arr['address']."</td>";//地址 echo"<td>".$arr['zip']."</td>";//邮编 echo"<td>".$arr['tel']."</td>";//联系电话 echo"<td>".$arr['email']."</td>";//邮箱 echo"<td>".$arr['des']."</td>";//留言 echo"<td>".$arr['priceCount']."</td>";//合计 echo"<td>".GetSta($arr['state'])."</td>";//状态 echo"</tr>"; }echo"</table>";exit(); }

2、打开 /dede/shops_operations.htm 找到

1 <inputtype="button"name="b9"value="设为已完成状态"class='npcoolbg'style="width:100"onClick="OkSel();">复制

在它下面加入

1 <inputtype="button"name="b9"value="导出选中订单"class='npcoolbg'style="width:100"onClick="OutSel();">复制

继续找到

1 functionPushSel(){

在它上面加入

1 2 3 functionOutSel(){varnid=getCheckboxItem(); location.href="shops_operations.php?dopost=out&nid="+nid; }

完成,看清楚教程,有的是在下面加入有的是在上面加入的。

修改到此结束,需要此功能的小伙伴赶紧试试吧。

本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。

本文地址:http://www.xlkjgs.com/notes/web/6595.html

以上内容由本站整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!

星联网络

星联网络是中国最具实战的互联网创业者的知识服务商,这里有互联网行业动态,网络推广,SEO优化,SEM优化,ESC配置,行业经验分型,互联网项目,微信营销、淘宝客赚钱、新媒体营销、京东运营、跨境电商等众多互联网营销知识分享

站长运营站长必备网站运营之道才能长久发展