ecshop怎么在搜索结果页显示评论等级评论数量
就是想在search页面把商品的用户评论数量跟评论等级调出来,要怎么做呢,各位,帮帮忙,谢谢哦...
就是想在search页面把商品的用户评论数量跟评论等级调出来,要怎么做呢,各位,帮帮忙,谢谢哦
展开
1个回答
展开全部
评论数量和评论等级的调用,其实可以通过php代码来实现
修改search.php 文件
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .
"WHERE $where $ext ORDER BY $sort $order";
改成
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " .
" IFNULL(AVG(r.comment_rank),0) AS comment_rank,IF(r.comment_rank,count(*),0) AS comment_count, ".
'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' .
"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " .
' LEFT JOIN '. $GLOBALS['ecs']->table('comment') .' AS r '.
'ON r.id_value = g.goods_id AND comment_type = 0 AND r.parent_id = 0 AND r.status = 1 ' .
"WHERE $where $ext group by g.goods_id ORDER BY $sort $order";
继续找到
$arr[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
下面增加
$row['comment_rank'] = ceil($row['comment_rank']) == 0 ? 5 : ceil($row['comment_rank']);
$arr[$row['goods_id']]['comment_rank']=$row['comment_rank'];
$arr[$row['goods_id']]['comment_count']=$row['comment_count'];
模板文件search.dwt加:
评论数:{$goods.comment_count}<br>
追问
您好,不行呢,按您说那种改回来,出错了哦 原本代码里面有这句“"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .”,这个在您改回来的那边是加哪里呢
壹寰(深圳)科技文化有限公司
2021-03-27 广告
2021-03-27 广告
要找正规专业的公司,行业口碑也比较重要。如果想了解更多详细信息,可以咨询下壹寰(深圳)科技文化有限公司。91数据恢复是壹寰(深圳)科技文化有限公司旗下专业数据恢复品牌,91数据恢复专注于勒索病毒数据恢复、勒索病毒数据修复、数据库修复、数据库...
点击进入详情页
本回答由壹寰(深圳)科技文化有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询