ECSHOP首页不同会员等级显示不同商品价格

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

在ECSHOP首页显示各等级会员价格 注意:以下操作尽量不要使用记事本来编辑,尤其是使用UTF-8编码的朋友们。 以下修改以官方默认模板为例: 1、 打开includes/lib_goods.php  搜索 $goods[$idx]['url']          = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); 一共能搜索到四处,在每一处的后面都加上下面代码(注意是每一处哦,这样写对新手朋友来说比较容易操作)   /* 会员等级价格 */    $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $row[shop_price] / 100) AS price, r.rank_name, r.discount " .     'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' .     'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ".     "ON mp.goods_id = '$row[goods_id]' AND mp.user_rank = r.rank_id " .     "WHERE r.show_price = 1 OR r.rank_id = '$_SESSION[user_rank]'";    $res_up = $GLOBALS['db']->query($sql);    while ($row_up = $GLOBALS['db']->fetchRow($res_up))     {     $goods[$idx]['user_price'][$row_up['rank_id']] = array(      'rank_name' => htmlspecialchars($row_up['rank_name']),      'price' => price_format($row_up['price']));     }   2、 依次打开 library/recommend_hot.lbi  ,  library/recommend_best.lbi , library/recommend_new.lbi , library/recommend_promotion.lbi 文件 在 后面增加  

{if $goods.user_price} {foreach from=$goods.user_price item=user_price }
{$user_price.rank_name}:{$user_price.price} {/foreach} {/if}