Magegurubirthdaymail - Version 1.0.0

Version Notes

Birthday Mail n Coupon extension is designed to automatically wish your customers on their birthday.
It automatically detects store customers birthday and send a mail on their birthday
. Admin can schedule mail time and mail data and image from backend.
Your Customer Will also recieve coupon-code for discount which
is configured by admin from admin very easily.

Features:

1. Send Birthday Mail to Store customer on their Birthday automatically.
2. Use of Cron for sending emails automatically.
3. Coupon Code Send Option which is fully customizable from backend.
4. Customizable Image in email recieved by customer.
5. Set Cron time according to need.
6. Set Cron frequency.
7. Set Coupon discount type - Fixed or Percent.
8. Set Coupon Suffix and Pre-fix.
9. Set Coupon Expiry Date.

Download this release

Release Info

Developer BrainSINS
Extension Magegurubirthdaymail
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Mageguru/Couponmail/Block/Adminhtml/Emailcoupon.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class Mageguru_Couponmail_Block_Adminhtml_Emailcoupon extends Mage_Adminhtml_Block_Widget_Grid_Container{
5
+
6
+ public function __construct()
7
+ {
8
+
9
+ $this->_controller = "adminhtml_emailcoupon";
10
+ $this->_blockGroup = "couponmail";
11
+ $this->_headerText = Mage::helper("couponmail")->__("Emailcoupon Manager");
12
+ $this->_addButtonLabel = Mage::helper("couponmail")->__("Add New Item");
13
+ parent::__construct();
14
+ $this->_removeButton('add');
15
+ }
16
+
17
+ }
app/code/community/Mageguru/Couponmail/Block/Adminhtml/Emailcoupon/Grid.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Block_Adminhtml_Emailcoupon_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId("emailcouponGrid");
10
+ $this->setDefaultSort("id");
11
+ $this->setDefaultDir("DESC");
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel("couponmail/emailcoupon")->getCollection();
18
+ $this->setCollection($collection);
19
+ return parent::_prepareCollection();
20
+ }
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn("id", array(
24
+ "header" => Mage::helper("couponmail")->__("ID"),
25
+ "align" =>"right",
26
+ "width" => "50px",
27
+ "type" => "number",
28
+ "index" => "id",
29
+ ));
30
+
31
+ $this->addColumn("email", array(
32
+ "header" => Mage::helper("couponmail")->__("Email-Id"),
33
+ "index" => "email",
34
+ ));
35
+ $this->addColumn("customer_name", array(
36
+ "header" => Mage::helper("couponmail")->__("Customer Name"),
37
+ "index" => "customer_name",
38
+ ));
39
+ $this->addColumn("customer_discount", array(
40
+ "header" => Mage::helper("couponmail")->__("Generated Coupon"),
41
+ "index" => "customer_discount",
42
+ ));
43
+ $this->addColumn('send_on', array(
44
+ 'header' => Mage::helper('couponmail')->__('Email send on'),
45
+ 'index' => 'send_on',
46
+ 'type' => 'datetime',
47
+ ));
48
+ $this->addColumn('status', array(
49
+ 'header' => Mage::helper('couponmail')->__('Status'),
50
+ 'index' => 'status',
51
+ 'type' => 'options',
52
+ 'options'=>Mageguru_Couponmail_Block_Adminhtml_Emailcoupon_Grid::getOptionArray11(),
53
+ ));
54
+
55
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
56
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
57
+
58
+ return parent::_prepareColumns();
59
+ }
60
+
61
+ public function getRowUrl($row)
62
+ {
63
+ return '#';
64
+ }
65
+
66
+
67
+
68
+ protected function _prepareMassaction()
69
+ {
70
+ $this->setMassactionIdField('id');
71
+ $this->getMassactionBlock()->setFormFieldName('ids');
72
+ $this->getMassactionBlock()->setUseSelectAll(true);
73
+ $this->getMassactionBlock()->addItem('remove_emailcoupon', array(
74
+ 'label'=> Mage::helper('couponmail')->__('Remove Emailcoupon'),
75
+ 'url' => $this->getUrl('*/adminhtml_emailcoupon/massRemove'),
76
+ 'confirm' => Mage::helper('couponmail')->__('Are you sure?')
77
+ ));
78
+ return $this;
79
+ }
80
+
81
+ static public function getOptionArray11()
82
+ {
83
+ $data_array=array();
84
+ $data_array[1]='Not Sent';
85
+ $data_array[2]='Sent';
86
+ return($data_array);
87
+ }
88
+ static public function getValueArray11()
89
+ {
90
+ $data_array=array();
91
+ foreach(Mageguru_Couponmail_Block_Adminhtml_Emailcoupon_Grid::getOptionArray11() as $k=>$v){
92
+ $data_array[]=array('value'=>$k,'label'=>$v);
93
+ }
94
+ return($data_array);
95
+
96
+ }
97
+
98
+
99
+ }
app/code/community/Mageguru/Couponmail/Helper/Data.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Helper_Data extends Mage_Core_Helper_Abstract{
4
+
5
+ public function generate_custom_coupon($customerFirstName,$customerLastName,$custId){
6
+ $couponcode='';
7
+ $couponSuffix = Mage::getStoreConfig('birthday_coupon/discount_settings/discount_suffix');
8
+ $couponPrefix = Mage::getStoreConfig('birthday_coupon/discount_settings/discount_prefix');
9
+ $couponType = Mage::getStoreConfig('birthday_coupon/discount_settings/discount_type');
10
+ $couponExpiry = Mage::getStoreConfig('birthday_coupon/discount_settings/discount_expiry');
11
+ $couponDiscountAmount = Mage::getStoreConfig('birthday_coupon/discount_settings/applied_discount_amount');
12
+ $todayDate=date('m/d/Y');
13
+ $toDate=date('m/d/Y',strtotime($todayDate. '+'.$couponExpiry.' days'));
14
+
15
+ if($couponPrefix!=''){
16
+ $couponcode.=$couponPrefix.'-';
17
+ }
18
+ $couponcode.=Mage::helper('core')->getRandomString(4).'-';
19
+ $couponcode.=strtoupper($customerFirstName);
20
+ if($couponSuffix!=''){
21
+ $couponcode.='-'.$couponSuffix;
22
+ }
23
+ $couponcode=strtoupper($couponcode);
24
+ $this->generateRule($couponcode,$customerFirstName,$couponDiscountAmount,$todayDate,$toDate,'',0,strtolower($couponcode),$customerLastName,$custId,$couponType);
25
+ return $couponcode;
26
+ }
27
+
28
+ public function create_log_email_send($data=array()){
29
+ //Mage::log(print_r($data,true),null,'coupon-log.log');
30
+ $couponMailModel=Mage::getModel('couponmail/emailcoupon');
31
+ $couponMailModel->setData($data);
32
+ $couponMailModel->save();
33
+ }
34
+
35
+ public function generateRule($code,$customer_name,$disAmt,$fromDate,$toDate,$description,$sortOrder,$skuStr,$customerLastName,$customerId,$couponType){
36
+
37
+ $data = array(
38
+ 'product_ids' => null,
39
+ 'name' => 'AUTO_GENERATION CUSTOMER_'.$customerId.' - '.$disAmt.'% Summer discount',
40
+ 'description' => $description,
41
+ 'is_active' => 1,
42
+ 'website_ids' => array(1),
43
+ 'customer_group_ids' => array(1),
44
+ 'coupon_type' => 2,
45
+ 'coupon_code' => $code,
46
+ 'uses_per_coupon' => 1,
47
+ 'uses_per_customer' => 1,
48
+ 'from_date' => $fromDate,
49
+ 'to_date' => $toDate,
50
+ 'sort_order' => 0,
51
+ 'is_rss' => 1,
52
+ 'rule' => array(
53
+ 'conditions' => array(
54
+ array(
55
+ 'type' => 'salesrule/rule_condition_combine',
56
+ 'aggregator' => 'all',
57
+ 'value' => 1,
58
+ 'new_child' => null
59
+ )
60
+ )
61
+ ),
62
+ 'simple_action' => $couponType,
63
+ 'discount_amount' => $disAmt,
64
+ 'discount_qty' => 0,
65
+ 'discount_step' => null,
66
+ 'apply_to_shipping' => 0,
67
+ 'simple_free_shipping' => 0,
68
+ 'stop_rules_processing' => 0,
69
+ 'rule' => array(
70
+ 'actions' => array(
71
+ array(
72
+ 'type' => 'salesrule/rule_condition_product_combine',
73
+ 'aggregator' => 'all',
74
+ 'value' => 1,
75
+ 'new_child' => null
76
+ )
77
+ )
78
+ ),
79
+ 'store_labels' => array('Summer discount')
80
+ );
81
+
82
+
83
+ $model = Mage::getModel('salesrule/rule');
84
+ //$data = $this->_filterDates($data, array('from_date', 'to_date'));
85
+
86
+ $validateResult = $model->validateData(new Varien_Object($data));
87
+
88
+ if ($validateResult == true) {
89
+
90
+ //if (isset($data['simple_action']) && $data['simple_action'] == 'by_percent'
91
+ // && isset($data['discount_amount'])) {
92
+ // $data['discount_amount'] = min(100, $data['discount_amount']);
93
+ //}
94
+
95
+ if (isset($data['rule']['conditions'])) {
96
+ $data['conditions'] = $data['rule']['conditions'];
97
+ }
98
+
99
+ if (isset($data['rule']['actions'])) {
100
+ $data['actions'] = $data['rule']['actions'];
101
+ }
102
+
103
+ unset($data['rule']);
104
+
105
+ $model->loadPost($data);
106
+
107
+ $model->save();
108
+ }
109
+
110
+
111
+ }
112
+
113
+
114
+ }
app/code/community/Mageguru/Couponmail/Model/Adminhtml/System/Config/Backend/Couponmail/Cron.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Model_Adminhtml_System_Config_Backend_Couponmail_Cron extends Mage_Core_Model_Config_Data
4
+ {
5
+ const CRON_STRING_PATH = 'crontab/jobs/birthday_coupon_send/schedule/cron_expr';
6
+
7
+ protected function _afterSave()
8
+ {
9
+ $time = $this->getData('groups/birthday_mail/fields/time/value');
10
+
11
+ $frequencyDaily = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_DAILY;
12
+ $frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY;
13
+ $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY;
14
+
15
+ $cronDayOfWeek = date('N');
16
+
17
+ $cronExprArray = array(
18
+ intval($time[1]), # Minute
19
+ intval($time[0]), # Hour
20
+ (frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month
21
+ '*', # Month of the Year
22
+ (frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week
23
+ );
24
+
25
+ $cronExprString = join(' ', $cronExprArray);
26
+
27
+ try {
28
+ Mage::getModel('core/config_data')
29
+ ->load(self::CRON_STRING_PATH, 'path')
30
+ ->setValue($cronExprString)
31
+ ->setPath(self::CRON_STRING_PATH)
32
+ ->save();
33
+ }
34
+ catch (Exception $e) {
35
+ throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.'));
36
+
37
+ }
38
+ }
39
+ }
app/code/community/Mageguru/Couponmail/Model/Discount/Options.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Model_Discount_Options{
4
+
5
+ /**
6
+ * Options getter
7
+ *
8
+ * @return array
9
+ */
10
+ public function toOptionArray()
11
+ {
12
+ return array(
13
+ array('value' => 'by_percent', 'label'=>Mage::helper('adminhtml')->__('Fixed Discount on whole cart')),
14
+ array('value' => 'cart_fixed', 'label'=>Mage::helper('adminhtml')->__('Fixed Amount Discount for whole cart')),
15
+ );
16
+ }
17
+
18
+
19
+ }
20
+
21
+ ?>
app/code/community/Mageguru/Couponmail/Model/Emailcoupon.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Model_Emailcoupon extends Mage_Core_Model_Abstract
4
+ {
5
+ protected function _construct(){
6
+
7
+ $this->_init("couponmail/emailcoupon");
8
+
9
+ }
10
+
11
+ }
12
+
app/code/community/Mageguru/Couponmail/Model/Mysql4/Emailcoupon.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mageguru_Couponmail_Model_Mysql4_Emailcoupon extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init("couponmail/emailcoupon", "id");
7
+ }
8
+ }
app/code/community/Mageguru/Couponmail/Model/Mysql4/Emailcoupon/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mageguru_Couponmail_Model_Mysql4_Emailcoupon_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+
5
+ public function _construct(){
6
+ $this->_init("couponmail/emailcoupon");
7
+ }
8
+
9
+
10
+
11
+ }
12
+
app/code/community/Mageguru/Couponmail/Model/Observer.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mageguru_Couponmail_Model_Observer {
3
+
4
+
5
+ public function checkbirthday() {
6
+
7
+ $enable_email=Mage::getStoreConfig('birthday_coupon/birthday_mail/birthdaymail_enable');
8
+
9
+
10
+ if($enable_email){
11
+ $daymonthNow = date('d').'-'.date('m');
12
+
13
+
14
+ $collection = Mage::getModel("customer/customer")
15
+ ->getCollection()->addAttributeToSelect("*")
16
+ ->addFieldToFilter("dob",array('notnull' => false));
17
+
18
+ foreach ($collection as $customer)
19
+ {
20
+ $dob = explode(' ',$customer->getDob());
21
+ $date = explode('-',$dob[0]);
22
+ $daymonthBirthday = $date[2].'-'.$date[1];
23
+
24
+ if ( $daymonthBirthday == $daymonthNow ) {
25
+ $customerId=$customer->getId();
26
+ $customerFirstName = mb_convert_case($customer->getFirstname(), MB_CASE_TITLE, "UTF-8");
27
+ $customerLastName = mb_convert_case($customer->getLastname(), MB_CASE_TITLE, "UTF-8");
28
+ $customerEmail = $customer->getEmail();
29
+ $this->sendBirthdayEmail($customerEmail,$customerFirstName,$customerLastName,$customerId);
30
+
31
+ }
32
+ }
33
+
34
+ }else{
35
+ Mage::log('Email sending disabled',null,'info.log');
36
+ }
37
+
38
+ }
39
+
40
+ public function sendBirthdayEmail($customerEmail,$customerFirstName,$customerLastName,$customerId)
41
+ {
42
+ $enable_coupon=Mage::getStoreConfig('birthday_coupon/discount_settings/discount_enable');
43
+ $customerName=$customerFirstName.' '.$customerLastName;
44
+ if($enable_coupon){
45
+ $emailLogo=Mage::getStoreConfig('birthday_coupon/birthday_mail/image_logo');
46
+ $url=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product/watermark/'.$emailLogo;
47
+ $couponCode = Mage::helper('couponmail')->generate_custom_coupon($customerFirstName,$customerLastName,$customerId);
48
+ $emailTemplate = Mage::getModel('core/email_template');
49
+
50
+ $emailTemplate->loadDefault('couponmail_email_template');
51
+ $emailTemplate->setTemplateSubject('Happy Birthday');
52
+
53
+ $salesData['email'] = 'admin@siteowner.com' ; //Mage::getStoreConfig('trans_email/ident_general/email');
54
+ $salesData['name'] = 'Site Owner'; //Mage::getStoreConfig('trans_email/ident_general/name');
55
+
56
+ $emailTemplate->setSenderName($salesData['name']);
57
+ $emailTemplate->setSenderEmail($salesData['email']);
58
+
59
+ $emailTemplateVariables['username'] = $customerName;
60
+ $emailTemplateVariables['logo_url'] = $url;
61
+ $emailTemplateVariables['couponcode'] = $couponCode;
62
+ $emailTemplateVariables['store_name'] = Mage::app()->getStore()->getFrontendName();
63
+ $emailTemplateVariables['store_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
64
+ $status = $emailTemplate->send($customerEmail, 'test', $emailTemplateVariables);
65
+ $logData=array('email'=>$customerEmail,
66
+ 'customer_name'=>$customerName,
67
+ 'customer_id'=>$customerId,
68
+ 'send_on'=>date('Y-m-d H:i:s'),
69
+ 'customer_discount'=>$couponCode);
70
+ if($status){
71
+ $logData['status']=2;
72
+ }else{
73
+ $logData['status']=1;
74
+ }
75
+ Mage::helper('couponmail')->create_log_email_send($logData);
76
+ }
77
+
78
+ }
79
+
80
+
81
+ }
app/code/community/Mageguru/Couponmail/controllers/Adminhtml/EmailcouponController.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mageguru_Couponmail_Adminhtml_EmailcouponController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()->_setActiveMenu("couponmail/emailcoupon")->_addBreadcrumb(Mage::helper("adminhtml")->__("Emailcoupon Manager"),Mage::helper("adminhtml")->__("Emailcoupon Manager"));
8
+ return $this;
9
+ }
10
+ public function indexAction()
11
+ {
12
+ $this->_title($this->__("Couponmail"));
13
+ $this->_title($this->__("Manager Emailcoupon"));
14
+
15
+ $this->_initAction();
16
+ $this->renderLayout();
17
+ }
18
+ public function editAction()
19
+ {
20
+ $this->_title($this->__("Couponmail"));
21
+ $this->_title($this->__("Emailcoupon"));
22
+ $this->_title($this->__("Edit Item"));
23
+
24
+ $id = $this->getRequest()->getParam("id");
25
+ $model = Mage::getModel("couponmail/emailcoupon")->load($id);
26
+ if ($model->getId()) {
27
+ Mage::register("emailcoupon_data", $model);
28
+ $this->loadLayout();
29
+ $this->_setActiveMenu("couponmail/emailcoupon");
30
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Emailcoupon Manager"), Mage::helper("adminhtml")->__("Emailcoupon Manager"));
31
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Emailcoupon Description"), Mage::helper("adminhtml")->__("Emailcoupon Description"));
32
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
33
+ $this->_addContent($this->getLayout()->createBlock("couponmail/adminhtml_emailcoupon_edit"))->_addLeft($this->getLayout()->createBlock("couponmail/adminhtml_emailcoupon_edit_tabs"));
34
+ $this->renderLayout();
35
+ }
36
+ else {
37
+ Mage::getSingleton("adminhtml/session")->addError(Mage::helper("couponmail")->__("Item does not exist."));
38
+ $this->_redirect("*/*/");
39
+ }
40
+ }
41
+
42
+ public function newAction()
43
+ {
44
+
45
+ $this->_title($this->__("Couponmail"));
46
+ $this->_title($this->__("Emailcoupon"));
47
+ $this->_title($this->__("New Item"));
48
+
49
+ $id = $this->getRequest()->getParam("id");
50
+ $model = Mage::getModel("couponmail/emailcoupon")->load($id);
51
+
52
+ $data = Mage::getSingleton("adminhtml/session")->getFormData(true);
53
+ if (!empty($data)) {
54
+ $model->setData($data);
55
+ }
56
+
57
+ Mage::register("emailcoupon_data", $model);
58
+
59
+ $this->loadLayout();
60
+ $this->_setActiveMenu("couponmail/emailcoupon");
61
+
62
+ $this->getLayout()->getBlock("head")->setCanLoadExtJs(true);
63
+
64
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Emailcoupon Manager"), Mage::helper("adminhtml")->__("Emailcoupon Manager"));
65
+ $this->_addBreadcrumb(Mage::helper("adminhtml")->__("Emailcoupon Description"), Mage::helper("adminhtml")->__("Emailcoupon Description"));
66
+
67
+
68
+ $this->_addContent($this->getLayout()->createBlock("couponmail/adminhtml_emailcoupon_edit"))->_addLeft($this->getLayout()->createBlock("couponmail/adminhtml_emailcoupon_edit_tabs"));
69
+
70
+ $this->renderLayout();
71
+
72
+ }
73
+ public function saveAction()
74
+ {
75
+
76
+ $post_data=$this->getRequest()->getPost();
77
+
78
+
79
+ if ($post_data) {
80
+
81
+ try {
82
+
83
+
84
+
85
+ $model = Mage::getModel("couponmail/emailcoupon")
86
+ ->addData($post_data)
87
+ ->setId($this->getRequest()->getParam("id"))
88
+ ->save();
89
+
90
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Emailcoupon was successfully saved"));
91
+ Mage::getSingleton("adminhtml/session")->setEmailcouponData(false);
92
+
93
+ if ($this->getRequest()->getParam("back")) {
94
+ $this->_redirect("*/*/edit", array("id" => $model->getId()));
95
+ return;
96
+ }
97
+ $this->_redirect("*/*/");
98
+ return;
99
+ }
100
+ catch (Exception $e) {
101
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
102
+ Mage::getSingleton("adminhtml/session")->setEmailcouponData($this->getRequest()->getPost());
103
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
104
+ return;
105
+ }
106
+
107
+ }
108
+ $this->_redirect("*/*/");
109
+ }
110
+
111
+
112
+
113
+ public function deleteAction()
114
+ {
115
+ if( $this->getRequest()->getParam("id") > 0 ) {
116
+ try {
117
+ $model = Mage::getModel("couponmail/emailcoupon");
118
+ $model->setId($this->getRequest()->getParam("id"))->delete();
119
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item was successfully deleted"));
120
+ $this->_redirect("*/*/");
121
+ }
122
+ catch (Exception $e) {
123
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
124
+ $this->_redirect("*/*/edit", array("id" => $this->getRequest()->getParam("id")));
125
+ }
126
+ }
127
+ $this->_redirect("*/*/");
128
+ }
129
+
130
+
131
+ public function massRemoveAction()
132
+ {
133
+ try {
134
+ $ids = $this->getRequest()->getPost('ids', array());
135
+ foreach ($ids as $id) {
136
+ $model = Mage::getModel("couponmail/emailcoupon");
137
+ $model->setId($id)->delete();
138
+ }
139
+ Mage::getSingleton("adminhtml/session")->addSuccess(Mage::helper("adminhtml")->__("Item(s) was successfully removed"));
140
+ }
141
+ catch (Exception $e) {
142
+ Mage::getSingleton("adminhtml/session")->addError($e->getMessage());
143
+ }
144
+ $this->_redirect('*/*/');
145
+ }
146
+
147
+ /**
148
+ * Export order grid to CSV format
149
+ */
150
+ public function exportCsvAction()
151
+ {
152
+ $fileName = 'emailcoupon.csv';
153
+ $grid = $this->getLayout()->createBlock('couponmail/adminhtml_emailcoupon_grid');
154
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
155
+ }
156
+ /**
157
+ * Export order grid to Excel XML format
158
+ */
159
+ public function exportExcelAction()
160
+ {
161
+ $fileName = 'emailcoupon.xml';
162
+ $grid = $this->getLayout()->createBlock('couponmail/adminhtml_emailcoupon_grid');
163
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
164
+ }
165
+ }
app/code/community/Mageguru/Couponmail/etc/config.xml ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Mageguru_Couponmail>
4
+ <version>1.0.0</version>
5
+ </Mageguru_Couponmail>
6
+ </modules>
7
+ <global>
8
+ <models>
9
+ <couponmail>
10
+ <class>Mageguru_Couponmail_Model</class>
11
+ <resourceModel>couponmail_mysql4</resourceModel>
12
+ </couponmail>
13
+ <couponmail_mysql4>
14
+ <class>Mageguru_Couponmail_Model_Mysql4</class>
15
+ <entities>
16
+ <emailcoupon>
17
+ <table>mageguru_email_send_log</table>
18
+ </emailcoupon>
19
+ </entities>
20
+ </couponmail_mysql4>
21
+ </models>
22
+ <resources>
23
+ <couponmail_setup>
24
+ <setup>
25
+ <module>Mageguru_Couponmail</module>
26
+ </setup>
27
+ <connection>
28
+ <use>core_setup</use>
29
+ </connection>
30
+ </couponmail_setup>
31
+ <couponmail_write>
32
+ <connection>
33
+ <use>core_write</use>
34
+ </connection>
35
+ </couponmail_write>
36
+ <couponmail_read>
37
+ <connection>
38
+ <use>core_read</use>
39
+ </connection>
40
+ </couponmail_read>
41
+ </resources>
42
+ <helpers>
43
+ <couponmail>
44
+ <class>Mageguru_Couponmail_Helper</class>
45
+ </couponmail>
46
+ </helpers>
47
+ <blocks>
48
+ <couponmail>
49
+ <class>Mageguru_Couponmail_Block</class>
50
+ </couponmail>
51
+ </blocks>
52
+ <template>
53
+ <email>
54
+ <couponmail_email_template translate="label" module="couponmail">
55
+ <label>Customer Birthday Mail</label>
56
+ <file>customer_birthday.html</file>
57
+ <type>html</type>
58
+ </couponmail_email_template>
59
+ </email>
60
+ </template>
61
+ </global>
62
+ <admin>
63
+ <routers>
64
+ <couponmail>
65
+ <use>admin</use>
66
+ <args>
67
+ <module>Mageguru_Couponmail</module>
68
+ <frontName>admin_couponmail</frontName>
69
+ </args>
70
+ </couponmail>
71
+ </routers>
72
+ </admin>
73
+ <adminhtml>
74
+ <menu>
75
+ <couponmail module="couponmail">
76
+ <title>Couponmail</title>
77
+ <sort_order>100</sort_order>
78
+ <children>
79
+ <emailcoupon module="couponmail">
80
+ <title>Manage Emailcoupon</title>
81
+ <sort_order>10</sort_order>
82
+ <action>admin_couponmail/adminhtml_emailcoupon</action>
83
+ </emailcoupon>
84
+ </children>
85
+ </couponmail>
86
+ </menu>
87
+ <acl>
88
+ <resources>
89
+ <all>
90
+ <title>Allow Everything</title>
91
+ </all>
92
+ <admin>
93
+ <children>
94
+ <system>
95
+ <children>
96
+ <config>
97
+ <children>
98
+ <birthday_coupon translate="title" module="couponmail">
99
+ <title>Birthday Mail n Coupon Section</title>
100
+ <sort_order>12</sort_order>
101
+ </birthday_coupon>
102
+ </children>
103
+ </config>
104
+ </children>
105
+ </system>
106
+ <couponmail translate="title" module="couponmail">
107
+ <title>Couponmail</title>
108
+ <sort_order>1000</sort_order>
109
+ <children>
110
+ <emailcoupon translate="title">
111
+ <title>Manage Emailcoupon</title>
112
+ <sort_order>10</sort_order>
113
+ </emailcoupon>
114
+ </children>
115
+ </couponmail>
116
+ </children>
117
+ </admin>
118
+ </resources>
119
+ </acl>
120
+ <layout>
121
+ <updates>
122
+ <couponmail>
123
+ <file>couponmail.xml</file>
124
+ </couponmail>
125
+ </updates>
126
+ </layout>
127
+ </adminhtml>
128
+ <crontab>
129
+ <jobs>
130
+ <birthday_coupon_send>
131
+ <run><model>couponmail/observer::checkbirthday</model></run>
132
+ </birthday_coupon_send>
133
+ </jobs>
134
+ </crontab>
135
+ </config>
app/code/community/Mageguru/Couponmail/etc/system.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ss_extensions translate="label" module="couponmail">
5
+ <label>Mageguru Birthday mail</label>
6
+ <sort_order>21</sort_order>
7
+ </ss_extensions>
8
+ </tabs>
9
+ <sections>
10
+ <birthday_coupon translate="label" module="couponmail">
11
+ <label>Birthday Mail n Coupon</label>
12
+ <tab>ss_extensions</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>12</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <birthday_mail translate="label">
20
+ <label>Mail Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>34</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <birthdaymail_enable translate="label">
28
+ <label>Enable Birthday Mail</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
31
+ <sort_order>43</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Enable/Disable mail sending for birthday</comment>
36
+ </birthdaymail_enable>
37
+ <image_logo translate="label">
38
+ <label>Email Logo</label>
39
+ <frontend_type>image</frontend_type>
40
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
41
+ <upload_dir config="system/filesystem/media" scope_info="1">catalog/product/watermark</upload_dir>
42
+ <base_url type="media" scope_info="1">catalog/product/watermark</base_url>
43
+ <sort_order>188</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment>Email header image</comment>
48
+ </image_logo>
49
+ <email_sender translate="label">
50
+ <label>Select Email Sender</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
53
+ <sort_order>213</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </email_sender>
58
+ <time translate="label">
59
+ <label>Cron Start Time</label>
60
+ <frontend_type>time</frontend_type>
61
+ <sort_order>410</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>0</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </time>
66
+ <frequency translate="label">
67
+ <label>Cron Frequency</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_cron_frequency</source_model>
70
+ <backend_model>couponmail/adminhtml_system_config_backend_couponmail_cron</backend_model>
71
+ <sort_order>420</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </frequency>
76
+
77
+ </fields>
78
+ </birthday_mail>
79
+ <discount_settings translate="label">
80
+ <label>Coupon Settings</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>56</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <fields>
87
+ <discount_enable translate="label">
88
+ <label>Enable Coupon</label>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
91
+ <sort_order>56</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment>Enable/Disable coupon generation to send with email</comment>
96
+ </discount_enable>
97
+ <discount_prefix translate="label">
98
+ <label>Coupon Prefix</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>123</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <comment>Any starting text you want in your generated coupon</comment>
105
+ </discount_prefix>
106
+ <discount_suffix translate="label">
107
+ <label>Coupon Suffix</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>231</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <comment>Any end text you want in your generated coupon</comment>
114
+ </discount_suffix>
115
+ <discount_type translate="label">
116
+ <label>Coupon Discount Type</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>couponmail/discount_options</source_model>
119
+ <sort_order>241</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <comment>Discount type set on total amount</comment>
124
+ </discount_type>
125
+ <applied_discount_amount translate="label">
126
+ <label>Discount Amount</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>321</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <comment>Enter discount amount</comment>
133
+ </applied_discount_amount>
134
+ <discount_expiry translate="label">
135
+ <label>Coupon Valid for</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>332</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <comment>Enter no of days for expiry of coupon</comment>
142
+ </discount_expiry>
143
+ </fields>
144
+ </discount_settings>
145
+ </groups>
146
+ </birthday_coupon>
147
+ </sections>
148
+ </config>
app/code/community/Mageguru/Couponmail/etc/system.xml~ ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ss_extensions translate="label" module="couponmail">
5
+ <label>Mageguru Birthday mail</label>
6
+ <sort_order>21</sort_order>
7
+ </ss_extensions>
8
+ </tabs>
9
+ <sections>
10
+ <birthday_coupon translate="label" module="couponmail">
11
+ <label>Birthday Mail n Coupon</label>
12
+ <tab>ss_extensions</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>12</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <birthday_mail translate="label">
20
+ <label>Mail Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>34</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <birthdaymail_enable translate="label">
28
+ <label>Enable Birthday Mail</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
31
+ <sort_order>43</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Enable/Disable mail sending for birthday</comment>
36
+ </birthdaymail_enable>
37
+ <image_logo translate="label">
38
+ <label>Email Logo</label>
39
+ <frontend_type>image</frontend_type>
40
+ <backend_model>adminhtml/system_config_backend_image</backend_model>
41
+ <upload_dir config="system/filesystem/media" scope_info="1">catalog/product/watermark</upload_dir>
42
+ <base_url type="media" scope_info="1">catalog/product/watermark</base_url>
43
+ <sort_order>188</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <comment>Email header image</comment>
48
+ </image_logo>
49
+ <email_sender translate="label">
50
+ <label>Select Email Sender</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
53
+ <sort_order>213</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </email_sender>
58
+ <time translate="label">
59
+ <label>Cron Start Time</label>
60
+ <frontend_type>time</frontend_type>
61
+ <sort_order>410</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>0</show_in_website>
64
+ <show_in_store>0</show_in_store>
65
+ </time>
66
+ <frequency translate="label">
67
+ <label>Cron Frequency</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>adminhtml/system_config_source_cron_frequency</source_model>
70
+ <backend_model>couponmail/adminhtml_system_config_backend_couponmail_cron</backend_model>
71
+ <sort_order>420</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>0</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </frequency>
76
+
77
+ </fields>
78
+ </birthday_mail>
79
+ <discount_settings translate="label">
80
+ <label>Coupon Settings</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>56</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ <fields>
87
+ <discount_enable translate="label">
88
+ <label>Enable Coupon</label>
89
+ <frontend_type>select</frontend_type>
90
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
91
+ <sort_order>56</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <comment>Enable/Disable coupon generation to send with email</comment>
96
+ </discount_enable>
97
+ <discount_prefix translate="label">
98
+ <label>Coupon Prefix</label>
99
+ <frontend_type>text</frontend_type>
100
+ <sort_order>123</sort_order>
101
+ <show_in_default>1</show_in_default>
102
+ <show_in_website>1</show_in_website>
103
+ <show_in_store>1</show_in_store>
104
+ <comment>Any starting text you want in your generated coupon</comment>
105
+ </discount_prefix>
106
+ <discount_suffix translate="label">
107
+ <label>Coupon Suffix</label>
108
+ <frontend_type>text</frontend_type>
109
+ <sort_order>231</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <comment>Any end text you want in your generated coupon</comment>
114
+ </discount_suffix>
115
+ <discount_type translate="label">
116
+ <label>Coupon Discount Type</label>
117
+ <frontend_type>select</frontend_type>
118
+ <source_model>couponmail/discount_options</source_model>
119
+ <sort_order>241</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <comment>Discount type set on total amount</comment>
124
+ </discount_type>
125
+ <applied_discount_amount translate="label">
126
+ <label>Discount Amount</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>321</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <comment>Enter discount amount</comment>
133
+ </applied_discount_amount>
134
+ <discount_expiry translate="label">
135
+ <label>Coupon Valid for</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>332</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <comment>Enter no of days for expiry of coupon</comment>
142
+ </discount_expiry>
143
+ </fields>
144
+ </discount_settings>
145
+ </groups>
146
+ </birthday_coupon>
147
+ </sections>
148
+ </config>
app/code/community/Mageguru/Couponmail/sql/couponmail_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $sql=<<<SQLTEXT
5
+ CREATE TABLE IF NOT EXISTS `mageguru_email_send_log` (
6
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
7
+ `email` varchar(255) NOT NULL,
8
+ `customer_name` varchar(255) NOT NULL,
9
+ `customer_id` int(11) NOT NULL,
10
+ `customer_discount` text NOT NULL,
11
+ `send_on` datetime NOT NULL,
12
+ `status` tinyint(2) NOT NULL COMMENT '1=>Not Send 2=>Send',
13
+ PRIMARY KEY (`id`),
14
+ KEY `id` (`id`)
15
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
16
+
17
+ SQLTEXT;
18
+
19
+ $installer->run($sql);
20
+
21
+ $installer->endSetup();
22
+
app/design/adminhtml/default/default/layout/couponmail.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <couponmail_adminhtml_emailcoupon_index>
4
+ <reference name="content">
5
+ <block type="couponmail/adminhtml_emailcoupon" name="emailcoupon" />
6
+ </reference>
7
+ </couponmail_adminhtml_emailcoupon_index>
8
+ </layout>
app/etc/modules/Mageguru_Couponmail.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Mageguru_Couponmail>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>1.0.0</version>
8
+ </Mageguru_Couponmail>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>BirthdayMailnCoupon</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Birthday Mail n Coupon extension is designed to automatically wish your customers on their birthday.</summary>
10
+ <description>Birthday Mail n Coupon extension is designed to automatically wish your customers on their birthday.&#xD;
11
+ It automatically detects store customers birthday and send a mail on their birthday&#xD;
12
+ . Admin can schedule mail time and mail data and image from back-end.&#xD;
13
+ Your Customer Will also receive coupon-code for discount which&#xD;
14
+ is configured by admin from admin very easily.</description>
15
+ <notes>Birthday Mail n Coupon extension is designed to automatically wish your customers on their birthday.&#xD;
16
+ It automatically detects store customers birthday and send a mail on their birthday&#xD;
17
+ . Admin can schedule mail time and mail data and image from backend.&#xD;
18
+ Your Customer Will also recieve coupon-code for discount which&#xD;
19
+ is configured by admin from admin very easily.&#xD;
20
+ &#xD;
21
+ &#xD;
22
+ Features:&#xD;
23
+ &#xD;
24
+ 1. Send Birthday Mail to Store customer on their Birthday automatically.&#xD;
25
+ 2. Use of Cron for sending emails automatically.&#xD;
26
+ 3. Coupon Code Send Option which is fully customizable from backend.&#xD;
27
+ 4. Customizable Image in email recieved by customer.&#xD;
28
+ 5. Set Cron time according to need.&#xD;
29
+ 6. Set Cron frequency.&#xD;
30
+ 7. Set Coupon discount type - Fixed or Percent.&#xD;
31
+ 8. Set Coupon Suffix and Pre-fix.&#xD;
32
+ 9. Set Coupon Expiry Date.</notes>
33
+ <authors><author><name>developer</name><user>developer</user><email>mageguruindia@gmail.com</email></author></authors>
34
+ <date>2016-01-15</date>
35
+ <time>16:19:17</time>
36
+ <contents><target name="mageetc"><dir name="modules"><file name="Mageguru_Couponmail.xml" hash="73ca23674ca4e96f627093ad109b798e"/></dir></target><target name="magecommunity"><dir name="Mageguru"><dir name="Couponmail"><dir name="Block"><dir name="Adminhtml"><dir name="Emailcoupon"><file name="Grid.php" hash="7e0700dc50111ca9b279bb1b82ed8037"/></dir><file name="Emailcoupon.php" hash="d01bafc13bf5e0ce02a37db43e0887f6"/></dir></dir><dir name="Helper"><file name="Data.php" hash="867864d3fdd58f9966d399335edeb792"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Couponmail"><file name="Cron.php" hash="3e645f71bd46fedc799160c36d546479"/></dir></dir></dir></dir></dir><dir name="Discount"><file name="Options.php" hash="13906c30ffd2ae35a23edab6c981cbea"/></dir><file name="Emailcoupon.php" hash="91ad329358dc2aedfdab32cdcdee48b6"/><dir name="Mysql4"><dir name="Emailcoupon"><file name="Collection.php" hash="1976f82b9066462ac61b720e45e3c1b2"/></dir><file name="Emailcoupon.php" hash="d9cb3b78e6ce5f82e38326b3e0e8da7a"/></dir><file name="Observer.php" hash="c61cc64eb8b1e6f00ae4931d20579ffe"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="EmailcouponController.php" hash="b82f8593ee989545e093217ca2ad10c3"/></dir></dir><dir name="etc"><file name="config.xml" hash="ed4660cd11b881a1e0e1c2cd8656c872"/><file name="system.xml" hash="66002ec1ae556a12b03ab5552906c2c2"/><file name="system.xml~" hash="66002ec1ae556a12b03ab5552906c2c2"/></dir><dir name="sql"><dir name="couponmail_setup"><file name="mysql4-install-1.0.0.php" hash="753ea1275c0eaa2aff0c0f699d42b798"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="couponmail.xml" hash="afd60dac2116fb856ccbd8842ff72e36"/></dir></dir></dir></dir></target><target name="magelocal"><dir name="en_US"><dir name="template"><dir name="email"><file name="customer_birthday.html" hash=""/></dir></dir></dir></target></contents>
37
+ <compatible/>
38
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
39
+ </package>