在ECSHOP首页显示商品总数和本月更新数-站长杂谈下载

在ECSHOP首页显示商品总数和本月更新数

开通本站Svip会员,全站资源免费下
经常在论坛里看到有人问到类似问题,今天就把方法共享一下。
5 ]7 f) A' {  }: p4 a5 U- {& E) H$ }& G0 u! A# E- b
1)、首先修改 /index.php   l4 J4 K+ }: {
找到
assign_dynamic('index');
在它后边添加一些代码
$sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
* t. \2 |$ r& `$ a; c $smarty->assign('goodsnum_all',$db->getOne($sql));/ U7 ]4 J. c! R4 |: O
$time_month=mktime(0,0,0,date('m')-1,1,date('Y'));6 g+ I1 O% @2 f  p
$sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数
& v7 V) Q+ u: Z# w4 L $smarty->assign('goodsnum_month',$db->getOne($sql));

5 _* W& Z, c4 Q& e7 d2 Z& W2 }5 U
. K5 r0 s, h( Y5 b2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码为
本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件

0 D  m1 c7 |5 s9 N

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部