ecshop虚拟物品人性化购物流程简化,删除“收货人信息”,一商设计更多精彩教程将会陆续更新,感谢二次开发支持关注,本次实例如下图:

修改方法分享:
找到文件include/lib_order.php,查找check_consignee_info函数:
复制内容到剪贴板
折叠
PHP 代码
- /**
- * 检查收货人信息是否完整
- * @param array $consignee 收货人信息
- * @param int $flow_type 购物流程类型
- * @return bool true 完整 false 不完整
- */
- function check_consignee_info($consignee, $flow_type)
- {
- if (exist_real_goods(0, $flow_type))
- {
- /* 如果存在实体商品 */
- $res = !emptyempty($consignee[’email’]) &&
- !emptyempty($consignee[‘tel’]);
- return $res;
- }
- else
- {
- /* 如果不存在实体商品 */
- return !emptyempty($consignee[’email’]) &&
- !emptyempty($consignee[‘tel’]);
- }
- }
打开文件js/shopping_flow.js,查找check_consignee_info函数:
复制内容到剪贴板
折叠
Java 代码
- /* *
- * 检查收货地址信息表单中填写的内容
- */
- function checkConsignee(frm)
- {
- var msg = new Array();
- var err = false;
- if (frm.elements[‘country’] && frm.elements[‘country’].value == 0)
- {
- msg.push(country_not_null);
- err = true;
- }
- if (frm.elements[‘province’] && frm.elements[‘province’].value == 0 && frm.elements[‘province’].length > 1)
- {
- err = true;
- msg.push(province_not_null);
- }
- if (frm.elements[‘city’] && frm.elements[‘city’].value == 0 && frm.elements[‘city’].length > 1)
- {
- err = true;
- msg.push(city_not_null);
- }
- if (frm.elements[‘district’] && frm.elements[‘district’].length > 1)
- {
- if (frm.elements[‘district’].value == 0)
- {
- err = true;
- msg.push(district_not_null);
- }
- }
- if (Utils.isEmpty(frm.elements[‘consignee’].value))
- {
- err = true;
- msg.push(consignee_not_null);
- }
- if ( ! Utils.isEmail(frm.elements[’email’].value))
- {
- err = true;
- msg.push(invalid_email);
- }
- if (frm.elements[‘address’] && Utils.isEmpty(frm.elements[‘address’].value))
- {
- err = true;
- msg.push(address_not_null);
- }
- if (frm.elements[‘zipcode’] && frm.elements[‘zipcode’].value.length > 0 && (!Utils.isNumber(frm.elements[‘zipcode’].value)))
- {
- err = true;
- msg.push(zip_not_num);
- }
- if (Utils.isEmpty(frm.elements[‘tel’].value))
- {
- err = true;
- msg.push(tele_not_null);
- }
- else
- {
- if (!Utils.isTel(frm.elements[‘tel’].value))
- {
- err = true;
- msg.push(tele_invaild);
- }
- }
- if (frm.elements[‘mobile’] && frm.elements[‘mobile’].value.length > 0 && (!Utils.isTel(frm.elements[‘mobile’].value)))
- {
- err = true;
- msg.push(mobile_invaild);
- }
- if (err)
- {
- message = msg.join(“\n”);
- alert(message);
- }
- return ! err;
- }
打开文件flow.php,分别查找2处代码注释或删除:
复制内容到剪贴板
折叠
PHP 代码
- $consignee = get_consignee($_SESSION[‘user_id’]);
- /* 检查收货人信息是否完整 */
- if (!check_consignee_info($consignee, $flow_type))
- {
- /* 如果不完整则转向到收货人信息填写界面 */
- ecs_header(“Location: flow.php?step=consignee\n”);
- exit;
- }
- $_SESSION[‘flow_consignee’] = $consignee;
- $smarty->assign(‘consignee’, $consignee);
继续查找删除:
复制内容到剪贴板
折叠
PHP 代码
- $consignee = get_consignee($_SESSION[‘user_id’]);
- /* 检查收货人信息是否完整 */
- if (!check_consignee_info($consignee, $flow_type))
- {
- /* 如果不完整则转向到收货人信息填写界面 */
- ecs_header(“Location: flow.php?step=consignee\n”);
- exit;
- }
修改完成,刷新试试,有问题请更新缓存。
