Ecshop模板网
首页 > ecshop教程 > ecshop经验分享 > 让ecshop商品列表页商品显示一条评论
文章详情

让ecshop商品列表页商品显示一条评论

ecshop模板网 / 2013-06-09

 鼠标滑过商品,下方显示最新评论;
让ecshop商品列表页商品显示评论

无评论时不显示内容;
让ecshop商品列表页商品显示评论

打开根目录 category.php

大约 447-455行之间

 

/* 获得商品列表 */

    $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, ' .

                "NULLp.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";

    $res = $GLOBALS['db']->sel ectLimit($sql, $size, ($page - 1) * $size);

替换为

    /* 获得商品列表 */

    $sql = 'SELECT g.goods_id,c.id_value,c.user_name,c.content, 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('comment') . ' AS c ON c.id_value = g.goods_id ' .

            '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";

    $res = $GLOBALS['db']->sel ectLimit($sql, $size, ($page - 1) * $size);

然后搜索如下代码:$arr[$row['goods_id']]['name']             = $row['goods_name'];

在其下方添加:

                $arr[$row['goods_id']]['uname']             = $row['user_name'];

                $arr[$row['goods_id']]['ucon']             = $row['content'];

然后打开:根目录/thmes/你的模板/library/goods_list.lib

如果你用的默认模板请搜索:

<a href="javascript:;" id="compareLink" onClick="Compare.add({$goods.goods_id},'{$goods.goods_name|escape:"html"}','{$goods.type}')" class="f6">{$lang.compare}</a>

在其下方添加如下代码:

 <!--{if $goods.uname neq ''}--><p class="rl cl"><em>{$goods.uname}:</em>{$goods.ucon|truncate:26:""}</p><!--{/if}-->

如果不是默认模板请自行查看单个商品循环列表中布局位置.

此时就完成了列表页商品下方的最新评论,只调用1条最新评论.

 

 

 

下一篇: 报错compile_str() flow.php on line 375的解决方法 上一篇: ecshop商品包装与贺卡在哪删除屏蔽掉
 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页
 
QQ在线咨询
售前电话热线
#
售前QQ客服