给你的用户一个提醒:让他们在Magento下一个单吧

2,764次阅读
一条评论

共计 4053 个字符,预计需要花费 11 分钟才能阅读完成。

给你的用户一个提醒:让他们在Magento下一个单吧
Sometimes customers need a little encouragement to place their first order after creating an account. There are many reasons this is the case, for example customers may forget to bookmark your site, thus they might have difficulties finding your store second time around. In this article I’ll present one way of keeping an eye on your customers orders count and sending first order reminder emails, trough free Magento extension named Inchoo_OrderReminder.

Introduction

Source code for Inchoo_OrderReminder is available from its GitHub repository page, as usual here I’ll just present it’s features and some code snippets. So here are the features of Inchoo_OrderReminder:

  • Can send reminder emails to customers who haven’t placed any orders yet, on configurable interval in days.
  • Maximum number of email reminders is also configurable, as well as action to take after sending last email reminder (move to different customer group or delete an account).
  • Regular and last order reminder email templates are configurable trough Magento’s transactional email templates feature.
  • Configurable reminder email sender identity as well as sending reminder emails to additional email addresses as copy or Bcc

Here’s the screenshot of configuration options available at System -> Configuration -> Sales Emails -> Order Reminders inside your Magento admin area:

给你的用户一个提醒:让他们在Magento下一个单吧

Background

In this section I’ll present some code and basic logic behind Inchoo_OrderReminder. Inchoo_OrderReminder_Model_Observer::processOrderReminders() function is configured to be triggered by cron daily to process customers according to the configuration options. Here’s the config.xml code snippet for that purpose:

[php]
<pre title=""><config>
<crontab>
<jobs>
<inchoo_orderreminder>
<!– Daily at 1 am –>
<schedule><cron_expr>0 1 * * *</cron_expr></schedule>
<run><model>inchoo_orderreminder/observer::processOrderReminders</model></run>
</inchoo_orderreminder>
</jobs>
</crontab>
</config>
[/php]

When triggered, this function will derive dates from Number of Reminders and Reminder Interval configuration options, taking Magento timezone configuration option into an account, and then grab all customers whose account has been created on that date, for every derived date. This function will then send emails to customers without any orders using proper transactional email template. It’ll also take actions of moving to another group or deleting customers who have been sent their last email reminder, if instructed to do so by system config options.

Here’s the code snippet of class Inchoo_OrderReminder_Model_Observer’s protected function for sending transactional emails:

[php]
<pre title="">/**
* Send transactional emails.
*
* @param Varien_Object $customer Customer object
* @param int $reminderLimit Number of days for last reminder
* @param int $reminderKey Number of days since customer account was created
* @param string $template Email template
*/
protected function _sendOrderReminderEmail(Varien_Object $customer, $reminderLimit, $reminderKey, $template)
{
$this->_log(‘Preparing email…’);
// Get necessary vars
$copyTo = $this->_getStoreConfigCopyTo();
$copyMethod = $this->_getStoreConfigCopyMethod();
$storeId = Mage::app()->getStore()->getId();
// Uses code from Mage_Sales_Model_Order::sendNewOrderEmail()
$mailer = Mage::getModel(‘core/email_template_mailer’);
$emailInfo = Mage::getModel(‘core/email_info’);
$emailInfo->addTo($customer->getEmail(), $customer->getName());
if ($copyTo && $copyMethod == ‘bcc’) {
// Add bcc to customer email
foreach ($copyTo as $email) {
$emailInfo->addBcc($email);
$this->_log(sprintf(‘Add %s to Bcc.’, $email));
}
}
$mailer->addEmailInfo($emailInfo);
// Email copies are sent as separated emails if their copy method is ‘copy’
if ($copyTo && $copyMethod == ‘copy’) {
foreach ($copyTo as $email) {
$emailInfo = Mage::getModel(‘core/email_info’);
$emailInfo->addTo($email);
$mailer->addEmailInfo($emailInfo);
$this->_log(sprintf(‘Will send a copy to %s.’, $email));
}
}
// Set all required params and send emails
$mailer->setSender($this->_getStoreConfigIdentity(), $storeId);
$mailer->setStoreId($storeId);
$mailer->setTemplateId($template);
$mailer->setTemplateParams(
array(
// Customer object
‘customer’ => $customer,
// Reminder for number of days
‘reminder_days’ => $reminderKey,
// Last reminder number of days
‘reminder_limit’ => $reminderLimit
)
);
// Send
$mailer->send();
$this->_log(‘Email sent.’);
}
[/php]

当然你也可以直接下载最新源码,使用此插件!

For more details about Inchoo_OrderReminder you can always checkout and download up-to-date code from Inchoo_OrderReminder’s GitHub repository page. Cheers and happy coding!

正文完
 0
评论(一条评论)

空瓶子部落

文章搜索
推荐阅读
螺纹的标准很乱,这篇文章把它归纳全了

螺纹的标准很乱,这篇文章把它归纳全了

做机械的天天要和螺纹打交道,时间一长,国内的国外的、公制的英制的、直的锥的、密封的非密封的、内的外的、55度的...
深度思考要学习的两类人:间谍,麦肯锡

深度思考要学习的两类人:间谍,麦肯锡

解决问题是指在情况复杂、形式不明、没有明确解决方案时进行决策。 这似乎是人类永恒的话题,不管是在职场、商战、政...
基于Cloudflare R2搭建零成本图床,配合免费CDN,这才叫遥遥领先!

基于Cloudflare R2搭建零成本图床,配合免费CDN,这才叫遥遥领先!

关于互联网大善人Cloudflare的各种歌功颂德笔者就不多费口舌了,总之一句话:在墙内的各种云上需要花大价钱...
5M1E分析法原来是这样的!!!

5M1E分析法原来是这样的!!!

企业和工厂管理基本要素,同时也是系统地分析问题产生根源的思路和方向,是“顺藤摸瓜”的那一根“藤”。 5M1E简...
为何你的沟通在他眼里都是攻击:他不想从高位者变成服从者!

为何你的沟通在他眼里都是攻击:他不想从高位者变成服从者!

我今天看到了一句话说的特别对,对错可以申辩,冷漠却让人无计可施。 如果你在关系里,用尽了很多的沟通技巧,你只是...
最新文章
Free TV:全球免费电视频道 M3U 播放列表,狂揽数万 Star

Free TV:全球免费电视频道 M3U 播放列表,狂揽数万 Star

https://github.com/Free-TV/IPTV 项目简介 Free TV 是一个精心维护的开源...
群晖 Let’s Encrypt 泛域名证书自动更新

群晖 Let’s Encrypt 泛域名证书自动更新

目前acme协议版本更新,开始支持泛域名(wildcard),也就是说,可以申请一个类似*.domain.co...
可以卸载TV Box 了,这款支持「绅士模式」的影视神器你值得拥有

可以卸载TV Box 了,这款支持「绅士模式」的影视神器你值得拥有

还在为找优秀片源难、广告多、平台会员太贵而烦恼?今天给大家挖到一款真正的影视宝藏工具——小猫影视! 作为开源免...
【收藏】一次性解决TV点播/直播自由

【收藏】一次性解决TV点播/直播自由

很多时候,资源就在面前,但是我们视而不见,因为长久的安逸,已经让人失去动手的兴趣。但是每次我需要挨个切换APP...
OpenWrt 存储空间扩容的两种方案

OpenWrt 存储空间扩容的两种方案

说明:当我们通过群晖 VMM 虚拟机安装 Open­Wrt 时,默认会分配一个 10GB 的存储空间,而实际情...
热门文章
提高过程能力指数(CP/CPK)的途径

提高过程能力指数(CP/CPK)的途径

编者按:过程能力指数(CP/CPK)想必各位质量人都耳熟能详、运用自如,质量工程师之家前期也共享过数篇关于过程...
SPC控制图的八种模式分析

SPC控制图的八种模式分析

SPC控制图有八种模式,即八种判断异常的检验准则,每一种检验准则代表一种异常现象,应用SPC控制图进行过程评估...
测量高手放大招:圆跳动测量技巧总结

测量高手放大招:圆跳动测量技巧总结

01. 前言 在五金机加工厂实际的测量工作中,经常碰到要求测量两个要素的圆跳动问题, 利用不同的测量辅件及夹具...
过程能力分析(CP&cpk)

过程能力分析(CP&cpk)

引入过程能力分析的目的? 在我们现有的管理过程中,我们经常会遇到有些具体指标总是不尽人意,存在许多需要改进的地...
新能源汽车 “两会”精神宣贯会

新能源汽车 “两会”精神宣贯会

此次和大家分享新能源汽车相关政策: [embeddoc url=”https://www.ctro...
最新评论
多乐士 多乐士 通过摸索发现ssh拉取会报错,直接网页访问下载会报404错误,不知道原因;但是可以通过群晖CM注册表访问下载,其方法如下: Container Manager-注册表-设置-新增-注册表名称随便写,注册表URL填你的加速地址,勾选信任的SSL自我签署证书,登录信息不填-应用-使用你的地址,这是注册表会显示了,在搜索栏中输入映像名称,搜索结果在每一页的最后一个,你需要划到最后一个进行下载,实测可正常下载安装。 以上供网友参考。
多乐士 多乐士 还有一个比较简单的方法,只是需要一些外部工具。 1、讲损毁硬盘取出,装入外部移动硬盘 2、打开Diskgenius,定位到硬盘 3、格式化系统分区 4、重新插入硬盘 5、存储池->修复存储池即可
多乐士 多乐士 写的不错的文章
辞了老衲 辞了老衲 这个确实有帮助。
渋驀 渋驀 当然任何时候都可以用curl命令和crontab来实现动态更新DDNS的ip地址: 1、安装crontab之后为root用户创建文件/var/spool/cron/root 2、创建并配置ddnsupdate.sh,放到/usr/bin/文件下,文件内容(以he.net为例): Autodetect my IPv4/IPv6 address: IPV4:curl -4 "http://dyn.example.com:password@dyn.dns.he.net/nic/update?hostname=dyn.example.com" IPV6:curl -6 "http://dyn.example.com:password@dyn.dns.he.net/nic/update?hostname=dyn.example.com" 3、添加执行权限chomod +x /usr/bin/ddnsupdate.sh 4、编辑root用户的crontab:*/10 * * * * /usr/binddnsupdate.sh,每10分钟执行一次。好了,可以享受你的DDNS了
21410 21410 请问下载链接在那里?
madkylin madkylin 不错,不错,谢谢分享了,好东西啊 :lol:
feilung feilung 求方法
zengsuyi zengsuyi 应该挺不错的
zise zise 看看是怎么操作的。。 :oops: