LSRONG-双荣设计
扫描二维码添加QQ好友

扫一扫二维码,加我QQ

ecshop首页如何调用评论等级

2016-03-27 11:03:32ecshop常见问题

  在做模板时,首页新品调用评论等级,就让68ecshop的技术来为 大家简单的介绍下吧!

第一步:找到根目录下includes/lib_goods.lbi,在尾部添加函数

function get_comment_rank($goods_id){

if(empty ($goods_id)){

return '5';

}

$sql = "select AVG(comment_rank) as goods_rank from".$GLOBALS ['ecs']->table('comment').

"where id_value = '$goods_id' AND comment_type = 0 AND parent_id = 0 AND status =1";

$val = $GLOBALS['db'] -> getOne($sql);

$val = ceil ($val) == 0?5:ceil($val);

return $val;

}

第二步:找到 get_recommend_goods()函数,

$goods[$idx]['name']         = $row ['goods_name'];下添加

$goods[$idx]['goods_rank']   = get_comment_rank($row ['goods_id']);

第三步:页面中调用{$goods.goods_rank},这样就可以在首页调出新品的评 论等级了。

文章关键词