ECSHOP订单付款后给客户发送订单确认信息邮件

实现ECSHOP订单付款后给客户发送订单确认信息邮件这个功能,就要修改ECSHOP的程序文件:打开\includes\lib_payment.php该文件,找到166行左右,在“如果需要,发短信”的代码下面,加入以下的代码:
                if ($pay_status)
                {
                    $service_mail['email'] = $GLOBALS['_CFG']['service_email']; //客服邮件地址
                    $service_mail['sender'] = $GLOBALS['_CFG']['shop_name']; //网店名称
                    $sql = "SELECT pay_status, shipping_name, shipping_fee, pay_name, consignee, address, zipcode, tel, money_paid FROM " . $GLOBALS['ecs']->table(’order_info’) . " WHERE order_id = $order_id ";
                    $order_info = $GLOBALS['db']->getRow($sql);
                    if ($order_info['pay_status'] == PS_PAYED) $service_mail['status'] = '已付款';
                    if ($order_info['pay_status'] == PS_PAYING) $service_mail['status'] = '已付款到支付宝'; //货款暂存于支付宝的状态
                    date_default_timezone_set('PRC');
                    $service_mail['subject'] = "订单 $order_sn {$service_mail['status']}。"; //邮件的主题;
                    $service_mail['content'] = date('Y-m-d H:i')." 订单 $order_sn {$service_mail['status']},可以开始发货。 \r\n";
                    if ($note)
                    {
                        $service_mail['content'] .= '付款留言:'.$note."\r\n";
                    }
                    $service_mail['content'] .= "订单的详细情况:\r\n";
                    $service_mail['content'] .= "总金额:{$order_info['money_paid']} 元;\r\n";
                    $service_mail['content'] .= "配送方式:{$order_info['shipping_name']}(配送费:{$order_info['shipping_fee']})\r\n";
                    $service_mail['content'] .= "付款方式:{$order_info['pay_name']}({$service_mail['status']})\r\n";
                    $service_mail['content'] .= "收货人:{$order_info['consignee']}\r\n";
                    if ($order_info['zipcode'])
                    {
                        $order_info['zipcode'] = "邮编:{$order_info['zipcode']}";
                    }
                    else
                    {
                        $order_info['zipcode'] = '';
                    }
                    $service_mail['content'] .= "收货人地址:{$order_info['address']} {$order_info['zipcode']}\r\n";
                    $service_mail['content'] .= "收货人电话:{$order_info['tel']}\r\n\r\n";
                    //商品清单
                    $service_mail['content'] .= "订购商品清单:\r\n";
                    $sql = "SELECT goods_sn, goods_name, goods_number, goods_price FROM " . $GLOBALS['ecs']->table('order_goods') . " og, " . $GLOBALS['ecs']->table('order_info') . " oi WHERE og.order_id = oi.order_id AND oi.order_id = $order_id";
                    $res = $GLOBALS['db']->getAll($sql);
                    foreach ($res as $value)
                    {
                        $service_mail['content'] .= "货号:{$value['goods_sn']}; \t商品:{$value['goods_name']}; \t数量:{$value['goods_number']}; \r\n";
                    }
                    //发送邮件
                    send_mail($service_mail['sender'], $service_mail['email'], $service_mail['subject'], $service_mail['content'], 0);
                }

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

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

实时购买动态 ×

kinion会员 在 2019-04-14 购买了 ECSHOP批量导入淘宝CSV数据包插件支持tbi图片