给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_iNULLser_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文件,找到如下代码:
<th><a href="javascript:listTable.sort('shop_price'); ">{$lang.shop_price}</a>{$sort_shop_price}</th>
在以上这段代码的后面添加以下代码:
<th>会员价格</th>
继续找到如下代码:
<td align="center"><img src="images/{if $goods.is_on_sale}yes{else}no{/if}.gif" onclick="listTable.toggle(this, 'toggle_on_sale', {$goods.goods_id})" /></td>
在以上这段代码的前面添加以下代码:
    {if $goods.user_price}
    <td align="right">
    {foreach from=$goods.user_price item=user_price }
    {$user_price.rank_name}:{$user_price.price}<br>
    {/foreach}
    </td>
    {/if}
按照我们以上教程步骤修改后即可实现ECSHOP后台商品列表直接显示每个商品的会员等级价格

本文原创地址:https://www.ecshop.cx/article-224.html
版权所有 © 转载时必须以链接形式注明出处!

觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。

实时购买动态 ×

kinion会员 在 2019-04-14 购买了 ECSHOP批量导入淘宝CSV数据包插件支持tbi图片