主页教程 ECshop教程 查看内容

ecshop 商城的会员申请退换货申请功能插件

发表于 15-06-07 17:04 | 栏目: ECshop教程
ecshop 自带会员中心不具备有退换货功能,只能是管理员在后台操作订单,因此发布一项二次开发的退换货插件。

总共有两种方式:推荐使用第一种。具体如下“

第一种:

/wwwroot/themes/mnz8/user_transaction.dwt
搜索:
<!--{foreach from=$orders item=item}-->这一段代码大概在188行。
在<td align="right" bgcolor="#ffffff">{$item.order_status}</td>下添加这一段代码<td align="right" bgcolor="#ffffff"><font class="f6">{$item.handler}<a href="user.php?act=message_list&order_id={$item.order_id}" class="f6">{$lang.business_message}</a></font></td>

然后在/wwwroot/languages/zh_cn/common.php文件下增加$lang.business_message字段为“申请退款”到这里刷新你的个人中心即可看到你的申请退款的功能已经增加在每个订单的后面了,这里要记得添加的代码"user.php?act=message_list&order_id={$item.order_id}" 为订单指定调用到每个订单的留言系统。如果后台站长有回复 那么用户在个人中心即可看到申请退款订单的最新情况。




第二种方法:

  1. user.php
  2. $smarty->display('user_clips.dwt');
  3. }
下面添加
  1. //www.mnz8.com
  2. if($action == 'refund')
  3. {
  4. $rec_id = $_REQUEST['rec_id'];
  5. $goods = get_order_goods_info($rec_id);
  6. if($goods['refund_status']>0)
  7. {
  8. die("invalid");
  9. }
  10. if(!can_refund($goods['order_id']) )
  11. {
  12. die("invalid");
  13. }
  14. $refund_reason_arr = array("无理由退货", "质量问题", "与描述不符");
  15. $options = array();
  16. foreach($refund_reason_arr as $k=>$v) 
  17. {
  18. $options[$v] = $v;
  19. }
  20. $smarty->assign('refund_reason_options', $options );
  21. $smarty->assign('refund_goods', $goods);
  22. $smarty->display("user_transaction.dwt");
  23. }
  24. //www.mnz8.com
  25. if('act_refund' == $action)
  26. {
  27. $rec_id = $_POST['rec_id'];
  28. $refund = $_POST;
  29. unset($refund['rec_id']);
  30. $refund['refund_pic1'] = (isset($_FILES['refund_pic1']['error']) && $_FILES['refund_pic1']['error'] == 0) || (!isset($_FILES['refund_pic1']['error']) && isset($_FILES['refund_pic1']['tmp_name']) && $_FILES['refund_pic1']['tmp_name'] != 'none')
  31. ? $_FILES['refund_pic1'] : array();
  32. $refund['refund_pic2'] = (isset($_FILES['refund_pic2']['error']) && $_FILES['refund_pic2']['error'] == 0) || (!isset($_FILES['refund_pic2']['error']) && isset($_FILES['refund_pic2']['tmp_name']) && $_FILES['refund_pic2']['tmp_name'] != 'none')
  33. ? $_FILES['refund_pic2'] : array();
  34. $refund['refund_pic3'] = (isset($_FILES['refund_pic3']['error']) && $_FILES['refund_pic3']['error'] == 0) || (!isset($_FILES['refund_pic3']['error']) && isset($_FILES['refund_pic3']['tmp_name']) && $_FILES['refund_pic3']['tmp_name'] != 'none')
  35. ? $_FILES['refund_pic3'] : array();
  36. if(refund_apply_order_goods($refund, $rec_id) )
  37. {
  38. show_message("成功申请退款", "订单列表", "user.php?act=order_list");
  39. }
  40. else
  41. {
  42. $GLOBALS['err']->show("订单列表", 'user.php?act=order_list');
  43. }
  44. }
  45. $orders = get_user_orders($user_id, $pager['size'], $pager['start']);
改为
  1. $orders = get_user_orders_ex($user_id, $pager['size'], $pager['start']);//www.mnz8.com
lib_common.php里面 
  1. if (!defined('IN_ECS'))
  2. {
  3. die('Hacking attempt');
  4. }
 
下面添加
 
  1. //www.mnz8.com
  2. include_once(ROOT_PATH."includes/lib_return.php");
user_transaction.dwt 文件
 
下面添加
  1. {if $action eq 'refund'}
  2. {/if}
 
下面对照 覆盖 
 
  1. {$lang.label_order}
  2. {foreach from=$item.goods_list name="foreach_goods_list" item=goods}
  3. {if $smarty.foreach.foreach_goods_list.first}
  4. {/if}
  5. {/foreach}


后台admin文件夹修改开始  
 
admin/order。php文件
 
(1)
elseif ($_REQUEST['act'] == 'list')
改为
  1. elseif ($_REQUEST['act'] == 'list' || 'refund_list' == $_REQUEST['act'])
(2)
/* 检查权限 */
admin_priv('order_view');下面添加
 
  1. //www.mnz8.com
  2. $refund_ex = 'refund_list' == $_REQUEST['act'] ? " refund_status>'0'" : "";
 
(3) $smarty->assign('ur_here', $_LANG['02_order_list']);修改为
 
  1. $smarty->assign('ur_here', 'list' == $_REQUEST['act'] ? $_LANG['02_order_list'] : "退款申请列表");
 
(4) $order_list = order_list();修改为
  1. $order_list = order_list($refund_ex);
 
(5) $smarty->assign('sort_order_time', '');下面添加
  1. $tpl_file = 'order_list.htm';
  2. 'refund_list' == $_REQUEST['act'] && $tpl_file='refund_list.htm';
 
(6)  /* 显示模板 */
  1. assign_query_info();
  2. $smarty->display('order_list.htm');
  3. }
 
修改为
 
  1. /* 显示模板 */
  2. assign_query_info();
  3. $smarty->display($tpl_file);
  4. }
  5.  
  6. //www.mnz8.com
  7. elseif('confirm_refund' == $_REQUEST['act'])
  8. {
  9. $rec_id = intval($_REQUEST['rec_id']);
  10. $rec_id<=0 && die("invalid");
  11. $agree = intval($_REQUEST['agree']);
  12. $refund_status = $agree ? 2 : 3;
  13. refund_confirm_order_goods($rec_id, $refund_status);
  14. $links[] = array('text' => '退款申请列表', 'href' => 'order.php?act=refund_list');
  15. sys_msg("成功处理该退款申请", 1, $links);
  16. }
(7)
  1. /*------------------------------------------------------ */
  2. //-- 排序、分页、查询
  3. /*------------------------------------------------------ */
  4. elseif ($_REQUEST['act'] == 'query')
  5. {
  6. /* 检查权限 */
  7. admin_priv('order_view');
  8.  
  9. $order_list = order_list();
  10.  
  11. $smarty->assign('order_list',   $order_list['orders']);
  12. $smarty->assign('filter',       $order_list['filter']);
  13. $smarty->assign('record_count', $order_list['record_count']);
  14. $smarty->assign('page_count',   $order_list['page_count']);
  15. $sort_flag  = sort_flag($order_list['filter']);
  16. $smarty->assign($sort_flag['tag'], $sort_flag['img']);
  17. make_json_result($smarty->fetch('order_list.htm'), '', array('filter' => $order_list['filter'], 'page_count' => $order_list['page_count']));
  18. }
 
 
修改为
 
  1. /*------------------------------------------------------ */
  2. //-- 排序、分页、查询
  3. /*------------------------------------------------------ */
  4. elseif ($_REQUEST['act'] == 'query' || $_REQUEST['act']=='refund_query')
  5. {
  6. /* 检查权限 */
  7. admin_priv('order_view');
  8. //www.mnz8.com
  9. $refund_ex = 'refund_query' == $_REQUEST['act'] ? " refund_status>'0'" : "";
  10.  
  11. $order_list = order_list($refund_ex);
  12.  
  13. //www.mnz8.com
  14. $tpl_file = 'order_list.htm';
  15. 'refund_query' == $_REQUEST['act'] && $tpl_file='refund_list.htm';
  16.  
  17. $smarty->assign('order_list',   $order_list['orders']);
  18. $smarty->assign('filter',       $order_list['filter']);
  19. $smarty->assign('record_count', $order_list['record_count']);
  20. $smarty->assign('page_count',   $order_list['page_count']);
  21. $sort_flag  = sort_flag($order_list['filter']);
  22. $smarty->assign($sort_flag['tag'], $sort_flag['img']);
  23. make_json_result($smarty->fetch($tpl_file), '', array('filter' => $order_list['filter'], 'page_count' => $order_list['page_count']));
  24. }
  25. (8)
  26.  
  27. $filter['start_time'] = empty($_REQUEST['start_time']) ? '' : (strpos($_REQUEST['start_time'], '-') > 0 ?  local_strtotime($_REQUEST['start_time']) : $_REQUEST['start_time']);
  28. $filter['end_time'] = empty($_REQUEST['end_time']) ? '' : (strpos($_REQUEST['end_time'], '-') > 0 ?  local_strtotime($_REQUEST['end_time']) : $_REQUEST['end_time']);
  29.  
  30. $where = 'WHERE 1 ';
 
下面添加
 
 
  1. //www.mnz8.com
  2. if(!empty($refund_ex) )
  3. {
  4. $arr = $GLOBALS['db']->getCol("select distinct order_id from ".$GLOBALS['ecs']->table("order_goods")." where   ".$refund_ex);
  5. $arr[] = 0;
  6. $where .= " and o.order_id ".db_create_in($arr);
  7. }
 
(9)
 
  1. $row[$key]['formated_order_amount'] = price_format($value['order_amount']);
  2. $row[$key]['formated_money_paid'] = price_format($value['money_paid']);
  3. $row[$key]['formated_total_fee'] = price_format($value['total_fee']);
  4. $row[$key]['short_order_time'] = local_date('m-d H:i', $value['add_time']);
 
下面添加
 
  1. //www.mnz8.com
  2. $row[$key]['refund_goods_list'] = get_order_goods_list($value['order_id'], " and refund_status>0");
  3. (10)
  4.  
  5. /**
  6. *  获取订单列表信息
  7. *
  8. * @access  public
  9. * @param
  10. *
  11. * @return void
  12. */
  13. function order_list()
 
修改为
 
 
  1. /**
  2. *  获取订单列表信息
  3. *
  4. * @access  public
  5. * @param
  6. *
  7. * @return void
  8. */
  9. function order_list($refund_ex="")//www.mnz8.com
 
admin/index.php修改
 
 
/* 退款申请 */
$smarty->assign('new_repay', $db->getOne('SELECT COUNT(*) FROM ' . $ecs->table('user_account') . ' WHERE process_type = ' . SURPLUS_RETURN . ' AND is_paid = 0 '));
 
下面添加
 
  1. //www.mnz8.com
  2. $smarty->assign('refund_goods', $GLOBALS['db']->getOne("select count(*) from ".$GLOBALS['ecs']->table("order_goods")." where refund_status=1") );
  3.  
  4.  
  5. admin/start.htm
  6.  
  7.  
  8. {$lang.new_booking}
  9. {$booking_goods}
  10. {$lang.new_reimburse}
  11. {$new_repay}
 
 
下面添加
 
 
退换货申请
{$refund_goods}
 
 
其他文件 是新加文件 直接覆盖
 
最后后台sql执行:前缀改成你的
  1. alter table ecs_order_goods  
  2. add refund_reason    varchar(255)    not null default '',            
  3. add refund_desc    text    not null default '',            
  4. add refund_pic1    varchar(255)    not null default '',            
  5. add refund_pic2    varchar(255)    not null default '',            
  6. add refund_pic3    varchar(255)    not null default '',            
  7. add refund_add_time    int(10) unsigned    not null default '0',
  8. add refund_confirm_time    int(10) unsigned    not null default '0',
  9. add refund_confirm_desc    text    not null default '',            
  10. add refund_status    tinyint(1) unsigned not null default '0';
 

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

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