设置运输跟踪编号时以编程方式发送电子邮件 [英] Programmatically send email when shipping tracking number is set

查看:46
本文介绍了设置运输跟踪编号时以编程方式发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在为订单分配跟踪号时以编程方式向用户发送电子邮件的方法.我需要能够以编程方式执行此操作,因为我使用外部源来填充跟踪信息.

I am looking for a way to programmatically send an email to the user when a tracking number is assigned to an order. I need to be able to do this programmatically because I am using an outside source to populate the tracking information.

我想我在这里真正要寻找的是一个特定的触发器或事件,我可以用它来触发通常在管理员单击发送跟踪信息"按钮时发送的电子邮件.我浏览了核心代码,但无法确定按下该按钮时实际触发的操作.

I guess what I am really looking for here is a specific trigger or event that I could use to fire off the email that would normally be sent when the admin clicks the "Send Tracking Information" button. I have skimmed through the core code and have not been able to put my finger on what action is actually being triggered when that button is pushed.

我们正在使用第三方 (eBridge) 来连接我们的销售工具.一旦订单被标记为已发货并将跟踪号输入到 eBridge 工具中,它就会与 magento 对话并将跟踪号输入到订单中.问题是它没有告诉 magento 发送电子邮件以向客户提供这个新输入的跟踪号码.我想要做的是,一旦将信息放入 magento,就会从 magentos 端发送一封电子邮件.这可能吗?简而言之,我们想要的是能够让 magento 发送一封包含跟踪信息的电子邮件,而无需手动进入每个订单并点击发送跟踪信息"按钮.

We are using a third party (eBridge) to connect with our sales tools. Once an order has been marked as shipped and a tracking number is input into the eBridge tool, it will talk to magento and input the tracking number into the order. The problem is that it doesn't tell magento to fire off an email to provide the customer with this newly inputted tracking number. What I am trying to do is, once the information is put into magento fire off an email from magentos side. Is this possible? What we want, in a nutshell, is to be able to have magento send off an email with the tracking information without having to manually go into each order and click the "Send Tracking Information" button.

推荐答案

当您通过控制面板向订单添加新货件时,您可以勾选一个框以发送电子邮件.如果您需要以编程方式发送此信息,管理区域的控制器只需调用 Mage_Sales_Model_Order_Shipment 上的 sendEmail 方法.

When you add a new shipment to an order via the control panel you can tick a box to send the e-mail. If you need to send this programmatically, the controller for the admin area simply calls the sendEmail method on the Mage_Sales_Model_Order_Shipment.

更新:如果跟踪编号是通过标准"方法添加到货件中的,即货件 API 的 addTrack 方法,那么您将能够挂钩sales_order_shipment_track_save_after 事件.添加一个观察者,该观察者执行...

UPDATE: If the tracking number is being adding to the shipment via the 'standard' method, which is to say the addTrack method of the shipment api, then you would be able to hook into the sales_order_shipment_track_save_after event. Adding an observer that does something along the lines of...

public function sendTrackEmail($observer)
{
    $track = $observer->getEvent()->getTrack();
    $shipment = $track->getShipment(true);
    $shipment->sendEmail();
}

这篇关于设置运输跟踪编号时以编程方式发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆