ECSHOP后台增加订单备注功能

1、登录ECSHOP后台,SQL查询提交以下语句,添加表:ecs_order_note;
CREATE TABLE IF NOT EXISTS `ecs_order_note` (
  `note_id` int(10) NONULLUTO_INCREMENT,
  `order_id` varchar(20) CHARACTER SET utf8 NOT NULL,
  `note_value` text CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`note_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
2、添加语言代码,打开languages\zh_cn\admin\order.php文件,加入如下代码
$_LANG['label_order_note'] = '管理员订单备注:';
3、修改admin/order.php文件第103行,添加代码:
/* 保存订单备注 */
elseif ($_REQUEST['act'] == 'save_ordernote')
{
    $oid = $_REQUEST['oid'];
    $oval = $_REQUEST['noteVal'];
 
    $sql = "SELECT count(note_value) FROM " . $ecs->table('order_note') .
        " WHERE order_id = $oid";
    $note_count = $db->getOne($sql);
 
    if ($note_count == 0)
    {
        $sql = "insert into " . $ecs->table('order_note') .
            "(order_id,note_value) values(" . $oid . ",'" . $oval . "')";
    }
    else
    {
        $sql = "UPDATE " . $ecs->table('order_note') . " SET note_value = '" . $oval .
            "' WHERE order_id = " . $oid;
    }
    $db->query($sql);
}
继续找到以下代码:
    /* 取得能执行的操作列表 */
    $operable_list = operable_list($order);
    $smarty->assign('operable_list', $operable_list);
以上代码下面加入以下代码:
    $sql = "SELECT note_value FROM " . $ecs->table('order_note') .
        " WHERE order_id = '$order[order_id]'";
    $order_note = $db->getOne($sql);
    $smarty->assign('order_note', $order_note);
4、打开admin\templates\order_info.htm文件,找到如下代码:
  <tr>
    <td><div align="right"><strong>{$lang.label_action_note}</strong></div></td>
  <td colspan="5"><textarea name="action_note" cols="80" rows="3"></textarea></td>
    </tr>
  <tr>
在上面代码下面加入以下代码:
  <tr>
    <td><div align="right"><strong>{$lang.label_order_note}</strong></div></td>
    <td colspan="5">
        <textarea name="order_note" cols="80" rows="3" onblur="saveOrderNote({$smarty.request.order_id},this)">{$order_note}</textarea>
    </td>
  </tr>
继续找到如下代码:
</script>
{/literal}
在上面代码上面加入以下代码:
  function saveOrderNote(oid,parm)
  {
    var noteVal = parm.value;
    Ajax.call('order.php?is_ajax=1&act=save_ordernote&oid='+oid+'&noteVal='+noteVal,'', saveOrderResponse, 'POST', '');
  }
   
  function saveOrderResponse(result)
  {
    //alert(result);
  }
5、打开admin\order.php文件,找到如下代码:
$db->query("DELETE FROM ".$ecs->table('order_action'). " WHERE order_id = '$order_id'");
在上面代码下面加入以下代码:
$db->query("DELETE FROM " .$ecs->table('order_note') . " WHERE order_id = '$order_id'");
继续找到如下代码:
$db->query("DELETE FROM ".$ecs->table('order_action'). " WHERE order_id = '$order[order_id]'");
在上面代码下面加入以下代码:
$db->query("DELETE FROM " .$ecs->table('order_note') . " WHERE order_id = '$order[order_id]'");

本文原创地址:https://www.ecshop.cx/article-395.html
版权所有 © 转载时必须以链接形式注明出处!

觉得本文对您有用,想收藏下来!方法很简单:请点击-〉
我们一直坚持白天工作、晚上熬夜更新资源,付出了巨大的精力和时间,其中的辛酸难以言述。

实时购买动态 ×

匿名网友 在 2019-07-07 购买了 ECSHOP一个账号同时只能一个人登录【实现前者踢下线功能】