• 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
What's Hot

机械模具加工公司网站设计案例

24 10 月, 2023

快速原型公司案例

24 10 月, 2023

陶瓷加工网站案例

24 10 月, 2023
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram
VPSEO VPSEO
  • 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
VPSEO VPSEO
Home»Uncategorized»ecshop中实现不同等级的会员显示不同的商品价格
Uncategorized

ecshop中实现不同等级的会员显示不同的商品价格

chrispengcnBy chrispengcn7 8 月, 2021没有评论6 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

 

1.建三个等级会员
2.lib_goods.php 中 查找{
                    $type_array[$key] = array();
                }
            }
        }
……………………..
……………………..
/**
* 获得商品的详细信息
*
* @access public
* @param   integer     $goods_id
* @return void
*/
if( $_SESSION[user_rank] == 0 ){
$user_rank=6;
}
else{
$user_rank = $_SESSION[user_rank] ;
}
        //取出所有符合条件的商品数据,并将结果存入对应的推荐类型数组中
        $sql = ‘SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, g.give_integral,mp.user_rank as userrank,r.rank_name,
r.discount, IFNULL(mp.user_price, r.discount*g.shop_price/100) AS rank_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 = ‘$user_rank’ “.
     “LEFT JOIN ” . $GLOBALS[‘ecs’]->table(‘user_rank’) . ” AS r “.
     “ON r.rank_id = $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’;
        $result = $GLOBALS[‘db’]->getAll($sql);
        foreach ($result AS $idx => $row)
        {
            if ($row[‘promote_price’] > 0)
            {
                $promote_price = bargain_price($row[‘promote_price’], $row[‘promote_start_date’], $row[‘promote_end_date’]);
                $goods[$idx][‘promote_price’] = $promote_price > 0 ? price_format($promote_price) : ”;
            }
            else
            {
                $goods[$idx][‘promote_price’] = ”;
            }
            $goods[$idx][‘id’]           = $row[‘goods_id’];
            $goods[$idx][‘name’]         = $row[‘goods_name’];
   $goods[$idx][‘rank_name’]    = $row[‘rank_name’];
   $goods[$idx][‘discount’]    = $row[‘discount’];
            $goods[$idx][‘brief’]        = $row[‘goods_brief’];
            $goods[$idx][‘brand_name’]   = isset($goods_data[‘brand’][$row[‘goods_id’]]) ? $goods_data[‘brand’][$row[‘goods_id’]] : ”;
            $goods[$idx][‘goods_style_name’]   = add_style($row[‘goods_name’],$row[‘goods_name_style’]);
            $goods[$idx][‘short_name’]   = $GLOBALS[‘_CFG’][‘goods_name_length’] > 0 ?
                                               sub_str($row[‘goods_name’], $GLOBALS[‘_CFG’][‘goods_name_length’]) : $row[‘goods_name’];
            $goods[$idx][‘short_style_name’]   = add_style($goods[$idx][‘short_name’],$row[‘goods_name_style’]);
            $goods[$idx][‘market_price’] = price_format($row[‘market_price’]);
            $goods[$idx][‘shop_price’]   = price_format($row[‘shop_price’]);
   $goods[$idx][‘rank_price’]   = price_format($row[‘rank_price’]);
   $goods[$idx][‘give_integral’]   = $row[‘give_integral’];
            $goods[$idx][‘thumb’]        = get_image_path($row[‘goods_id’], $row[‘goods_thumb’], true);
            $goods[$idx][‘goods_img’]    = get_image_path($row[‘goods_id’], $row[‘goods_img’]);
            $goods[$idx][‘url’]          = build_uri(‘goods’, array(‘gid’ => $row[‘goods_id’]), $row[‘goods_name’]);

            if (in_array($row[‘goods_id’], $type_array[‘best’]))
            {
                $type_goods[‘best’][] = $goods[$idx];
            }
            if (in_array($row[‘goods_id’], $type_array[‘new’]))
            {
                $type_goods[‘new’][] = $goods[$idx];
            }
            if (in_array($row[‘goods_id’], $type_array[‘hot’]))
            {
                $type_goods[‘hot’][] = $goods[$idx];
            }
        }
    }
    return $type_goods[$type];
}3。在模版 文件中 (如: recommend_best.lbi)
         <!– {if $show_marketprice} –>
         {$lang.market_price}<span class=”market”>{$goods.market_price}</span><br />
        <!– {/if} –>
下面添加
添加
{$goods.rank_name}{$goods.rank_price} <br>
在没有登陆的时候显示 普通会员价,登陆之后就显示会员对应的等级和价格。

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
chrispengcn
  • Website

Related Posts

Nginx做负载均衡,有没有办法碰到404就跳过?

2 7 月, 2022

如何快速把多个excel表合并成一个excel表

7 8 月, 2021

nginx配置泛域名转发到子目录nginx泛域名转发到泛域名

7 8 月, 2021

wordpress如何防止发布文章时候自动清除

、
换行标签

7 8 月, 2021
Add A Comment

Leave A Reply Cancel Reply

*

code

导航
  • 首页
  • 关于我们
  • 服务项目
  • 项目案例
  • 博客文章
  • 联系我们
博客
  • 服务器运维
  • 服务器安装
  • nginx
  • PHP
  • WordPress
  • Python
  • Javascript
  • SEO
  • 电子商务
  • 大数据采集
  • 宝塔面板
  • 数据库
  • 电子商务
  • 虚拟化
  • 阿里云
导航
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们
最新文章
  • 机械模具加工公司网站设计案例
  • 快速原型公司案例
  • 陶瓷加工网站案例
  • CNC数控加工日文网站案例
  • 触摸一体机数字标牌厂家网站案例
关于我们
关于我们

广州纬来科技有限公司
联系地址:广东省广州市番禺区富华中路富源二街18号合和大厦809

QQ : 13602156
Email : 13926026058@139.com
Contact: +86 13926026058

Facebook Twitter YouTube LinkedIn
© 2025 广州纬来科技有限公司 粤ICP备2023105857号-2
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们

Type above and press Enter to search. Press Esc to cancel.