ECSHOP首页显示最新交易订单

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

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模板内容改为以下内容(注意备份原文件): 

 
 
 
 
 
订单查询
  
       
 
     
订购时间
订单号
状  态
   
        {foreach from=$order_list item=order}        
  • {$order.short_order_time}{$order.order_sn}{$order.order_status}
  •      {/foreach}    
 
     
     
      
     
     
         
       
                 
    • {$lang.order_number}
              {$order_query.order_sn}      
    •            
    • {$lang.order_number}
              {$order_query.order_sn}      
    •            
    • {$lang.order_status}
              {$order_query.order_status}      
    •            
    • {$lang.consignment}
              {$order_query.invoice_no}      
    •                  
    • {$lang.shipping_date}
              {$order_query.shipping_date}      
    •          
     
      4、在style.css文件中添加以下CSS样式(注意:不要同原CSS标记有冲突,有相同自己修改标记): /** 首页订单上向滚动**/ #ECS_ORDER_QUERY { position: relative; width: 100%; 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: 100%; 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:100%; margin-bottom:10px; display:block; clear:both;} .module .top{ height:7px; background:url(images/bg_long.gif) repeat-x; font-size:1px; width: 100%; overflow:hidden; } .module .top_R{ padding:0 12px 0 0; background:#fff url(images/borders_R.gif) repeat-y 100% 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或是在后台的设置模板处的前台订单状态查询打上勾: