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

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

问题描述

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

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天全站免登陆