Version Notes
Sends birthday mails to customers.
Download this release
Release Info
Developer | vp |
Extension | Vp_Customerbirthdaymail |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Vp/Customerbirthdaymail/Helper/Data.php +5 -0
- app/code/local/Vp/Customerbirthdaymail/Model/Observer.php +49 -0
- app/code/local/Vp/Customerbirthdaymail/etc/config.xml +37 -0
- app/etc/modules/Vp_Customerbirthdaymail.xml +9 -0
- app/locale/en_US/template/email/birthdaymail_email.html +33 -0
- package.xml +19 -0
app/code/local/Vp/Customerbirthdaymail/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
Class Vp_Customerbirthdaymail_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Vp/Customerbirthdaymail/Model/Observer.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Vp_Customerbirthdaymail_Model_Observer {
|
3 |
+
|
4 |
+
public function checkbirthday() {
|
5 |
+
|
6 |
+
$daymonthNow = date('d').'-'.date('m');
|
7 |
+
|
8 |
+
$collection = Mage::getModel("customer/customer")
|
9 |
+
->getCollection()->addAttributeToSelect("*")
|
10 |
+
->addFieldToFilter("dob",array('notnull' => false));
|
11 |
+
|
12 |
+
foreach ($collection as $customer)
|
13 |
+
{
|
14 |
+
$dob = explode(' ',$customer->getDob());
|
15 |
+
$date = explode('-',$dob[0]);
|
16 |
+
$daymonthBirthday = $date[2].'-'.$date[1];
|
17 |
+
|
18 |
+
if ( $daymonthBirthday == $daymonthNow ) {
|
19 |
+
|
20 |
+
$customerName = mb_convert_case($customer->getFirstname(), MB_CASE_TITLE, "UTF-8");
|
21 |
+
$customerEmail = $customer->getEmail();
|
22 |
+
$this->sendBirthdayEmail($customerEmail,$customerName);
|
23 |
+
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
public function sendBirthdayEmail($customerEmail,$customerName)
|
30 |
+
{
|
31 |
+
|
32 |
+
$emailTemplate = Mage::getModel('core/email_template');
|
33 |
+
|
34 |
+
$emailTemplate->loadDefault('customerbirthdaymail_email_template');
|
35 |
+
$emailTemplate->setTemplateSubject('Happy Birthday');
|
36 |
+
|
37 |
+
$salesData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
|
38 |
+
$salesData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');
|
39 |
+
|
40 |
+
$emailTemplate->setSenderName($salesData['name']);
|
41 |
+
$emailTemplate->setSenderEmail($salesData['email']);
|
42 |
+
|
43 |
+
$emailTemplateVariables['username'] = $customerName;
|
44 |
+
$emailTemplateVariables['store_name'] = Mage::app()->getStore()->getFrontendName();
|
45 |
+
$emailTemplateVariables['store_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
46 |
+
$emailTemplate->send($customerEmail, 'test', $emailTemplateVariables);
|
47 |
+
|
48 |
+
}
|
49 |
+
}
|
app/code/local/Vp/Customerbirthdaymail/etc/config.xml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Vp_Customerbirthdaymail>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</Vp_Customerbirthdaymail>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<customerbirthdaymail>
|
11 |
+
<class>Vp_Customerbirthdaymail_Model</class>
|
12 |
+
</customerbirthdaymail>
|
13 |
+
</models>
|
14 |
+
<helpers>
|
15 |
+
<customerbirthdaymail>
|
16 |
+
<class>Vp_Customerbirthdaymail_Helper</class>
|
17 |
+
</customerbirthdaymail>
|
18 |
+
</helpers>
|
19 |
+
<template>
|
20 |
+
<email>
|
21 |
+
<customerbirthdaymail_email_template translate="label" module="customerbirthdaymail">
|
22 |
+
<label>Customer Birthday Mail</label>
|
23 |
+
<file>birthdaymail_email.html</file>
|
24 |
+
<type>html</type>
|
25 |
+
</customerbirthdaymail_email_template>
|
26 |
+
</email>
|
27 |
+
</template>
|
28 |
+
</global>
|
29 |
+
<crontab>
|
30 |
+
<jobs>
|
31 |
+
<customerbirthdaymail>
|
32 |
+
<schedule><cron_expr>2 0 * * *</cron_expr></schedule>
|
33 |
+
<run><model>customerbirthdaymail/observer::checkbirthday</model></run>
|
34 |
+
</customerbirthdaymail>
|
35 |
+
</jobs>
|
36 |
+
</crontab>
|
37 |
+
</config>
|
app/etc/modules/Vp_Customerbirthdaymail.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Vp_Customerbirthdaymail>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Vp_Customerbirthdaymail>
|
8 |
+
</modules>
|
9 |
+
</config>
|
app/locale/en_US/template/email/birthdaymail_email.html
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject Customer Birthday Email Template@-->
|
2 |
+
<body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
3 |
+
<div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
|
4 |
+
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
5 |
+
<tr>
|
6 |
+
<td align="center" valign="top" style="padding:20px 0 20px 0">
|
7 |
+
<!-- [ header starts here] -->
|
8 |
+
<table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
|
9 |
+
<tr>
|
10 |
+
<td valign="top">
|
11 |
+
<a href="{{var store_url}}" style="color:#1E7EC8;"><img src="{{skin url="images/logo_email.gif" _area='frontend'}}" border="0"/></a>
|
12 |
+
</td>
|
13 |
+
</tr>
|
14 |
+
<!-- [ middle starts here] -->
|
15 |
+
<tr>
|
16 |
+
<td valign="top">
|
17 |
+
<h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;">Dear {{var username}},</h1>
|
18 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
19 |
+
On behalf of all our team, we would like to wish you a happy upcoming birthday!
|
20 |
+
<p>
|
21 |
+
<p style="font-size:12px; line-height:16px; margin:0;">
|
22 |
+
Team Store <strong>{{var store_name}}</strong>.<p>
|
23 |
+
</td>
|
24 |
+
</tr>
|
25 |
+
<tr>
|
26 |
+
<td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you, <a href="{{var store_url}}"><strong>{{var store_name}}</strong></a></p></center></td>
|
27 |
+
</tr>
|
28 |
+
</table>
|
29 |
+
</td>
|
30 |
+
</tr>
|
31 |
+
</table>
|
32 |
+
</div>
|
33 |
+
</body>
|
package.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Vp_Customerbirthdaymail</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension send birthday mails to customers</summary>
|
10 |
+
<description>This extension send birthday mails to customers
|
11 |
+
at 12.02 am using cron.</description>
|
12 |
+
<notes>Sends birthday mails to customers.</notes>
|
13 |
+
<authors><author><name>vp</name><user>vpinfo</user><email>vpinfo39@gmail.com</email></author></authors>
|
14 |
+
<date>2014-07-12</date>
|
15 |
+
<time>04:52:07</time>
|
16 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Vp_Customerbirthdaymail.xml" hash="2a78dd4618175aa888d30464e6beec20"/></dir></target><target name="magelocal"><dir name="Vp"><dir name="Customerbirthdaymail"><dir name="Helper"><file name="Data.php" hash="e49f81d5316e10c31bdaffaac2d0b9c6"/></dir><dir name="Model"><file name="Observer.php" hash="09737188e03ab30c53a4f6db7944eb23"/></dir><dir name="etc"><file name="config.xml" hash="dbc5f02dbb1346951fcb218e94df452d"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="birthdaymail_email.html" hash="e864cfdf77e1f4b3ac2723177e2753b7"/></dir></dir></dir></target></contents>
|
17 |
+
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
+
</package>
|