关键Sql :

select ecs_goods.goods_name,B.S from ecs_goods inner join (

select sum(goods_number) as S,goods_id FROM (

SELECT ecs_order_goods.goods_number, ecs_order_goods.goods_id
FROM ecs_order_info
INNER JOIN ecs_order_goods ON ecs_order_info.order_id =

ecs_order_goods.order_id
WHERE ecs_order_info.add_time >=”.$t1.”
AND ecs_order_info.add_time <=”.$t2.”
) AS A
GROUP BY goods_id) as B on ecs_goods.goods_id =B.goods_id

 

根据时间统计订单里面商品数据

 

修改页面 index.php

 

在index.php   里面添加sql数据执行

 

 

在start.html 修改显示信息

 

20150623113909

 

修改start.htm

<div class=”list-div”>
<table cellspacing=’1′ cellpadding=’3′>
<tr>
<th colspan=”4″ class=”group-title”>今日订单</th>
</tr>
<tr>
<td>商品名称 </td>
<td>商品总数</td>
<td></td>
</tr>
{foreach from=$hai_order_list item=order}
<tr align=”center”>
<td align=”left”>{$order.goods_name|truncate:60:”…”}</td>
<td>{$order.S}</td>
<td></td>
</tr>
{/foreach}
</table>
</div>

把sql的数据输出到页面