50字范文,内容丰富有趣,生活中的好帮手!
50字范文 > ecshop 评价仿京东仿淘宝 中评率 好评率 差评率

ecshop 评价仿京东仿淘宝 中评率 好评率 差评率

时间:2022-06-06 09:41:13

相关推荐

ecshop 评价仿京东仿淘宝 中评率 好评率 差评率

效果图

1.在goods.php中添加

//中差评

$sql="select * from ".$ecs->table('comment')." where comment_type=0 and status=1 and comment_rank!=0 and id_value=$goods_id";

$comments=$db->getall($sql);

$count=count($comments);

$zhonghao='';

$zhonghaoimg='';

$hao=0;

$zhong=0;

$cha=0;

$haol='';

$zhongl='';

$chal='';

foreach($comments as $value){

if($value['comment_rank'] == 1){

$cha=$cha+1;

}

if($value['comment_rank'] == 2 or $value['comment_rank'] == 3 or $value['comment_rank'] == 4){

$zhong=$zhong+1;

}

if($value['comment_rank'] == 5){

$hao=$hao+1;

}

}

$smarty->assign('zhonghao', round($hao/$count*100,0));

$smarty->assign('count', $count);

$smarty->assign('zhong', round($zhong/$count*100,0));

$smarty->assign('cha', round($cha/$count*100,0));

$smarty->assign('haol', round($hao/$count*100/100*143,0));

$smarty->assign('zhongl', round($zhong/$count*100/100*143,0));

$smarty->assign('chal', round($cha/$count*100/100*143,0));

$smarty->assign('zhonghaoimg', round($hao*5/$count,0));

接下来就是在模板中调用 这些就可以了 $smarty->assign('haol', round($hao/$count*100/100*143,0)); 这里面的 143 是那个评价进度条的总长度

ecshop二次开发 联系QQ 1595192997

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。