Ecshop模板网
首页 > ecshop教程 > ecshop经验分享 > 在ECSHOP后台商品列表显示会员等级价格
文章详情

在ECSHOP后台商品列表显示会员等级价格

ecshop模板网 / 2011-01-16

此贴原来是回复一位朋友提问的,考虑到也许还有其他人也需要该功能,所以整理了下,单独发布一下。

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 rNULLrice, 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}
下一篇: 屏蔽ecshop云提示no_license 上一篇: Ecshop模板修改_在网站首页显示商品库存
 用户评论(共 0 条评论)
  • 暂时还没有任何用户评论
用户名: 匿名用户 E-mail:
当前心情:
评论内容:
验证码: captcha
返回顶部 返回首页
 
QQ在线咨询
售前电话热线
#
售前QQ客服