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

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

来自版块: 站长杂谈发表于: 2015-8-8 23:54:51
23226
0
如本资源下载地址失效,请点击此处进行反馈
开通本站Svip会员,全站资源免费下
经常在论坛里看到有人问到类似问题,今天就把方法共享一下。
. M$ ]* v# {$ Y7 i
6 e' B" b7 \7 \4 X$ X1)、首先修改 /index.php # x+ e  G+ l: @5 t# R5 Z. g; G
找到
assign_dynamic('index');
在它后边添加一些代码
$sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数
7 `( U( f+ U: ?% g! @ $smarty->assign('goodsnum_all',$db->getOne($sql));3 F2 m. B+ s1 }5 d( W$ R/ j9 h
$time_month=mktime(0,0,0,date('m')-1,1,date('Y'));! i7 u3 x  B* k5 X, b; G
$sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数7 L% ]+ K8 H8 E5 U4 r/ m# [
$smarty->assign('goodsnum_month',$db->getOne($sql));

% N; V) S8 ]  ]6 C  h. B4 Y( C4 [  {$ J9 g3 i, L8 o
2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码为
本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件

% Q/ L  @2 c! {* j$ F' ]

全部评论 0

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