您现在的位置是:首页 > 教程 > ecshop商城教程ecshop商城教程
ecshop首页显示最新交易订单的方法
陶旭笙2023-12-12 19:25:16ecshop商城教程已有人查阅
导读1. 在根目录修改index.php文件:2、在index.php最后面加一个函数:3.在模版文件夹themes\xxx\library\ 把原来order_query.lbi模板内容改为以下内容(注意备份原文件):
1. 在根目录修改index.php文件:
找到这行代码:
找到这行代码:
$smarty->assign('shop_notice', $_CFG['shop_notice']);// 商店公告
在这行代码下面加入这代码:
$smarty->assign('order_list', order_query()); // 首页订单
2、在index.php最后面加一个函数:
/**
* 调用订单滚动
*
* @access private
* @return array
*/
function order_query()
{
$sql = 'SELECT order_sn, add_time, order_status, pay_status, shipping_status FROM ' . $GLOBALS['ecs']->table('order_info') . ' ORDER BY order_id desc limit 0,20 ';/* 显示很新20条订单,可修改这个数来控制显示条数 */
$row = $GLOBALS['db']->getAll($sql);
/* 格式话数据 */
foreach ($row AS $key => $value)
{
$row[$key]['short_order_time'] = local_date('y-m-d', $value['add_time']);
/* 订单状态 */
if ($value['order_status'] == OS_CONFIRMED || $value['order_status'] == OS_UNCONFIRMED)
{
/* 订单付款状态 */
if ($value['pay_status'] == PS_UNPAYED)
{
$row[$key]['order_status'] = '未付款';
}
if ($value['pay_status'] == PS_PAYING)
{
$row[$key]['order_status'] = '付款中';
}
if ($value['pay_status'] == PS_PAYED)
{
$row[$key]['order_status'] = '已付款';
}
/* 订单付款状态结束*/
/* 订单发货状态 */
if ($value['shipping_status'] == SS_PREPARING)
{
$row[$key]['order_status'] = '制作中';
}
if ($value['shipping_status'] == SS_SHIPPED)
{
$row[$key]['order_status'] = '已配送';
}
if ($value['shipping_status'] == SS_RECEIVED)
{
$row[$key]['order_status'] = '收货确认';
}
/* 订单发货状态结束*/
}
if ($value['order_status'] == OS_CANCELED)
{
$row[$key]['order_status'] = '取 消';
}
if ($value['order_status'] == OS_INVALID)
{
$row[$key]['order_status'] = '无 效';
}
if ($value['order_status'] == OS_RETURNED)
{
$row[$key]['order_status'] = '退 货';
}
/* 订单状态结束*/
}
return $row;
}
3.在模版文件夹themes\xxx\library\ 把原来order_query.lbi模板内容改为以下内容(注意备份原文件):
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- {if empty($order_query)} -->
<script type="text/javascript">
//<![CDATA[
var invalid_order_sn = "{$lang.invalid_order_sn}"
//]]>
function gID(id)
{
return document.getElementById(id);
}
</script>
<div class="module">
<div class="order_query">
<div class="top"><span></span></div>
<div class="top_R">
<div class="content">
<div id="ordr_cs">
<div class="ordr_cs_arrow">订单查询</div><div class="ordr_cs_2" title="请输入订单号查询">
<form name="ecsOrderQuery" action="javascript:;" id="ecsOrderQuery">
<input type="text" name="order_sn" size="13" /> <input type="image" onclick="orderQuery()" value="提交" src="images/search-submit2.gif" align="top" />
</form>
</div>
</div>
<!-- //这是前20条订单循环开始-->
<div id="ECS_ORDER_QUERY" title="很新20条订单浏览">
<div id="ordr_top">
<div id="dgxj">订购时间</div><div id="ddh">订单号</div><div id="zt">状 态</div>
</div>
<div id=ordrdemo>
<ul id=ordrdemo1>
{foreach from=$order_list item=order}
<li><a href="user.php">{$order.short_order_time}<span id="order_sn">{$order.order_sn}</span><span id="order_status">{$order.order_status}</span></a></li>
{/foreach}
</ul>
<ul id=ordrdemo2></ul>
</div>
</div>
</div>
</div>
<div class="bottom"><span></span></div>
</div>
</div>
<script type="text/javascript">
var speed=50;
gID("ordrdemo2").innerHTML=gID("ordrdemo1").innerHTML;
function Marquee(){
if(gID("ordrdemo2").offsetTop-gID("ordrdemo").scrollTop<=0)
{
gID("ordrdemo").scrollTop-=gID("ordrdemo1").offsetHeight;
}
else
{
gID("ordrdemo").scrollTop++;
}
}
var MyMar=setInterval(Marquee,speed);
gID("ordrdemo").onmouseover=function() {clearInterval(MyMar);}
gID("ordrdemo").onmouseout=function() {MyMar=setInterval(Marquee,speed);}
</script>
<!-- //这是前20条订单循环结束-->
<!-- {else} -->
<div class="col-box-content">
<ul>
<!-- {if $order_query.user_id} -->
<li><strong>{$lang.order_number}</strong><br />
<a href="user.php?act=order_detail&order_id={$order_query.order_id}" >{$order_query.order_sn}</a>
</li>
<!-- {else} -->
<li><strong>{$lang.order_number}</strong><br />
{$order_query.order_sn}
</li>
<!-- {/if} -->
<li><strong>{$lang.order_status}</strong><br />
{$order_query.order_status}
</li>
<!-- {if $order_query.invoice_no } -->
<li><strong>{$lang.consignment}</strong><br />
{$order_query.invoice_no}
</li>
<!-- {/if} -->
<!-- {if $order_query.shipping_date} -->
<li><strong>{$lang.shipping_date}</strong><br />
{$order_query.shipping_date}
</li>
<!-- {/if} -->
</ul>
</div>
<!-- {/if} -->
4、在style.css文件中添加以下CSS样式(注意:不要同原CSS标记有冲突,有相同自己修改标记):
/** 首页订单上向滚动**/
#ECS_ORDER_QUERY
{ position: relative; width: ; height: 200px; text-align:center; top: -28px; }
.order_query{ width:240px; height: 240px; }
#order_sn{ position: relative; left: 8px; }
#order_status{ position: relative; left: 16px; }
#ordr_cs{ background:url(images/hisbg1.jpg) repeat-x; clear:both; width: 200px; /*分类标题背景重复部分*/
}
#ordr_top { position: relative; width: ; height: 18px; border-bottom: 1px solid orange;
parent;
}
#ordrdemo
{ position: relative; top: 5px; overflow:hidden; height:235px; float: left; }
#ordrdemo1
{ text-align: center; overflow:hidden; }
#ordrdemo1 a{ background-color: transparent; text-decoration:none; position: relative; left: 5px; float: left; cursor: pointer; }
#ordrdemo1 a:hover{ color:orange; background-color: transparent; text-decoration:none; position: relative; float: left; cursor: pointer; }
#ordrdemo1 li { font-family: Arial, Helvetica, sans-serif; height: 18px; text-align: center; width: 210px; border-top: 1px dashed orange; list-style-type: none; order-right-style: solid; }
#ordrdemo2 { text-align: center; overflow:hidden; width:210px; }
#ordrdemo2 a{ background-color: transparent; text-decoration:none; position: relative; left: 5px; float: left; cursor: pointer; }
#ordrdemo2 a:hover{ color:orange; background-color: transparent; text-decoration:none; position: relative; float: left; cursor: pointer; }
#ordrdemo2 li { font-family: Arial, Helvetica, sans-serif; height: 18px; text-align: center; width: 210px; border-top: 1px dashed orange; list-style-type: none; order-right-style: solid; }
.ordr_cs_2 { font:bold 13px Arial, Helvetica, sans-serif; color:#333333; position: relative; top: -34px; left: 47px; height:22px; padding:8px 0 0 35px;
/*分类标小图标和文字设置部分*/
}
.ordr_cs_arrow { font:bold 13px Arial, Helvetica, sans-serif; color:#333333; position: relative; left: -6px; height:22px; padding:8px 0 0 35px;
/*分类标小图标和文字设置部分*/
}
#dgxj { position: relative; left: -3px; width: 70px; height: 15px; float: left; margin: 0; }
#ddh { position: relative; left: 0; width: 70px; height: 15px; float: left; margin: 0; }
#zt { position: relative; left: 10px; width: 70px; height: 15px; float: left; margin: 0; }
.module{ width: ; margin-bottom:10px; display:block; clear:both;}
.module .top{ height:7px; background:url(images/bg_long.gif) repeat-x; font-size:1px; width: ; overflow:hidden; }
.module .top_R{ padding:0 12px 0 0; background:#fff url(images/borders_R.gif) repeat-y 0; }
.module .top span{height:7px; width:8px; float:right; height:8px; background:url(images/module_bg1.jpg) no-repeat top right; font-size:1px;}
.module .content{ padding:0 0 0 12px; background:#fff url(images/borders_L.gif) repeat-y; }
.module .bottom{height:7px; background:url(images/bg_long.gif) repeat-x 0 -15px; display:block; overflow:hidden; font-size:1px;}
.module .bottom span{height:7px; width:8px; float:right; background:url(images/module_bg2.jpg) no-repeat top right; font-size:1px;}
5、在需要显示滚动的模板处调用order_query.lbi或是在后台的设置模板处的前台订单状态查询打上勾:
<!-- #BeginLibraryItem "/libr
本文标签:
很赞哦! ()
相关文章
随机图文
-
ecshop商品详情页相关属性商品由新到旧排序的方法
代码号之ecshop商品详情页相关属 商品由新到旧排序修改教程ECSHOP 商品详情页相关属 商品由新到旧排序 -
ecshop订单合并,商品合并订单的方法
各位ECSHOP网店系统用户大家好,欢迎来到ECSHOP教程网图文教程,今天为大家详细解说一下ECSHOP合并订单,ECSHOP商品合并订单 。 ECSH -
ecshop怎么升级到新版本,ecshop网站商城升级步骤教程
ECSHOP升级教程:随着ecshop的不断更新与发展,版本也在不断的更新与升级。有很多客户担心版本升级是否会影响模板的使用,如何升级ecshop版本?不会升级版本怎么办? -
删除ecshop网站顶部版权信息Powered by ecshop
用EDITPLUS或者dreamweaver 打开 includes/lib_main.php将注:如果你的是UTF-8编码的,尽量不要使用记事本来修改。
留言与评论 (共有 条评论) |