ecshop增加真实姓名二次开发

2010-03-25 23:40 来源:www.chinab4c.com 作者:admin

  ecshop在使用过程中,往往牵涉到增加用户真实名注册,我们通过以下程序的ecshop二次开发,可以让ecshop注册的时候提供真实姓名,而且还可以在任何地方灵活调用。

1:alter table ecs_users add column real_name varchar(255);

2:admin/templates/user_info.htm
 <tr>
    <td class="label">真实姓名:</td>
    <td><input type="text" name="real_name" maxlength="60" value="{$user.real_name}" /></td>
  </tr>

3:admin/users.php的insert
$real_name = empty($_POST['real_name']) ? '' : trim($_POST['real_name']);
$other['real_name']  = $real_name;

4:admin/users.php的edit
,u.real_name

$user['real_name']       = date($row['real_name']);

5:admin/users.php的updata
$real_name = empty($_POST['real_name']) ? '' : trim($_POST['real_name']);

$other['real_name'] = $real_name;

6:admin/templates/user_list.htm
<th>姓名</th>
 <td class="first-cell">{$user.real_name|escape}</td>

7:users的user_list()函数
real_name


8:
alter table ecs_order_info add column send_address varchar(255),add column send_phone varchar(255);

9:order_info.htm
<td><div align="right"><strong>发货人:{$send_name}</strong></div></td>
10:order.php
elseif ($_REQUEST['act'] == 'info')


if($order){
  $send_name = $db -> getOne("select  real_name from  ".$ecs->table('users')." where user_id = '".$order[user_id]."'");
  $smarty -> assign('send_name',$send_name);
 }

 

11:order.php的elseif ($_REQUEST['act'] == 'step_post')
elseif ('other' == $step)
$order['send_address']      = $_POST['send_address'];
$order['send_phone']      = $_POST['send_phone'];

elseif ('other' == $step)

12:order.php的elseif ($_REQUEST['act'] == 'edit')

$send_info = $db -> getRow("select send_address,send_phone from ".$ecs->table('order_info')." where order_id = '$order_id'");
  
  $smarty -> assign('send_info',$send_info);

13:order_info.htm
<tr>
    <td><div align="right"><strong><font color="red">发货人地址:</font></strong></div></td>
    <td>{$order.send_address}</td>
    <td><div align="right"><strong><font color="red">发货人电话:</font></strong></div></td>
    <td>&nbsp;{$order.send_phone}</td>
  </tr>

14:order_step.htm


 <tr>
    <th><font color="red">发货人地址:</font></th>
    <td><input name="send_address" type="text" id="send_address" value="{$send_info.send_address}" size="40" /></td>
  </tr>
   <tr>
    <th><font color="red">发货人电话:</font></th>
    <td><input name="send_phone" type="text" id="send_phone" value="{$send_info.send_phone}" size="40" /></td>
  </tr>


15:  elseif (isset($_GET['shipping_print']))

 

$info = $db -> getRow("select * from ".$ecs->table('order_info')." where order_id= '$order_id'");
  $send_name = $db -> getOne("select  real_name from  ".$ecs->table('users')." where user_id = '".$order[user_id]."'");
  $info['real_name'] = $send_name;
  $smarty -> assign('info',$info);


16:order.php

 if (isset($_GET['print']))
    { 
  $info = $db -> getRow("select * from ".$ecs->table('order_info')." where order_id= '$order_id'");
  $send_name = $db -> getOne("select  real_name from  ".$ecs->table('users')." where user_id = '".$order[user_id]."'");
  $info['real_name'] = $send_name;
  $smarty -> assign('info',$info);

 来源:中国B4C电子商务