ECSHOP后台商品列表显示会员等级价格
时间:2024年02月04日
/来源:网络
/编辑:佚名
1、修改admin/includes/lib_goods.php的goods_list()函数部分
return array('goods' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
前面增加下面代码
foreach($row as $key_tmp=>$goods_tmp)
{
$sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $goods_tmp[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_tmp[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))
{
$row[$key_tmp]['user_price'][$row_up['rank_id']] = array(
'rank_name' => htmlspecialchars($row_up['rank_name']),
'price' => price_format($row_up['price']));
}
}
2、修改模板文件 admin/templates/goods_list.htm
在{$goods.shop_price}与</span>之间增加下面代码
{if $goods.user_price}
{foreach from=$goods.user_price item=user_price }
<br>
{$user_price.rank_name}:{$user_price.price}
{/foreach}
{/if}
return array('goods' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
前面增加下面代码
foreach($row as $key_tmp=>$goods_tmp)
{
$sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $goods_tmp[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_tmp[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))
{
$row[$key_tmp]['user_price'][$row_up['rank_id']] = array(
'rank_name' => htmlspecialchars($row_up['rank_name']),
'price' => price_format($row_up['price']));
}
}
2、修改模板文件 admin/templates/goods_list.htm
在{$goods.shop_price}与</span>之间增加下面代码
{if $goods.user_price}
{foreach from=$goods.user_price item=user_price }
<br>
{$user_price.rank_name}:{$user_price.price}
{/foreach}
{/if}
新闻资讯 更多
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 9帝国cms后台登录出现”您还未登录”怎么解决?
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法