主页教程 ECshop教程 查看内容

Ecshop二次开发会员中心添加修改积分明细以及其他小功能定制

发表于 15-04-02 17:03 | 栏目: ECshop教程
1.
languages/zh_cn/user.php,666行左右,把"$_LANG['user_reg_info'][2]"修改为"不注册为会员不可以在本店购买商品"
668行左右,把$_LANG['user_reg_info'][3]修改为"注册之后您可以"

2.删除左侧的5个选项
themes/joyo25/library/user_menu.lbi,删除以下5行:
<a href="user.php?act=tag_list"{if $action eq 'tag_list'}class="curs"{/if}> {$lang.label_tag}</a><br />
<a href="user.php?act=booking_list"{if $action eq 'booking_list'}class="curs"{/if}> {$lang.label_booking}</a><br /> 
<a href="user.php?act=bonus"{if $action eq 'bonus'}class="curs"{/if}> {$lang.label_bonus}</a><br />
<a href="user.php?act=affiliate"{if $action eq 'affiliate'}class="curs"{/if}>{$lang.label_affiliate}</a><br />
<a href="user.php?act=track_packages"{if $action eq 'track_packages'}class="curs"{/if}>{$lang.label_track_packages}</a><br /> 

3.给字体设置颜色,删除红包
themes/joyo25/user_clips.dwt,26行左右,把{$info.shop_name}修改为:<font class="f12b">{$info.shop_name}</font>
41行左右,注释<!--{$lang.your_bonus}:<a href="user.php?act=bonus"><u class="fred">{$info.bonus}</u></a><br />-->
42行左右,把{$info.integral}修改为:<u class="fred">{$info.integral}</u>

4.删除资金管理里面的提现并修改颜色
themes/joyo25/user_transaction.dwt,644行左右,把
<a href="user.php?act=account_deposit"><span {if $action eq 'account_deposit'}class="f12b"{/if}>{$lang.surplus_type_0}</a> | <a href="user.php?act=account_raply"><span {if $action eq 'account_raply'}class="f12b"{/if}>{$lang.surplus_type_1}</a> | <a href="user.php?act=account_detail"><span {if $action eq 'account_detail'}class="f12b"{/if}>{$lang.add_surplus_log}</a> | <a href="user.php?act=account_log"><span {if $action eq 'account_log'}class="f12b"{/if}>{$lang.view_application}</a>
修改为
<a href="user.php?act=account_deposit"><font size="3"><span class="f12b">{$lang.surplus_type_0}</a> | <a href="user.php?act=account_detail"><span class="f12b">{$lang.add_surplus_log}</a> | <a href="user.php?act=account_log"><span class="f12b">{$lang.view_application}</font></a>

5.添加积分明细
languages/zh_cn/user.php,36行左右,添加:
$_LANG['label_integral_surplus'] = '积分明细';

languages/en_us/user.php,36行左右,添加:
$_LANG['label_integral_surplus'] = 'Integral Details';

themes/joyo25/library/user_menu.lbi,15行左右,添加:
<a href="user.php?act=integral_log"{if $action eq 'integral_log'}class="curs"{/if}>{$lang.label_integral_surplus}</a><br />

themes/joyo25/user_transaction.dwt,230行左右,添加:
<!-- {if $action eq "integral_log"} -->
  <div class="userContent">
  <h5>{$lang.label_integral_surplus}</h5>
  <div class="userPadd clearfix">
   <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd">
      <tr align="center">
        <td bgcolor="#ffffff">{$lang.process_time}</td>
          <td bgcolor="#ffffff">{$lang.surplus_pro_type}</td>
        <td bgcolor="#ffffff">{$lang.your_integral}</td>
        <td bgcolor="#ffffff">{$lang.change_desc}</td>
      </tr>
      <!--{foreach from=$account_log item=item}-->
      <tr>
        <td align="center" bgcolor="#ffffff">{$item.change_time}</td>
        <td align="center" bgcolor="#ffffff">{$item.type}</td>
        <td align="right" bgcolor="#ffffff">{$item.amount}</td>
        <td bgcolor="#ffffff" title="{$item.change_desc}">&nbsp;&nbsp;{$item.short_change_desc}</td>
      </tr>
      <!--{/foreach}-->
    <tr>
      <td colspan="4" align="right" bgcolor="#ffffff">{$lang.cur_points}<font class="fred">{$surplus_amount}</font></td>
    </tr>
   </table>
  
  
  <!-- #BeginLibraryItem "/library/pages.lbi" --><!-- #EndLibraryItem -->
  <!-- {/if} -->

includes/lib_order.php,1342行左右,添加一个函数:
/**
 * 取得用户积分
 * @param   int     $user_id    用户id
 * @return  int   用户积分
 */
function get_user_integral($user_id)
{
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('users') .
            " WHERE user_id = '$user_id'";
    $user = $GLOBALS['db']->getRow($sql);

    return $user['pay_points'];
}

user.php,35行左右,把
$ui_arr = array('register', 'login', 'profile', 'order_list', 'order_detail', 'address_list', 'collection_list',
'message_list', 'tag_list', 'get_password', 'reset_password', 'booking_list', 'add_booking', 'account_raply',
'account_deposit', 'account_log', 'account_detail', 'act_account', 'pay', 'default', 'bonus', 'group_buy', 'group_buy_detail', 'affiliate', 'comment_list','validate_email','track_packages', 'transform_points','qpassword_name', 'get_passwd_question', 'check_answer');
修改为:
$ui_arr = array('register', 'login', 'profile', 'order_list', 'order_detail', 'address_list', 'collection_list',
'message_list', 'tag_list', 'get_password', 'reset_password', 'booking_list', 'add_booking', 'account_raply',
'account_deposit', 'account_log', 'account_detail', 'act_account', 'pay', 'default', 'bonus', 'group_buy', 'group_buy_detail', 'affiliate', 'comment_list','validate_email','track_packages', 'transform_points','qpassword_name', 'get_passwd_question', 'check_answer', 'integral_log');

user.php,805行左右,在elseif ($action == 'order_list')循环下面添加:
/* 会员积分明细界面 */
elseif ($action == 'integral_log')
{
    include_once(ROOT_PATH . 'includes/lib_clips.php');
    include_once(ROOT_PATH . 'includes/lib_order.php');

    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;

    $account_type = 'pay_points';

    /* 获取记录条数 */
    $sql = "SELECT COUNT(*) FROM " .$ecs->table('account_log').
           " WHERE user_id = '$user_id'" .
           " AND $account_type <> 0 ";
    $record_count = $db->getOne($sql);

    //分页函数
    $pager = get_pager('user.php', array('act' => $action), $record_count, $page);

    //获取剩余积分
    $surplus_amount = get_user_integral($user_id);
    if (empty($surplus_amount))
    {
        $surplus_amount = 0;
    }

    //获取积分记录
    $account_log = array();
    $sql = "SELECT * FROM " . $ecs->table('account_log') .
           " WHERE user_id = '$user_id'" .
           " AND $account_type <> 0 " .
           " ORDER BY log_id DESC";
    $res = $GLOBALS['db']->selectLimit($sql, $pager['size'], $pager['start']);
    while ($row = $db->fetchRow($res))
    {
        $row['change_time'] = local_date($_CFG['date_format'], $row['change_time']);
        $row['type'] = $row[$account_type] > 0 ? $_LANG['account_inc'] : $_LANG['account_dec'];
        $row['user_money'] = price_format(abs($row['user_money']), false);
        $row['frozen_money'] = price_format(abs($row['frozen_money']), false);
        $row['rank_points'] = abs($row['rank_points']);
        $row['pay_points'] = abs($row['pay_points']);
        $row['short_change_desc'] = sub_str($row['change_desc'], 60);
        $row['amount'] = $row[$account_type];
        $account_log[] = $row;
    }

    //模板赋值
    $smarty->assign('surplus_amount', price_format($surplus_amount, false));
    $smarty->assign('account_log',    $account_log);
    $smarty->assign('pager',          $pager);
    $smarty->display('user_transaction.dwt');
}

6.添加积分说明
languages/zh_cn/user.php,37行左右,添加:
$_LANG['label_integral_explanation'] = '积分说明';

languages/en_us/user.php,37行左右,添加:
$_LANG['label_integral_explanation'] = 'Integral Explanation';

themes/joyo25/library/user_menu.lbi,14行左右,添加:
<a href="user.php?act=integral_explanation"{if $action eq 'integral_explanation'}class="curs"{/if}> {$lang.label_integral_explanation}</a><br /> 

themes/joyo25/user_transaction.dwt,260行左右,添加:
  1. <!-- {if $action eq "integral_explanation"} -->
  2.   <div class="userContent">
  3.   <h5>{$lang.label_integral_explanation}</h5>
  4.     <div class="userPadd clearfix">
  5.         所有会员在乐博商城购物均可获得积分,积分可以用来参与兑换活动。乐博商城会不定期推出各类积分兑换活动,请随时关注关于积分的活动告知。详情请查看以下各项说明。 <br>
  6.  
  7.         <br> 1.积分获取 <br>
  8.         每一笔成功交易的订单,所付现金部分都可获得对应的积分,商城系统会对客户的积分进行增加并逐次累积。 <br>
  9.         <br> 2.会员等级 <br>
  10.         <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd">
  11.       <tr align="center">
  12.         <td bgcolor="#ffffff">会员等级</td>
  13.         <td bgcolor="#ffffff">等级积分</td>
  14.         <td bgcolor="#ffffff">会员优惠</td>
  15.       </tr>
  16.  
  17.       <tr align="center">
  18.         <td bgcolor="#ffffff">铜牌会员</td>
  19.         <td bgcolor="#ffffff">10000</td>
  20.         <td bgcolor="#ffffff">购物时额外优惠1%</td>
  21.       </tr>
  22.         <tr align="center">
  23.         <td bgcolor="#ffffff">银牌会员</td>
  24.         <td bgcolor="#ffffff">50000</td>
  25.         <td bgcolor="#ffffff">购物时额外优惠2%</td>
  26.         </tr>
  27.         <tr align="center">
  28.         <td bgcolor="#ffffff">金牌会员</td>
  29.         <td bgcolor="#ffffff">100000</td>
  30.         <td bgcolor="#ffffff">购物时额外优惠3%</td>
  31.       </tr>
  32.         </table>
  33.         <br> 3.积分有效期 <br>
  34.         永久有效。 <br>
  35.  
  36.         <br> 4.查询积分 <br>
  37.         您可以在<b><a href='user.php?act=integral_log'><u class="f12b">积分明细</u></a></b>中,查看您的累计积分和消费积分。<br>
  38.  
  39.         <br> 5.积分活动<br>
  40.         乐博商城会不定期地推出各种积分活动,请随时关注关于积分促销的告知。<br>
  41.         1)会员可以用积分参与乐博商城指定的各种活动,参与后会扣减相应的积分。<br>
  42.         2)积分不可用于兑换现金,仅限参加乐博商城指定兑换物品、参与抽奖等各种活动。<br>
  43.  
  44.         <br> 6.注意事项<br>
  45.         1)不同帐户积分不可合并使用。<br>
  46.         <br>
  47.      </div>
  48.     </div>
  49.    <!-- {/if} -->
user.php,35行左右,把
$ui_arr = array('register', 'login', 'profile', 'order_list', 'order_detail', 'address_list', 'collection_list',
'message_list', 'tag_list', 'get_password', 'reset_password', 'booking_list', 'add_booking', 'account_raply',
'account_deposit', 'account_log', 'account_detail', 'act_account', 'pay', 'default', 'bonus', 'group_buy', 'group_buy_detail', 'affiliate', 'comment_list','validate_email','track_packages', 'transform_points','qpassword_name', 'get_passwd_question', 'check_answer', 'integral_log');
修改为:
$ui_arr = array('register', 'login', 'profile', 'order_list', 'order_detail', 'address_list', 'collection_list',
'message_list', 'tag_list', 'get_password', 'reset_password', 'booking_list', 'add_booking', 'account_raply',
'account_deposit', 'account_log', 'account_detail', 'act_account', 'pay', 'default', 'bonus', 'group_buy', 'group_buy_detail', 'affiliate', 'comment_list','validate_email','track_packages', 'transform_points','qpassword_name', 'get_passwd_question', 'check_answer', 'integral_log', 'integral_explanation');

user.php,860行左右,添加:
elseif ($action == 'integral_explanation')
{
    include_once(ROOT_PATH . 'includes/lib_clips.php');
    include_once(ROOT_PATH . 'includes/lib_order.php');

    $smarty->display('user_transaction.dwt');
}

7.修改欢迎页的突出字体颜色
languages/zh_cn/user.php,450行左右,把
$_LANG['your_level'] = '您的等级是 %s ';
$_LANG['next_level'] = ',您还差 %s 积分达到 %s ';
修改为:
$_LANG['your_level'] = '您的等级是 <font class="f12b">%s</font> ';
$_LANG['next_level'] = ',您还差 <font class="f12b">%s</font> 积分达到 <font class="f12b">%s</font> ';

说明:本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!如有侵犯您的版权,请及时联系我们,我们将尽快处理。

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)