
article.dwt就为文章详情模板,在需要的地方添加:
<!-- #BeginLibraryItem "/library/comments.lbi" -->{insert_scripts files='transport.js,utils.js'}
<div id="ECS_COMMENT"> {* ECSHOP 提醒您:动态载入comments_list.lbi,显示评论列表和评论表单 *}{insert name='comments' type=$type id=$id}</div>
<!-- #EndLibraryItem -->
就能调用出评论功能了
第一步:找到根目录下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},这样就可以在首页调出新品的评 论等级了。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)