给ECSHOP后台商品列表每个商品显示会员等级价格

2016-09-02 16:28 来源:www.chinab4c.com 作者:ecshop专家

1、打开修改admin/includes/lib_goods.php文件,找到如下代码: 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, INULLmp.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文件,找到如下代码: {$lang.shop_price}{$sort_shop_price} 在以上这段代码的后面添加以下代码: 会员价格 继续找到如下代码: 在以上这段代码的前面添加以下代码: {if $goods.user_price} {foreach from=$goods.user_price item=user_price } {$user_price.rank_name}:{$user_price.price}
{/foreach} {/if} 按照我们以上教程步骤修改后即可实现ECSHOP后台商品列表直接显示每个商品的会员等级价格