在magento建设的网店中,有时客户创建账户后需要一些鼓励来拍下他们的第一个宝贝,这样的事情原因有很多,例如,你的客户忘记了你的网站的书签,因此他们想再次找到你的网站就很困难。在本文中我将介绍一个分厂好的方法,着眼于保持客户订单数量和给客户发送第一封订单邮件提醒,你可以用我们的免费插件来实现Alwayly_OrderReminder magento 订单提醒插件介绍至于Alwayly_OrderReminder插件的源码,可以去magento插件中心下载,这里我只通过一些代码介绍他的功能。Alwayly_OrderReminder插件的特点有:
以下是配置选项提供的屏幕截图,z在你的magento后台System -> Configuration -> Sales Emails -> Order Reminders里面
配置逻辑在本节中,我将介绍一些代码和在magento插件Alwayly_OrderReminder背后一些基本的逻辑 Inchoo_OrderReminder_Model_Observer::processOrderReminders()方法是通过cron daily来出发,通过配置选项来处理客户,下面是config.xml文件的代码段用于此目的:
<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>
触发后 下面是发送电子邮件的代码
/**
* 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.');
}
接下来你可以学习下,也可以直接安装这个magento插件来达到你想要的效果 (责任编辑:好模板) |



ecshop仿凡客免费模板带安
人气:5647
ecshop仿1mall网上超市整站免
人气:7963
ecshop商品详情自动生成商
人气:3114
京东商城360buy模板|ecshop京
人气:1358
ecshop银联插件接口
人气:3457
韩国SZ服装模板|ecshop服装
人气:670