A-A+
ecshop蛋糕模板添加生日字段
ecshop 商城系统往往是用来做电子商务站点使用的,现在不少的鲜花站点了,蛋糕站点了,都在使用 ecshop 搭建其平台,一个客户拿来做蛋糕站点,既然是卖蛋糕的,哪注册的会员肯定就少不了会员生日这一个字段了,将会员的生日保存下来,在会员生日的时候发送一段小的 email 进行祝福,想来是个不错的主意,好了,说做就做,ecshop 默认的是没有生日这个字段的,夏日博客就把注册时如何添加生日字段的方法给分享一下。
第一步,打开 include/lib_passport.php 文件,查找如下代码:
- function register($username, $password, $email, $other = array())
- //替换:
- function register($username, $password, $email, $other = array(), $birthday)
第二步,打开根目录下的 user.php 文件,查找如下代码:
- include_once(ROOT_PATH . 'includes/lib_passport.php');
在这段代码的下面再增加如下的代码:
- $birthday = trim($_POST['birthdayYear']) .'-'. trim($_POST['birthdayMonth']) .'-'. trim($_POST['birthdayDay']);
接着再查找如下代码:
- /* 写入密码提示问题和答案 */
- if (!emptyempty($passwd_answer) && !emptyempty($sel_question))
- 在这段上面增加如下代码:
- $sql = 'UPDATE ' . $ecs->table('users') . " SET `birthday`='$birthday' WHERE `user_id`='" . $_SESSION['user_id'] . "'";
- $db->query($sql);
再接着找到:
- if (register($username, $password, $email, $other) !== false)
将其替换为:
- if (register($username, $password, $email, $other,$birthday) !== false)
第三步,打开注册模板文件 themes/xiariboke/user_passport.dwt,找到如下代码:
- <tr>
- <td align="right">{$lang.label_confirm_password}</td>
- <td>
- <input name="confirm_password" type="password"id="conform_password" class="inputBg" style="width:179px;"/>
- <span style="color:#FF0000" id="conform_password_notice"> *</span>
- </td>
- </tr>
在其之后,插入代码
- <tr>
- <td width="28%" align="right" bgcolor="#FFFFFF">{$lang.birthday}: </td>
- <td width="72%" align="left" bgcolor="#FFFFFF"> {html_select_date field_order=YMD prefix=birthday start_year=-60 end_year=+1 display_days=true month_format=%m day_value_format=%02d time=this.birthday} </td>
- </tr>
好了,在 ecshop 后台把缓存清理一下,去前台注册页面看看吧,是否已经添加了生日字段呢。。