在首页显示特定某一个会员等级的价格,应该怎么解决啊?
2016-07-07 15:02 来源:www.chinab4c.com 作者:ecshop专家
比如网站的会员等级分为三个等级,如果只想在首页那里显示某一个等级会员的价格,代码应该如何写呀?本人对PHP不是很了解,望各位高手指一下!谢谢! |
回答:
直接取得user_rank里面的等级ID来判断. |
等级会员价格在ecs_member_price 里的user_price,我已精品推荐为例说一下,我也是小菜鸟,希望大家多多指教,在lib_goods.php里找到get_recommend_goods($type = '', $cats = '')这个函数找到取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中 $sql = 'SELECT g.goods_desc ,g.goods_id, g.goods_name,g.goods_number , g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd" . '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]' "; $type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']); $type_merge = array_unique($type_merge); $sql .= ' WHERE g.goods_id ' . db_create_in($type_merge); $sql .= ' ORDER BY g.sort_order, g.last_update DESC'; 改为: 取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中 $sql = 'SELECT g.goods_desc ,g.goods_id, g.goods_name,g.goods_number , g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ". "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img, RAND() AS rnd , mp.user_price" . '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 =2 "; $type_merge = array_merge($type_array['new'], $type_array['best'], $type_array['hot']); $type_merge = array_unique($type_merge); $sql .= ' WHERE g.goods_id ' . db_create_in($type_merge); $sql .= ' ORDER BY g.sort_order, g.last_update DESC'; 这里面如要改动两个地方:一是增加mp.user_price,这个是会员等级价格,而是将 mp.user_rank = '$_SESSION[user_rank]'改为 mp.user_rank = 2,2是会员和等级的id,ec默认是3个等级, 找到$goods[$idx]['shop_price']= price_format($row['shop_price']); 在下面加入 $goods[$idx]['user_price']= price_format($row['user_price']); 最后就是在模板相应位置调用就可以,找到recommend_best.lbi加入 {$goods.user_price}即可,多谢大家指教 |
复杂的…… |
最近更新
常用插件
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
ecshop热门问答
ecshop热门资料
ecshop网站开发
ecshop颜色选择
ecshop品牌分类。地区调用
ecshop麦考林
ecshop预装
ecshopamp
ecshop批量导出
ecshoprun
ecshop兼容性
ecshop大件
beegoorm
ecshoprepeat
ecshop图标
ecshop手机商城
ecshop上级
ecshop回答
ecshop内存
ecshopvalid
ecshop人人
ecshop更新时间
ecshop一直
ecshopassistant
ecshop数据库
ecshop丰速运
ecshop服饰
ecshop义务
ecshop白开水
ecshop商品顺序
去ecshop版权
ecshop凡客模版