Magento自动发送跟踪电子邮件 [英] Magento Automatically send tracking email

查看:139
本文介绍了Magento自动发送跟踪电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,一直在寻找这个无处不在,不能想出任何东西...我们通过Dydacomp的邮件订单管理器软件的同步程序在Magento社区1.7.0.2中外部填充跟踪号码 - 它关闭在Magento中订购并添加跟踪号码,但不会触发法师中的发送跟踪电子邮件功能。 - 我已经研究过,看到有观察者等看起来也许可以做到这一点,但20小时之后,我可以找到每个博客,等等,无法想出任何有用的东西!



这个链接似乎是正确的方向...但是在哪里放这块代码?我试过把它放在各种地方,没有任何作用:
发送跟踪号码设置时编程发送电子邮件



任何帮助将非常感谢。

解决方案

我开发了类似的东西。我创建了一个由cron激活的模块(每天一次),用于检查最后的已交付订单(完整状态)。



要在您的cron magento中运行一个函数模块,添加到您的config.xml

 < crontab> 
< jobs>
< myModule_myFunction>
< schedule>< cron_expr> * / 60 * * * *< / cron_expr>< / schedule>
< run>< model> emailtracker / cron :: myFunction< / model>< / run>
< / myModule_myFunction>
< / jobs>
< / crontab>

对于有耗材的订单,您可以使用以下代码片段

  $ orders = Mage :: getModel('sales / order') - > getCollection()
- > addFieldToFilter('status'完成')
- > addAttributeToFilter('created_at',array('gteq'=> $ dataForFilter));

请注意,我创建的订单的收集,我按日期过滤,以避免检索所有订单



随着我收集的最近和完整的订单,可能是候选人接收跟踪电子邮件传递,我实际上可以处理重要的订单。 / p>

我创建了一个foreach来运行我的集合,并在该循环中检索跟踪号。

 $ code foreach($ orders as $ order){
$ trackings = Mage :: getResourceModel('sales / order_shipment_track_collection')
- > setOrderFilter($ order)
- >的getData(); ($ i = 0; $ i< count($ trackings); $ i ++){
$ trackingNumber = $ trackings [$ i] ['track_number'];


//让你的php魔法在这里
}
}

从这一点上,您可以按照所需的方式处理这些信息。您可以创建一个功能,通过API检查跟踪号码的状态,其传送服务发送电子邮件,或者您可以想象。



重要提示:记住检查您的magento cron活跃。
注意:我在Magento 1.6.1.0中进行了


OK, been searching this everywhere, and can't come up with anything... we are externally populating tracking numbers in Magento Community 1.7.0.2 via a sync program from Dydacomp's Mail order Manager software... - it closes the order in Magento and adds a tracking number, but does not trigger the send tracking email function in mage. - I have researched, and seen that there are observers, etc. which appear maybe to be able to do this, but after 20 hours scouring every blog I can find, etc. cannot come up with anything that works!

This link seems to be REALLY in the right direction... but where to put this block of code? I've tried putting it in all kinds of places and none works: Programmaticly send email when shipping tracking number is set

Any help would be tremendously appreciated.

解决方案

I developed something similar. I created a module activated by cron (once a day) that checks the last orders that have 'delivered' (complete status).

To run a function in your cron magento module, add to your config.xml

<crontab>
    <jobs>            
        <myModule_myFunction>
            <schedule><cron_expr>*/60 * * * *</cron_expr></schedule>
            <run><model>emailtracker/cron::myFunction</model></run>
        </myModule_myFunction>
    </jobs>
</crontab>

For the order to have supplies you can use the following code snippet

$orders = Mage::getModel('sales/order')->getCollection()
        ->addFieldToFilter('status', 'complete')
        ->addAttributeToFilter('created_at', array('gteq' => $dataForFilter));

Note that the collection of orders that I created, I make filter by date to avoid retrieving all orders already made​​.

With my collection of recent and complete orders that are possible candidates to receive a tracking email delivery, I can actually work with the orders that are important.

I created a foreach to run in my collection and within that loop, retrieve the tracking number.

foreach($orders as $order) {
    $trackings = Mage::getResourceModel('sales/order_shipment_track_collection')
            ->setOrderFilter($order)
            ->getData();

    for($i=0;$i<count($trackings);$i++) {
        $trackingNumber = $trackings[$i]['track_number'];
        //Make your php magic here
    }
}

From this point, you can work this information the way you want. You can create a function that checks the status of tracking number via API and its delivery service sends an email, or you can imagine.

Important: Remember to check if your magento cron is active. Note: I did it in Magento 1.6.1.0

这篇关于Magento自动发送跟踪电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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