多变php服务中心

当前位置: 首页>站长学院>模板插件> ECSHOP首页显示商品总数和本月更新数的方法

ECSHOP首页显示商品总数和本月更新数的方法

来源:多变php服务中心 发布时间:2018-06-17关注度:405 ℃
ECSHOP首页显示商品总数和本月更新数的方法

 多变php付中心技术为您整理,首页显示商品总数和本月更新数的解决方法。

 (1)、首先修改 /index.php 

找到

assign_dynamic('index');

在它后边添加一些代码

$sql="select count(*) as goods_all from ". $ecs->table('goods'); //商品总数

$smarty->assign('goodsnum_all',$db->getOne($sql));

$time_month=mktime(0,0,0,date('m')-1,1,date('Y'));

$sql="select count(*) as goods_month from ". $ecs->table('goods') ." where last_update >= " . $time_month; //本月更新数

$smarty->assign('goodsnum_month',$db->getOne($sql));

 

(2)、打开首页模板文件 index.dwt,在合适的地方调用,调用代码为

本商城共有商品 {$goodsnum_all} 件,本月更新 {$goodsnum_month} 件

本文地址:https://www.phpicu.com/article.php?id=32

    责任编辑:多变php服务中心

    相关阅读