来源: 本站版本: (PHP)JTBC1.0
1.shop模块数据表添加字段 s_price2 s_price3
修改后台模板添加后台价格添加功能
前台模板不用变动.
2.打开./common/incfiles/function.inc.php文件
添加以下函数
function ii_get_utype($name)
{
global $conn;
$sql = "select * from JTBC_passport where p_username='$name'";
$q=mysql_query($sql);
if($q) {
$res=mysql_fetch_assoc($q);
return $res['p_utype'];
}
else{
return false;
}
}
3.打开\shop\common\incfiles\module_config.inc.php
修改function jtbc_cms_module_detail()函数中的foreach循环
foreach ($trs as $key => $val)
{
$tkey = ii_get_lrstr($key, '_', 'rightr');
$GLOBALS['RS_' . $tkey] = $val;
$tval = ii_htmlencode($val);
if (!empty($_COOKIE[APP_NAME .'user']['username'])){$utype = ii_get_utype($_COOKIE[APP_NAME .'user']['username']);}//获取登录用户的会员级别,0注册会员;1认证会员;2高级会员.
switch($utype)
{
case 0:
if($tkey=='price2' || $tkey=='price3'){$tval = $trs['s_price'];}
break;
case 1:
if($tkey=='price' || $tkey=='price3'){$tval = $trs['s_price2'];}
break;
case 2:
if($tkey=='price2' || $tkey=='price'){$tval = $trs['s_price3'];}
break;
default:
if($tkey=='price2' || $tkey=='price3' || $tkey=='price'){$tval = $trs['s_price'];}
break;
}
$tmpstr = str_replace('{$' . $tkey . '}', $tval, $tmpstr);
}
默认显示:市场价格
注册会员:显示price(市场价格)
认证会员:显示price2
高级会员:显示price3
技术支持QQ:925474725