首页会员价格显示解决办法

includes/lib_goods.php 文件里代码最后一行 [color=red]?>[/color] 之前加入如下代码:[quote]* 获得指定商品的各会员等级对应的价格[code]* 获得指定商品的各会员等级对应的价格*************************************************************************************************
* *
* @access public *
* @param integer $goods_id *
* @return array
*/
function get_user_rank_prices_index($goods_id, $shop_price)
{
$sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $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 = '$goods_id' AND mp.user_rank = r.rank_id ".
"WHERE r.show_price = 1 OR r.special_rank = 0";
$res = $GLOBALS['db']->query($sql);

$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{

$arr[$row['rank_id']] = array(
'rank_name' => htmlspecialchars($row['rank_name']),
'price' => price_format($row['price'])); //*
break;
} //*
return $arr; //*
} //*
//*************************************************************************************************[/code]接着找到295行 左右 加上一句:[code]$goods[$idx]['user_price'] =get_user_rank_prices_index($row['goods_id'], $row['shop_price']); //会员等级价格***[/code]就像下面这个样子---------|
$goods[$idx]['id'] = $row['goods_id'];
$goods[$idx]['user_price'] =get_user_rank_prices_index($row['goods_id'], $row['shop_price']); //会员等级价格***
$goods[$idx]['name'] = $row['goods_name'];
$goods[$idx]['brief'] = $row['goods_brief'];
最后在需要插入价格的地方加上 调用代码 看下面[][code]

{$user_price.rank_name}:{$user_price.price}


[/code]

目前有:0条评论

留下脚印,证明你来过。发表评论:

*

*

分享:

支付宝

微信