Adfab_Emailcampaign - Version 1.3.0

Version Notes

Stories



  • [ECAMPAIGN-20] - Campaign satisfaction implemented

  • [ECAMPAIGN-23] - Campaign Offer after order implemented, ability to use discount coupons

  • [ECAMPAIGN-49] - Mail preview when creating a campaign

  • [ECAMPAIGN-52] - Adding a date filter for the Wishlist Stock Alert campaign

Download this release

Release Info

Developer Adfab
Extension Adfab_Emailcampaign
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.1 to 1.3.0

Files changed (28) hide show
  1. app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Edit/Form.php +1 -2
  2. app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Edit/Tabs.php +2 -2
  3. app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/Abstract.php +12 -2
  4. app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/Coupons.php +181 -0
  5. app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/OfferAfterOrder.php +76 -0
  6. app/code/community/Adfab/Emailcampaign/Helper/Coupon.php +112 -0
  7. app/code/community/Adfab/Emailcampaign/Model/Campaign.php +0 -6
  8. app/code/community/Adfab/Emailcampaign/Model/Campaign/Abstract.php +14 -0
  9. app/code/community/Adfab/Emailcampaign/Model/Campaign/OfferAfterOrder.php +84 -0
  10. app/code/community/Adfab/Emailcampaign/Model/Cron/Observer.php +8 -4
  11. app/code/community/Adfab/Emailcampaign/Model/Mailing.php +63 -0
  12. app/code/community/Adfab/Emailcampaign/Model/Mailing/Recipient.php +46 -0
  13. app/code/community/Adfab/Emailcampaign/Model/Observer.php +31 -2
  14. app/code/community/Adfab/Emailcampaign/Model/Resource/Campaign.php +0 -20
  15. app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing.php +94 -0
  16. app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Collection.php +46 -0
  17. app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Recipient.php +107 -0
  18. app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Recipient/Collection.php +46 -0
  19. app/code/community/Adfab/Emailcampaign/Model/Source/SalesRule/Rule.php +68 -0
  20. app/code/community/Adfab/Emailcampaign/controllers/Adminhtml/CampaignController.php +38 -30
  21. app/code/community/Adfab/Emailcampaign/etc/config.xml +43 -1
  22. app/code/community/Adfab/Emailcampaign/sql/adfab_emailcampaign_setup/mysql4-upgrade-0.1.2-0.1.3.php +4 -4
  23. app/code/community/Adfab/Emailcampaign/sql/adfab_emailcampaign_setup/mysql4-upgrade-1.2.1-1.2.2.php +114 -0
  24. app/locale/en_US/template/email/emailcampaign/offer_after_order.html +43 -0
  25. app/locale/fr_FR/emailcampaign/Adfab_Emailcampaign.csv +8 -1
  26. app/locale/fr_FR/emailcampaign/Adfab_Emailcampaign_OfferAfterOrder.csv +4 -0
  27. app/locale/fr_FR/template/email/emailcampaign/offer_after_order.html +43 -0
  28. package.xml +10 -6
app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Edit/Form.php CHANGED
@@ -44,8 +44,7 @@ class Adfab_Emailcampaign_Block_Adminhtml_Campaign_Edit_Form extends Mage_Adminh
44
  'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
45
  'method' => 'post',
46
  'enctype' => 'multipart/form-data'
47
- )
48
- );
49
 
50
  $form->setUseContainer(true);
51
  $this->setForm($form);
44
  'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
45
  'method' => 'post',
46
  'enctype' => 'multipart/form-data'
47
+ ));
 
48
 
49
  $form->setUseContainer(true);
50
  $this->setForm($form);
app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Edit/Tabs.php CHANGED
@@ -59,8 +59,8 @@ class Adfab_Emailcampaign_Block_Adminhtml_Campaign_Edit_Tabs extends Mage_Adminh
59
  $i = 1;
60
  foreach ($forms->children() as $form) {
61
  $this->addTab('form_section_'.$i++, array(
62
- 'label' => isset($form->label) ? (string)$form->label : Mage::helper('adfab_emailcampaign')->__('Campaign Variables'),
63
- 'title' => isset($form->label) ? (string)$form->label : Mage::helper('adfab_emailcampaign')->__('Campaign Variables'),
64
  'content' => $this->getLayout()->createBlock((string)$form->class)->toHtml(),
65
  ));
66
  }
59
  $i = 1;
60
  foreach ($forms->children() as $form) {
61
  $this->addTab('form_section_'.$i++, array(
62
+ 'label' => isset($form->label) ? Mage::helper('adfab_emailcampaign')->__((string)$form->label) : Mage::helper('adfab_emailcampaign')->__('Campaign Variables'),
63
+ 'title' => isset($form->label) ? Mage::helper('adfab_emailcampaign')->__((string)$form->label) : Mage::helper('adfab_emailcampaign')->__('Campaign Variables'),
64
  'content' => $this->getLayout()->createBlock((string)$form->class)->toHtml(),
65
  ));
66
  }
app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/Abstract.php CHANGED
@@ -41,12 +41,22 @@ abstract class Adfab_Emailcampaign_Block_Adminhtml_Campaign_Forms_Abstract exten
41
  * @param array $variables
42
  * @return array
43
  */
44
- protected function _transform($variables)
45
  {
46
  $defaults = array();
47
  if (!$variables) return $defaults;
48
  foreach ($variables as $k => $v) {
49
- $defaults['variables_' . $k . ''] = $v;
 
 
 
 
 
 
 
 
 
 
50
  }
51
  return $defaults;
52
  }
41
  * @param array $variables
42
  * @return array
43
  */
44
+ protected function _transform($variables, $prefix = '')
45
  {
46
  $defaults = array();
47
  if (!$variables) return $defaults;
48
  foreach ($variables as $k => $v) {
49
+ $key = $prefix ?
50
+ $prefix . '_' . $k :
51
+ $k;
52
+ if (is_array($v)) {
53
+ $defaults = array_merge(
54
+ $this->_transform($v, $key),
55
+ $defaults
56
+ );
57
+ } else {
58
+ $defaults['variables_' . $key] = $v;
59
+ }
60
  }
61
  return $defaults;
62
  }
app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/Coupons.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Coupons generation parameters form
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Adfab_Emailcampaign_Block_Adminhtml_Campaign_Forms_Coupons
35
+ extends Adfab_Emailcampaign_Block_Adminhtml_Campaign_Forms_Abstract
36
+ {
37
+ /**
38
+ * Prepare coupon codes generation parameters form
39
+ *
40
+ * @return Mage_Adminhtml_Block_Widget_Form
41
+ */
42
+ protected function _prepareForm()
43
+ {
44
+ $form = new Varien_Data_Form();
45
+
46
+ /**
47
+ * @var Mage_SalesRule_Helper_Coupon $couponHelper
48
+ */
49
+ $couponHelper = Mage::helper('salesrule/coupon');
50
+
51
+ $form->setHtmlIdPrefix('emailcampaign_vars_');
52
+
53
+ $fieldset = $form->addFieldset('information_fieldset', array('legend'=>Mage::helper('salesrule')->__('Coupons Information')));
54
+ $fieldset->addClass('ignore-validate');
55
+
56
+ $useRule = $fieldset->addField('variables_coupon_use_rule', 'select', array(
57
+ 'label' => Mage::helper('salesrule')->__('Use Price Rule'),
58
+ 'title' => Mage::helper('salesrule')->__('Use Price Rule'),
59
+ 'name' => 'variables[coupon][use_rule]',
60
+ 'required' => true,
61
+ 'values' => array(
62
+ array(
63
+ 'value' => 0,
64
+ 'label' => Mage::helper('adminhtml')->__('No'),
65
+ ),
66
+ array(
67
+ 'value' => 1,
68
+ 'label' => Mage::helper('adminhtml')->__('Yes'),
69
+ ),
70
+ ),
71
+ ));
72
+
73
+ $fieldset->addField('variables_coupon_usage', 'note', array(
74
+ 'text' => Mage::helper('adfab_emailcampaign')->__('You can create a rule exclusively for this campaign <br /> Be careful: when one coupon is generated for a customer, only this one can use it, even if the rule is disabled. <br/> You can use the fields below to customize each generated coupon if the selected rule use auto generation')
75
+ ));
76
+
77
+ $ruleId = $fieldset->addField('variables_coupon_rule_id', 'select', array(
78
+ 'label' => Mage::helper('adfab_emailcampaign')->__('Rule ID'),
79
+ 'name' => 'variables[coupon][rule_id]',
80
+ 'values' => Mage::getSingleton('adfab_emailcampaign/source_salesRule_rule')->toFormOptionArray(),
81
+ 'required' => true,
82
+ 'note' => Mage::helper('adfab_emailcampaign')->__('the rule to use to determine the coupon code')
83
+ ));
84
+
85
+ $length = $fieldset->addField('variables_coupon_length', 'text', array(
86
+ 'name' => 'variables[coupon][length]',
87
+ 'label' => Mage::helper('salesrule')->__('Code Length'),
88
+ 'title' => Mage::helper('salesrule')->__('Code Length'),
89
+ 'required' => true,
90
+ 'note' => Mage::helper('salesrule')->__('Excluding prefix, suffix and separators.'),
91
+ 'value' => $couponHelper->getDefaultLength(),
92
+ 'class' => 'validate-digits validate-greater-than-zero'
93
+ ));
94
+
95
+ $format = $fieldset->addField('variables_coupon_format', 'select', array(
96
+ 'label' => Mage::helper('salesrule')->__('Code Format'),
97
+ 'name' => 'variables[coupon][format]',
98
+ 'options' => $couponHelper->getFormatsList(),
99
+ 'required' => true,
100
+ 'value' => $couponHelper->getDefaultFormat()
101
+ ));
102
+
103
+ $prefix = $fieldset->addField('variables_coupon_prefix', 'text', array(
104
+ 'name' => 'variables[coupon][prefix]',
105
+ 'label' => Mage::helper('salesrule')->__('Code Prefix'),
106
+ 'title' => Mage::helper('salesrule')->__('Code Prefix'),
107
+ 'value' => $couponHelper->getDefaultPrefix()
108
+ ));
109
+
110
+ $suffix = $fieldset->addField('variables_coupon_suffix', 'text', array(
111
+ 'name' => 'variables[coupon][suffix]',
112
+ 'label' => Mage::helper('salesrule')->__('Code Suffix'),
113
+ 'title' => Mage::helper('salesrule')->__('Code Suffix'),
114
+ 'value' => $couponHelper->getDefaultSuffix()
115
+ ));
116
+
117
+ $dash = $fieldset->addField('variables_coupon_dash', 'text', array(
118
+ 'name' => 'variables[coupon][dash]',
119
+ 'label' => Mage::helper('salesrule')->__('Dash Every X Characters'),
120
+ 'title' => Mage::helper('salesrule')->__('Dash Every X Characters'),
121
+ 'note' => Mage::helper('salesrule')->__('If empty no separation.'),
122
+ 'value' => $couponHelper->getDefaultDashInterval(),
123
+ 'class' => 'validate-digits'
124
+ ));
125
+
126
+ $this->setForm($form);
127
+
128
+ $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
129
+ ->addFieldMap($useRule->getHtmlId(), $useRule->getName())
130
+ ->addFieldMap($ruleId->getHtmlId(), $ruleId->getName())
131
+ ->addFieldMap($length->getHtmlId(), $length->getName())
132
+ ->addFieldMap($format->getHtmlId(), $format->getName())
133
+ ->addFieldMap($prefix->getHtmlId(), $prefix->getName())
134
+ ->addFieldMap($suffix->getHtmlId(), $suffix->getName())
135
+ ->addFieldMap($dash->getHtmlId(), $dash->getName())
136
+ ->addFieldDependence(
137
+ $ruleId->getName(),
138
+ $useRule->getName(),
139
+ 1
140
+ )->addFieldDependence(
141
+ $length->getName(),
142
+ $useRule->getName(),
143
+ 1
144
+ )->addFieldDependence(
145
+ $format->getName(),
146
+ $useRule->getName(),
147
+ 1
148
+ )->addFieldDependence(
149
+ $prefix->getName(),
150
+ $useRule->getName(),
151
+ 1
152
+ )->addFieldDependence(
153
+ $suffix->getName(),
154
+ $useRule->getName(),
155
+ 1
156
+ )->addFieldDependence(
157
+ $dash->getName(),
158
+ $useRule->getName(),
159
+ 1
160
+ )
161
+ );
162
+
163
+ Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_coupons_form_prepare_form', array('form' => $form));
164
+
165
+ if ($campaign = Mage::registry('emailcampaign_data')) {
166
+ $form->setValues($this->_transform($campaign->getVariable()));
167
+ }
168
+
169
+ return parent::_prepareForm();
170
+ }
171
+
172
+ /**
173
+ * Retrieve URL to Generate Action
174
+ *
175
+ * @return string
176
+ */
177
+ public function getGenerateUrl()
178
+ {
179
+ return $this->getUrl('*/*/generate');
180
+ }
181
+ }
app/code/community/Adfab/Emailcampaign/Block/Adminhtml/Campaign/Forms/OfferAfterOrder.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Block
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Block_Adminhtml_Campaign_Forms_OfferAfterOrder extends Adfab_Emailcampaign_Block_Adminhtml_Campaign_Forms_Abstract
38
+ {
39
+
40
+ protected function _prepareForm()
41
+ {
42
+ $form = new Varien_Data_Form();
43
+ $this->setForm($form);
44
+ $form->setHtmlIdPrefix('emailcampaign_vars_');
45
+ $fieldset = $form->addFieldset('emailcampaign_target_form', array('legend'=>Mage::helper('adfab_emailcampaign')->__('Campaign Variables')));
46
+
47
+ $fieldset->addField('variables_send_after', 'text', array(
48
+ 'label' => Mage::helper('adfab_emailcampaign')->__('Send after how many days ?'),
49
+ 'class' => 'required-entry validate-number',
50
+ 'required' => true,
51
+ 'name' => 'variables[send_after]'
52
+ ));
53
+
54
+ // $fieldset->addField('variables_rule_id', 'text', array(
55
+ // 'label' => Mage::helper('adfab_emailcampaign')->__('Rule ID'),
56
+ // 'class' => 'required-entry validate-number',
57
+ // 'required' => true,
58
+ // 'name' => 'variables[rule_id]',
59
+ // 'note' => Mage::helper('adfab_emailcampaign')->__('the rule to use to determine the coupon code')
60
+ // ));
61
+
62
+ $fieldset->addField('variables_rule_id', 'select', array(
63
+ 'label' => Mage::helper('adfab_emailcampaign')->__('Rule ID'),
64
+ 'name' => 'variables[rule_id]',
65
+ 'values' => Mage::getSingleton('adfab_emailcampaign/source_salesRule_rule')->toFormOptionArray(),
66
+ 'required' => true,
67
+ 'note' => Mage::helper('adfab_emailcampaign')->__('the rule to use to determine the coupon code')
68
+ ));
69
+
70
+ if ($campaign = Mage::registry('emailcampaign_data')) {
71
+ $form->setValues($this->_transform($campaign->getVariable()));
72
+ }
73
+ return parent::_prepareForm();
74
+ }
75
+
76
+ }
app/code/community/Adfab/Emailcampaign/Helper/Coupon.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Helper
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Helper_Coupon extends Mage_Core_Helper_Data
38
+ {
39
+
40
+ /**
41
+ * generate
42
+ * @param Mage_SalesRule_Model_Rule|int $rule
43
+ * @param Mage_Customer_Model_Resource_Customer_Collection $customers
44
+ * @param array $config
45
+ * @return Adfab_Emailcampaign_Helper_Coupon
46
+ */
47
+ public function generateCouponForCustomers($rule, $customers, $config = null)
48
+ {
49
+ if (is_numeric($rule)) {
50
+ $rule = Mage::getModel('salesrule/rule')->load($rule);
51
+ }
52
+ if (!$rule || !$rule->getId()) {
53
+ return $this;
54
+ }
55
+ if (!$rule->getUseAutoGeneration()) {
56
+ $code = $rule->getCouponCode();
57
+ foreach ($customers as $customer) {
58
+ // store this will save the coupon in mailing_recipient table
59
+ $customer->setCampaignCouponCode($code);
60
+ }
61
+ } else {
62
+ // we have to generate 1 coupon for each customer
63
+ $generator = Mage::getModel('salesrule/coupon_massgenerator');
64
+ if (!$config) {
65
+ $config = array();
66
+ }
67
+ $data = array(
68
+ 'max_probability' => .25,
69
+ 'max_attempts' => 10,
70
+ 'uses_per_customer' => $rule->getUsesPerCustomer(),
71
+ 'uses_per_coupon' => 1, // 1 per coupon but one customer can use several coupon in the same rule according to $rule->getUsesPerCustomer()
72
+ 'qty' => $customers->count(),
73
+ 'length' => isset($config['length']) ? $config['length'] : 14,
74
+ // 'to_date' => '2013-12-31',
75
+ 'format' => isset($config['format']) ? $config['format'] : Mage_SalesRule_Helper_Coupon::COUPON_FORMAT_ALPHANUMERIC,
76
+ 'suffix' => isset($config['suffix']) ? $config['suffix'] : '',
77
+ 'prefix' => isset($config['prefix']) ? $config['prefix'] : '',
78
+ 'dash' => isset($config['dash']) ? $config['dash'] : null,
79
+ 'rule_id' => $rule->getId()
80
+ );
81
+
82
+ if (!$generator->validateData($data)) {
83
+ Mage::log('fail to validate data in ' . __CLASS__);
84
+ return $this;
85
+ }
86
+
87
+ $generator->setData($data);
88
+ $generator->generatePool();
89
+
90
+ // retrieve these coupons code
91
+ $coupons = Mage::getResourceModel('salesrule/coupon_collection')
92
+ ->addFieldToFilter('rule_id', array('eq' => $rule->getId()));
93
+ $coupons->getSelect()
94
+ ->order('coupon_id DESC')
95
+ ->limit($customers->count());
96
+ $coupons->load();
97
+
98
+ foreach ($customers as $customer) {
99
+ $cIterator = $coupons->getIterator();
100
+ $coupon = $cIterator->current();
101
+ if (!$coupon) {
102
+ Mage::log('too few coupons in ' . __CLASS__);
103
+ continue;
104
+ }
105
+ // store this will save the coupon in mailing_recipient table
106
+ $customer->setCampaignCouponCode($coupon->getCode());
107
+ $cIterator->next();
108
+ }
109
+ }
110
+ }
111
+
112
+ }
app/code/community/Adfab/Emailcampaign/Model/Campaign.php CHANGED
@@ -50,12 +50,6 @@ class Adfab_Emailcampaign_Model_Campaign extends Mage_Core_Model_Abstract
50
  $this->_init('adfab_emailcampaign/campaign');
51
  }
52
 
53
- public function loadByKey($key)
54
- {
55
- $this->addData($this->getResource()->loadByKey($key));
56
- return $this;
57
- }
58
-
59
  public function setVariable($key, $value = null)
60
  {
61
  if (!$this->_variablesLoaded) {
50
  $this->_init('adfab_emailcampaign/campaign');
51
  }
52
 
 
 
 
 
 
 
53
  public function setVariable($key, $value = null)
54
  {
55
  if (!$this->_variablesLoaded) {
app/code/community/Adfab/Emailcampaign/Model/Campaign/Abstract.php CHANGED
@@ -90,6 +90,15 @@ abstract class Adfab_Emailcampaign_Model_Campaign_Abstract
90
  if (!$this->_connector || !$this->_campaign) {
91
  Mage::throwException('you must call _init method first');
92
  }
 
 
 
 
 
 
 
 
 
93
  $this->_connector->sendMail($this->_campaign, $customers, $data);
94
  }
95
 
@@ -148,4 +157,9 @@ abstract class Adfab_Emailcampaign_Model_Campaign_Abstract
148
  return $this;
149
  }
150
 
 
 
 
 
 
151
  }
90
  if (!$this->_connector || !$this->_campaign) {
91
  Mage::throwException('you must call _init method first');
92
  }
93
+
94
+ // check if the campaign is using a price rule
95
+ if (!$this->isVoid() && ($coupon = $this->_campaign->getVariable('coupon'))) {
96
+ if (isset($coupon['use_rule']) && $coupon['use_rule']) {
97
+ // generate now to be able to use it in the template
98
+ Mage::helper('adfab_emailcampaign/coupon')->generateCouponForCustomers($coupon['rule_id'], $customers, $coupon);
99
+ }
100
+ }
101
+
102
  $this->_connector->sendMail($this->_campaign, $customers, $data);
103
  }
104
 
157
  return $this;
158
  }
159
 
160
+ /**
161
+ * @param Adfab_Emailcampaign_Model_Campaign $campaign
162
+ */
163
+ public function beforeCampaignSave($campaign) {}
164
+
165
  }
app/code/community/Adfab/Emailcampaign/Model/Campaign/OfferAfterOrder.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Campaign_OfferAfterOrder extends Adfab_Emailcampaign_Model_Campaign_Cron
38
+ {
39
+
40
+ public function process(Adfab_Emailcampaign_Model_Campaign $campaign)
41
+ {
42
+ $this->_init($campaign);
43
+
44
+ $sendAfter = $campaign->getVariable('send_after');
45
+
46
+ $format = 'Y-m-d H:i:s';
47
+ $date = new DateTime(date($format));
48
+ $date->sub(new DateInterval('P'.$sendAfter.'D'));
49
+
50
+ $ressource = Mage::getSingleton('core/resource');
51
+ $customers = $this->getCustomerList();
52
+
53
+ $customers->getSelect()->join(
54
+ array('order' => $ressource->getTableName('sales/order')),
55
+ 'order.customer_id = e.entity_id',
56
+ array('last_order_date' => 'MAX(order.created_at)', 'count_orders' => 'COUNT(order.customer_id)')
57
+ )->having(
58
+ 'MAX(order.created_at) < ?', $date->format($format)
59
+ )/*->having(
60
+ 'count_orders = ?', 1
61
+ )*/;
62
+
63
+ $this->sendMail(
64
+ $customers,
65
+ function($customer) {
66
+ return array('customer' => $customer);
67
+ }
68
+ );
69
+ }
70
+
71
+ public function getCampaignUsage()
72
+ {
73
+ return Mage::helper('adfab_emailcampaign')->__('notice_offerafterorder');
74
+ }
75
+
76
+ public function beforeCampaignSave($campaign)
77
+ {
78
+ $ruleId = $campaign->getVariable('rule_id');
79
+ $rule = Mage::getModel('salesrule/rule')->load($ruleId);
80
+ if (!$rule->getId()) {
81
+ Mage::getSingleton('adminhtml/session')->addWarning(Mage::helper('adfab_emailcampaign')->__('Rule with ID "%s" does not exists', $ruleId));
82
+ }
83
+ }
84
+ }
app/code/community/Adfab/Emailcampaign/Model/Cron/Observer.php CHANGED
@@ -108,10 +108,14 @@ class Adfab_Emailcampaign_Model_Cron_Observer extends Mage_Cron_Model_Observer
108
  ->save();
109
 
110
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $model));
111
- call_user_func_array($callback, $arguments);
112
- $model->updateLastRunDate();
113
- Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $model));
114
- $campaign->save();
 
 
 
 
115
 
116
  $schedule
117
  ->setStatus(Mage_Cron_Model_Schedule::STATUS_SUCCESS)
108
  ->save();
109
 
110
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $model));
111
+ $success = call_user_func_array($callback, $arguments);
112
+ if ($success !== false) {
113
+ $model->updateLastRunDate();
114
+ Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $model));
115
+ $campaign->save();
116
+ } else {
117
+ Mage::log('Campaign ID ' . $campaign->getId() . ' return false');
118
+ }
119
 
120
  $schedule
121
  ->setStatus(Mage_Cron_Model_Schedule::STATUS_SUCCESS)
app/code/community/Adfab/Emailcampaign/Model/Mailing.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Mailing extends Mage_Core_Model_Abstract
38
+ {
39
+
40
+ public function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->_init('adfab_emailcampaign/mailing');
44
+ }
45
+
46
+ /**
47
+ * fired by emailcampaign_campaign_process_after
48
+ * add mailing data after the campaign is processed
49
+ * @param Varien_Event_Observer $observer
50
+ */
51
+ public function addMailingData($observer)
52
+ {
53
+ // do not log if test, for exemple : view recipients.
54
+ if ($observer->getMode() == 'test') {
55
+ return $this;
56
+ }
57
+ $this->getResource()->addMailingData(
58
+ $observer->getModel(),
59
+ $observer->getCampaign()
60
+ );
61
+ }
62
+
63
+ }
app/code/community/Adfab/Emailcampaign/Model/Mailing/Recipient.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Mailing_Recipient extends Mage_Core_Model_Abstract
38
+ {
39
+
40
+ public function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->_init('adfab_emailcampaign/mailing_recipient');
44
+ }
45
+
46
+ }
app/code/community/Adfab/Emailcampaign/Model/Observer.php CHANGED
@@ -86,8 +86,37 @@ class Adfab_Emailcampaign_Model_Observer extends Mage_Core_Model_Abstract
86
  $class = Mage::getModel((string)$config->class);
87
  foreach ($campaigns as $campaign) {
88
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class));
89
- $class->process($campaign, $observer);
90
- Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
  }
93
  }
86
  $class = Mage::getModel((string)$config->class);
87
  foreach ($campaigns as $campaign) {
88
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class));
89
+ $success = $class->process($campaign, $observer);
90
+ if ($success !== false) {
91
+ Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class));
92
+ } else {
93
+ Mage::log('Campaign ID ' . $campaign->getId() . ' return false');
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ /**
100
+ * check if coupon can be used by the customer according to mailing_recipient table
101
+ * @param Varien_Event_Observer $observer
102
+ */
103
+ public function checkCouponCode($observer)
104
+ {
105
+ $quote = $observer->getQuote();
106
+ $coupon = $quote->getCouponCode();
107
+ $recipient = Mage::getResourceModel('adfab_emailcampaign/mailing_recipient_collection')
108
+ ->addFieldToFilter('coupon_code', array('eq' => $coupon))
109
+ ->getFirstItem();
110
+ // only if we have a recipient, check the coupon validity
111
+ if ($recipient && $recipient->getId()) {
112
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
113
+ $customerId = $customer ? $customer->getId() : false;
114
+ // the customer must match with the coupon defined in mailing_recipient table
115
+ if (!$customerId || $recipient->getCustomerId() != $customerId) {
116
+ $result = $observer->getResult();
117
+ $result->setDiscountAmount(0);
118
+ $result->setBaseDiscountAmount(0);
119
+ $quote->unsCouponCode();
120
  }
121
  }
122
  }
app/code/community/Adfab/Emailcampaign/Model/Resource/Campaign.php CHANGED
@@ -54,26 +54,6 @@ class Adfab_Emailcampaign_Model_Resource_Campaign extends Mage_Core_Model_Resour
54
  $this->_read = $this->_getReadAdapter();
55
  }
56
 
57
- /**
58
- * Get carouselhome identifier by key
59
- *
60
- * @param string $key
61
- * @return int|false
62
- */
63
- public function loadByKey($key)
64
- {
65
- $select = $this->_read->select()
66
- ->from($this->_campaignTable)
67
- ->where('keylang=?',$key);
68
- $result = $this->_read->fetchRow($select);
69
-
70
- if(!$result) {
71
- return array();
72
- }
73
-
74
- return $result;
75
- }
76
-
77
  /**
78
  * @return Varien_Db_Adapter_Pdo_Mysql
79
  */
54
  $this->_read = $this->_getReadAdapter();
55
  }
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * @return Varien_Db_Adapter_Pdo_Mysql
59
  */
app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Resource_Mailing extends Mage_Core_Model_Resource_Db_Abstract
38
+ {
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $_mailingTable;
44
+
45
+ /**
46
+ * @var Varien_Db_Adapter_Interface
47
+ */
48
+ protected $_read;
49
+
50
+ public function _construct()
51
+ {
52
+ $this->_init('adfab_emailcampaign/mailing', 'mailing_id');
53
+ $this->_mailingTable = Mage::getSingleton('core/resource')->getTableName('adfab_emailcampaign/mailing');
54
+ $this->_read = $this->_getReadAdapter();
55
+ }
56
+
57
+ /**
58
+ * @return Varien_Db_Adapter_Pdo_Mysql
59
+ */
60
+ protected function _getReadAdapter()
61
+ {
62
+ return Mage::getSingleton('core/resource')->getConnection('core_read');
63
+ }
64
+
65
+ /**
66
+ * @return Varien_Db_Adapter_Pdo_Mysql
67
+ */
68
+ protected function _getWriteAdapter()
69
+ {
70
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
71
+ }
72
+
73
+ /**
74
+ * add mailing data after the campaign is processed
75
+ * @param Adfab_Emailcampaign_Model_Campaign_Abstract $model
76
+ * @param Adfab_Emailcampaign_Model_Campaign $campaign
77
+ */
78
+ public function addMailingData($model, $campaign)
79
+ {
80
+ $customers = $model->getCustomerList();
81
+ $this->_getWriteAdapter()->insert(
82
+ $this->_mailingTable,
83
+ array(
84
+ 'campaign_id' => $campaign->getId(),
85
+ 'recipient_count' => $customers->count(),
86
+ 'executed_at' => date('Y-m-d H:i:s')
87
+ )
88
+ );
89
+ $mailingId = $this->_getWriteAdapter()->lastInsertId($this->_mailingTable, 'mailing_id');
90
+ Mage::getResourceModel('adfab_emailcampaign/mailing_recipient')
91
+ ->addMailingRecipientData($mailingId, $model, $campaign);
92
+ }
93
+
94
+ }
app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Collection.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Resource_Mailing_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
38
+ {
39
+
40
+ public function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->_init('adfab_emailcampaign/mailing');
44
+ }
45
+
46
+ }
app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Recipient.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Resource_Mailing_Recipient extends Mage_Core_Model_Resource_Db_Abstract
38
+ {
39
+
40
+ /**
41
+ * @var string
42
+ */
43
+ protected $_recipientTable;
44
+
45
+ /**
46
+ * @var Varien_Db_Adapter_Interface
47
+ */
48
+ protected $_read;
49
+
50
+ public function _construct()
51
+ {
52
+ $this->_init('adfab_emailcampaign/mailing_recipient', 'recipient_id');
53
+ $this->_recipientTable = Mage::getSingleton('core/resource')->getTableName('adfab_emailcampaign/mailing_recipient');
54
+ $this->_read = $this->_getReadAdapter();
55
+ }
56
+
57
+ /**
58
+ * @return Varien_Db_Adapter_Pdo_Mysql
59
+ */
60
+ protected function _getReadAdapter()
61
+ {
62
+ return Mage::getSingleton('core/resource')->getConnection('core_read');
63
+ }
64
+
65
+ /**
66
+ * @return Varien_Db_Adapter_Pdo_Mysql
67
+ */
68
+ protected function _getWriteAdapter()
69
+ {
70
+ return Mage::getSingleton('core/resource')->getConnection('core_write');
71
+ }
72
+
73
+ /**
74
+ * add mailing recipient data after the campaign is processed
75
+ * @param integer $mailingId
76
+ * @param Adfab_Emailcampaign_Model_Campaign_Abstract $model
77
+ * @param Adfab_Emailcampaign_Model_Campaign $campaign
78
+ */
79
+ public function addMailingRecipientData($mailingId, $model, $campaign)
80
+ {
81
+ $customers = $model->getCustomerList();
82
+ if (!$customers->getSize()) {
83
+ return;
84
+ }
85
+
86
+ $data = array();
87
+ foreach ($customers as $customer) {
88
+ $data[] = array(
89
+ 'mailing_id' => $mailingId,
90
+ 'customer_id' => $customer->getId(),
91
+ // if the campaign save a coupon for the customer
92
+ 'coupon_code' => $customer->getCampaignCouponCode() ? $customer->getCampaignCouponCode() : null
93
+ );
94
+ }
95
+
96
+ $this->_getWriteAdapter()->insertArray(
97
+ $this->_recipientTable,
98
+ array(
99
+ 'mailing_id',
100
+ 'customer_id',
101
+ 'coupon_code',
102
+ ),
103
+ $data
104
+ );
105
+ }
106
+
107
+ }
app/code/community/Adfab/Emailcampaign/Model/Resource/Mailing/Recipient/Collection.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Resource_Mailing_Recipient_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
38
+ {
39
+
40
+ public function _construct()
41
+ {
42
+ parent::_construct();
43
+ $this->_init('adfab_emailcampaign/mailing_recipient');
44
+ }
45
+
46
+ }
app/code/community/Adfab/Emailcampaign/Model/Source/SalesRule/Rule.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Short description of the class
29
+ *
30
+ * Long description of the class (if any...)
31
+ *
32
+ * @category Adfab
33
+ * @package Adfab_Emailcampaign
34
+ * @subpackage Model
35
+ * @author Arnaud Hours <arnaud.hours@adfab.fr>
36
+ */
37
+ class Adfab_Emailcampaign_Model_Source_SalesRule_Rule
38
+ {
39
+
40
+ /**
41
+ * Generate list of email templates
42
+ *
43
+ * @return array
44
+ */
45
+ public function toFormOptionArray()
46
+ {
47
+ $result = array();
48
+ $collection = Mage::getResourceModel('salesrule/rule_collection')->load();
49
+ $options = $collection->toOptionArray();
50
+ foreach ($collection as $rule) {
51
+ $result[$rule->getRuleId()] = $rule->getName();
52
+ }
53
+ // sort by names alphabetically
54
+ asort($result);
55
+
56
+ $options = array();
57
+ $options[] = array('value' => '', 'label' => '--------- ' . Mage::helper('adfab_emailcampaign')->__('Choose Rule') . ' ---------');
58
+ foreach ($result as $k => $v) {
59
+ if ($k == '')
60
+ continue;
61
+ $options[] = array('value' => $k, 'label' => $v);
62
+ }
63
+
64
+ $result = $options;
65
+ return $result;
66
+ }
67
+
68
+ }
app/code/community/Adfab/Emailcampaign/controllers/Adminhtml/CampaignController.php CHANGED
@@ -159,26 +159,30 @@ class Adfab_Emailcampaign_Adminhtml_CampaignController extends Mage_Adminhtml_Co
159
  }
160
 
161
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class));
162
- $class->process($campaign);
163
- $class->updateLastRunDate();
164
- Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class));
165
- $campaign->save();
 
166
 
167
- $customers = $class->getCustomerList();
168
- $msg = null;
169
- if ($customers->count() > 10) {
170
- $msg = Mage::helper('adfab_emailcampaign')->__('Test email was sent to %i addresses', $customers->getSize());
171
- } else if ($customers->count() > 0) {
172
- $emails = array();
173
- foreach ($customers as $customer) {
174
- $emails[] = $customer->getEmail();
 
 
 
 
175
  }
176
- $msg = Mage::helper('adfab_emailcampaign')->__('Email was sent to %s', implode(', ', $emails));
 
177
  } else {
178
- $msg = Mage::helper('adfab_emailcampaign')->__('No customer match this campaign at this time');
179
  }
180
-
181
- Mage::getSingleton('adminhtml/session')->addSuccess($msg);
182
  $this->_redirect('*/*/');
183
  }
184
 
@@ -204,22 +208,26 @@ class Adfab_Emailcampaign_Adminhtml_CampaignController extends Mage_Adminhtml_Co
204
 
205
  $oldMode = $campaign->getMode();
206
  $campaign->setMode(Adfab_Emailcampaign_Model_Source_Mode::TEST_ALL_EMAIL);
207
- Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class));
208
- $class->process($campaign);
209
- Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class));
210
- $customers = $class->getCustomerList();
211
- $campaign->setMode($oldMode)->save();
212
- $msg = null;
213
- if ($customers->count() > 10) {
214
- $msg = Mage::helper('adfab_emailcampaign')->__('Test email was sent to %i addresses in test mode', $customers->getSize());
215
- } else if ($customers->count() > 0) {
216
- $emails = array();
217
- foreach ($customers as $customer) {
218
- $emails[] = $customer->getEmail();
 
 
 
 
 
219
  }
220
- $msg = Mage::helper('adfab_emailcampaign')->__('Email was sent to %s in test mode', implode(', ', $emails));
221
  } else {
222
- $msg = Mage::helper('adfab_emailcampaign')->__('No test email found');
223
  }
224
 
225
  Mage::getSingleton('adminhtml/session')->addSuccess($msg);
159
  }
160
 
161
  Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class));
162
+ $success = $class->process($campaign);
163
+ if ($success !== false) {
164
+ $class->updateLastRunDate();
165
+ Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class));
166
+ $campaign->save();
167
 
168
+ $customers = $class->getCustomerList();
169
+ $msg = null;
170
+ if ($customers->count() > 10) {
171
+ $msg = Mage::helper('adfab_emailcampaign')->__('Test email was sent to %i addresses', $customers->getSize());
172
+ } else if ($customers->count() > 0) {
173
+ $emails = array();
174
+ foreach ($customers as $customer) {
175
+ $emails[] = $customer->getEmail();
176
+ }
177
+ $msg = Mage::helper('adfab_emailcampaign')->__('Email was sent to %s', implode(', ', $emails));
178
+ } else {
179
+ $msg = Mage::helper('adfab_emailcampaign')->__('No customer match this campaign at this time');
180
  }
181
+
182
+ Mage::getSingleton('adminhtml/session')->addSuccess($msg);
183
  } else {
184
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adfab_emailcampaign')->__('Campaign was not processed'));
185
  }
 
 
186
  $this->_redirect('*/*/');
187
  }
188
 
208
 
209
  $oldMode = $campaign->getMode();
210
  $campaign->setMode(Adfab_Emailcampaign_Model_Source_Mode::TEST_ALL_EMAIL);
211
+ Mage::dispatchEvent('emailcampaign_campaign_process_before', array('campaign' => $campaign, 'model' => $class, 'mode' => 'test'));
212
+ $success = $class->process($campaign);
213
+ if ($success !== false) {
214
+ Mage::dispatchEvent('emailcampaign_campaign_process_after', array('campaign' => $campaign, 'model' => $class, 'mode' => 'test'));
215
+ $customers = $class->getCustomerList();
216
+ $campaign->setMode($oldMode)->save();
217
+ $msg = null;
218
+ if ($customers->count() > 10) {
219
+ $msg = Mage::helper('adfab_emailcampaign')->__('Test email was sent to %i addresses in test mode', $customers->getSize());
220
+ } else if ($customers->count() > 0) {
221
+ $emails = array();
222
+ foreach ($customers as $customer) {
223
+ $emails[] = $customer->getEmail();
224
+ }
225
+ $msg = Mage::helper('adfab_emailcampaign')->__('Email was sent to %s in test mode', implode(', ', $emails));
226
+ } else {
227
+ $msg = Mage::helper('adfab_emailcampaign')->__('No test email found');
228
  }
 
229
  } else {
230
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adfab_emailcampaign')->__('Campaign was not processed'));
231
  }
232
 
233
  Mage::getSingleton('adminhtml/session')->addSuccess($msg);
app/code/community/Adfab/Emailcampaign/etc/config.xml CHANGED
@@ -26,7 +26,7 @@
26
  <config>
27
  <modules>
28
  <Adfab_Emailcampaign>
29
- <version>1.2.1</version>
30
  </Adfab_Emailcampaign>
31
  </modules>
32
  <global>
@@ -62,6 +62,12 @@
62
  <campaign_notification>
63
  <table>emailcampaign_campaign_notification</table>
64
  </campaign_notification>
 
 
 
 
 
 
65
  </entities>
66
  </adfab_emailcampaign_resource>
67
  </models>
@@ -139,6 +145,20 @@
139
  </form>
140
  </forms>
141
  </emailcampaign_nursing>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <!--emailcampaign_ordersuccess>
143
  <name>Order Success</name>
144
  <class>adfab_emailcampaign/campaign_orderSuccess</class>
@@ -190,6 +210,11 @@
190
  <file>emailcampaign/nursing.html</file>
191
  <type>html</type>
192
  </emailcampaign_nursing_email_template>
 
 
 
 
 
193
  <!--emailcampaign_ordersuccess_email_template translate="label" module="adfab_emailcampaign">
194
  <label>Order success</label>
195
  <file>emailcampaign/order_success.html</file>
@@ -206,6 +231,22 @@
206
  </adfab_emailcampaign_add_observers>
207
  </observers>
208
  </controller_front_init_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  </events>
210
  </global>
211
  <admin>
@@ -233,6 +274,7 @@
233
  <wishlist_reminder>emailcampaign/Adfab_Emailcampaign_WishlistReminder.csv</wishlist_reminder>
234
  <wishlist_stock_alert>emailcampaign/Adfab_Emailcampaign_WishlistStockAlert.csv</wishlist_stock_alert>
235
  <nursing>emailcampaign/Adfab_Emailcampaign_Nursing.csv</nursing>
 
236
  </files>
237
  </Adfab_Emailcampaign>
238
  </modules>
26
  <config>
27
  <modules>
28
  <Adfab_Emailcampaign>
29
+ <version>1.2.2</version>
30
  </Adfab_Emailcampaign>
31
  </modules>
32
  <global>
62
  <campaign_notification>
63
  <table>emailcampaign_campaign_notification</table>
64
  </campaign_notification>
65
+ <mailing>
66
+ <table>emailcampaign_mailing</table>
67
+ </mailing>
68
+ <mailing_recipient>
69
+ <table>emailcampaign_mailing_recipient</table>
70
+ </mailing_recipient>
71
  </entities>
72
  </adfab_emailcampaign_resource>
73
  </models>
145
  </form>
146
  </forms>
147
  </emailcampaign_nursing>
148
+ <emailcampaign_offerafterorder>
149
+ <name>Offer After Order</name>
150
+ <class>adfab_emailcampaign/campaign_offerAfterOrder</class>
151
+ <type>cron</type>
152
+ <forms>
153
+ <form>
154
+ <class>adfab_emailcampaign/adminhtml_campaign_forms_offerAfterOrder</class>
155
+ </form>
156
+ <coupons>
157
+ <class>adfab_emailcampaign/adminhtml_campaign_forms_coupons</class>
158
+ <label>Coupons options</label>
159
+ </coupons>
160
+ </forms>
161
+ </emailcampaign_offerafterorder>
162
  <!--emailcampaign_ordersuccess>
163
  <name>Order Success</name>
164
  <class>adfab_emailcampaign/campaign_orderSuccess</class>
210
  <file>emailcampaign/nursing.html</file>
211
  <type>html</type>
212
  </emailcampaign_nursing_email_template>
213
+ <emailcampaign_offerafterorder_email_template translate="label" module="adfab_emailcampaign">
214
+ <label>Offer After Order</label>
215
+ <file>emailcampaign/offer_after_order.html</file>
216
+ <type>html</type>
217
+ </emailcampaign_offerafterorder_email_template>
218
  <!--emailcampaign_ordersuccess_email_template translate="label" module="adfab_emailcampaign">
219
  <label>Order success</label>
220
  <file>emailcampaign/order_success.html</file>
231
  </adfab_emailcampaign_add_observers>
232
  </observers>
233
  </controller_front_init_before>
234
+ <emailcampaign_campaign_process_after>
235
+ <observers>
236
+ <adfab_emailcampaign_add_mailing_data>
237
+ <class>adfab_emailcampaign/mailing</class>
238
+ <method>addMailingData</method>
239
+ </adfab_emailcampaign_add_mailing_data>
240
+ </observers>
241
+ </emailcampaign_campaign_process_after>
242
+ <salesrule_validator_process>
243
+ <observers>
244
+ <adfab_emailcampaign_check_coupon_code>
245
+ <class>adfab_emailcampaign/observer</class>
246
+ <method>checkCouponCode</method>
247
+ </adfab_emailcampaign_check_coupon_code>
248
+ </observers>
249
+ </salesrule_validator_process>
250
  </events>
251
  </global>
252
  <admin>
274
  <wishlist_reminder>emailcampaign/Adfab_Emailcampaign_WishlistReminder.csv</wishlist_reminder>
275
  <wishlist_stock_alert>emailcampaign/Adfab_Emailcampaign_WishlistStockAlert.csv</wishlist_stock_alert>
276
  <nursing>emailcampaign/Adfab_Emailcampaign_Nursing.csv</nursing>
277
+ <offerafterorder>emailcampaign/Adfab_Emailcampaign_OfferAfterOrder.csv</offerafterorder>
278
  </files>
279
  </Adfab_Emailcampaign>
280
  </modules>
app/code/community/Adfab/Emailcampaign/sql/adfab_emailcampaign_setup/mysql4-upgrade-0.1.2-0.1.3.php CHANGED
@@ -31,7 +31,7 @@
31
  $installer = $this;
32
  $installer->startSetup();
33
 
34
- // try {
35
  $installer->getConnection()->dropTable($installer->getTable('adfab_emailcampaign/campaign_notification'));
36
  $table = $installer->getConnection()->newTable($installer->getTable('adfab_emailcampaign/campaign_notification'))
37
  ->addColumn('notification_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
@@ -54,8 +54,8 @@ $installer->startSetup();
54
  'nullable' => false,
55
  ), 'Type');
56
  $installer->getConnection()->createTable($table);
57
- // } catch (Exception $e) {
58
- // Mage::logException($e);
59
- // }
60
 
61
  $installer->endSetup();
31
  $installer = $this;
32
  $installer->startSetup();
33
 
34
+ try {
35
  $installer->getConnection()->dropTable($installer->getTable('adfab_emailcampaign/campaign_notification'));
36
  $table = $installer->getConnection()->newTable($installer->getTable('adfab_emailcampaign/campaign_notification'))
37
  ->addColumn('notification_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array(
54
  'nullable' => false,
55
  ), 'Type');
56
  $installer->getConnection()->createTable($table);
57
+ } catch (Exception $e) {
58
+ Mage::logException($e);
59
+ }
60
 
61
  $installer->endSetup();
app/code/community/Adfab/Emailcampaign/sql/adfab_emailcampaign_setup/mysql4-upgrade-1.2.1-1.2.2.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Adfab extension for Magento
4
+ *
5
+ * Long description of this file (if any...)
6
+ *
7
+ * NOTICE OF LICENSE
8
+ *
9
+ * This source file is subject to the Open Software License (OSL 3.0)
10
+ * that is bundled with this package in the file LICENSE.txt.
11
+ * It is also available through the world-wide-web at this URL:
12
+ * http://opensource.org/licenses/osl-3.0.php
13
+ *
14
+ * DISCLAIMER
15
+ *
16
+ * Do not edit or add to this file if you wish to upgrade
17
+ * the Adfab Emailcampaign module to newer versions in the future.
18
+ * If you wish to customize the Adfab Emailcampaign module for your needs
19
+ * please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Adfab
22
+ * @package Adfab_Emailcampaign
23
+ * @copyright Copyright (C) 2014 Adfab (http://www.adfab.fr/)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * @var $this Mage_Core_Model_Resource_Setup
29
+ */
30
+
31
+ $installer = $this;
32
+ $installer->startSetup();
33
+
34
+ try {
35
+ $installer->getConnection()->dropTable($installer->getTable('adfab_emailcampaign/mailing'));
36
+ $table = $installer->getConnection()->newTable($installer->getTable('adfab_emailcampaign/mailing'))
37
+ ->addColumn('mailing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
38
+ 'unsigned' => true,
39
+ 'nullable' => false,
40
+ 'primary' => true,
41
+ 'identity' => true,
42
+ ), 'Mailing ID')
43
+ ->addColumn('campaign_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
44
+ 'unsigned' => true,
45
+ 'nullable' => false,
46
+ ), 'Campaign ID')
47
+ ->addColumn('recipient_count', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
48
+ 'unsigned' => true,
49
+ 'nullable' => false,
50
+ ), 'Campaign ID')
51
+ ->addColumn('executed_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
52
+ ), 'Executed At');
53
+ $installer->getConnection()->createTable($table);
54
+
55
+ $installer->getConnection()
56
+ ->addConstraint(
57
+ 'FK_MAILING_CAMPAIGN',
58
+ $installer->getTable('adfab_emailcampaign/mailing'),
59
+ 'campaign_id',
60
+ $installer->getTable('adfab_emailcampaign/campaign'),
61
+ 'campaign_id',
62
+ 'cascade',
63
+ 'cascade'
64
+ );
65
+
66
+ $installer->getConnection()->dropTable($installer->getTable('adfab_emailcampaign/mailing_recipient'));
67
+ $table = $installer->getConnection()->newTable($installer->getTable('adfab_emailcampaign/mailing_recipient'))
68
+ ->addColumn('recipient_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
69
+ 'unsigned' => true,
70
+ 'nullable' => false,
71
+ 'primary' => true,
72
+ 'identity' => true,
73
+ ), 'Recipient ID')
74
+ ->addColumn('mailing_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
75
+ 'unsigned' => true,
76
+ 'nullable' => false,
77
+ ), 'Mailing ID')
78
+ ->addColumn('customer_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
79
+ 'unsigned' => true,
80
+ 'nullable' => false,
81
+ ), 'Customer ID')
82
+ ->addColumn('opened', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array(
83
+ 'nullable' => false,
84
+ 'default' => false
85
+ ), 'Customer ID')
86
+ ->addColumn('coupon_code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array(
87
+ 'nullable' => true,
88
+ ), 'Coupon Code');
89
+ $installer->getConnection()->createTable($table);
90
+
91
+ $installer->getConnection()
92
+ ->addConstraint(
93
+ 'FK_MAILING_RECIPIENT_MAILING',
94
+ $installer->getTable('adfab_emailcampaign/mailing_recipient'),
95
+ 'mailing_id',
96
+ $installer->getTable('adfab_emailcampaign/mailing'),
97
+ 'mailing_id',
98
+ 'cascade',
99
+ 'cascade'
100
+ );
101
+
102
+ $installer
103
+ ->getConnection()
104
+ ->addKey(
105
+ $installer->getTable('adfab_emailcampaign/mailing_recipient'),
106
+ 'IDX_MAILING_RECIPIENT_COUPON',
107
+ 'coupon_code'
108
+ );
109
+
110
+ } catch (Exception $e) {
111
+ Mage::logException($e);
112
+ }
113
+
114
+ $installer->endSetup();
app/locale/en_US/template/email/emailcampaign/offer_after_order.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject You're short in time ! @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "store url=\"customer/account/\"":"Customer Account Url",
7
+ "var customer.email":"Customer Email"
8
+ }
9
+ @-->
10
+
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <!-- [ header starts here] -->
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
25
+ </tr>
26
+ <!-- [ middle starts here] -->
27
+ <tr>
28
+ <td valign="top">
29
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Dear {{htmlescape var=$customer.name}},</h1>
30
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">You have not purshased for {{htmlescape var=$send_after_days}}] please visit <a href="{{store url="/"}}" style="color:#1E7EC8;">homepage</a>.</p>
31
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Get a special discount for your next order with the code {{htmlescape var=$customer.campaign_coupon_code}}</p>
32
+ <p style="font-size:12px; line-height:16px; margin:0;">If you have any questions about your account or any other matter, please feel free to contact us at <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> or by phone at {{config path='general/store_information/phone'}}.</p>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
37
+ </tr>
38
+ </table>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ </div>
43
+ </body>
app/locale/fr_FR/emailcampaign/Adfab_Emailcampaign.csv CHANGED
@@ -55,4 +55,11 @@
55
  "Recipients found for campaign ""%s""","Clients trouvés pour la campagne ""%s"""
56
  "Last Run (Cron)","Dernière exécution (cron)"
57
  "View Recipients","Voir les clients ciblés"
58
- "No test email found","Aucun email de test enregistré"
 
 
 
 
 
 
 
55
  "Recipients found for campaign ""%s""","Clients trouvés pour la campagne ""%s"""
56
  "Last Run (Cron)","Dernière exécution (cron)"
57
  "View Recipients","Voir les clients ciblés"
58
+ "No test email found","Aucun email de test enregistré"
59
+ "Campaign was not processed","La campagne n'a pas été exécutée"
60
+ "Use Price Rule","Utiliser une règle de prix"
61
+ "Rule ID","ID de la règle"
62
+ "the rule to use to determine the coupon code","la règle à utiliser pour déterminer le coupon de réduction"
63
+ "Coupons options","Options des coupons"
64
+ "Choose Rule","Choisir une règle"
65
+ "You can create a rule exclusively for this campaign <br /> Be careful: when one coupon is generated for a customer, only this one can use it, even if the rule is disabled. <br/> You can use the fields below to customize each generated coupon if the selected rule use auto generation","Vous pouvez créer une règle exclusivement pour cette campagne <br /> Soyez prudent: lorsqu'un coupon est généré pour un client, seul celui-ci pourra l'utiliser, même si la campagne est désactivée. <br/> Vous pouvez utiliser les champs ci-dessous pour personaliser les coupons si la règle utilise la génération automatique."
app/locale/fr_FR/emailcampaign/Adfab_Emailcampaign_OfferAfterOrder.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "notice_offerafterorder","Cette campagne permet d'envoyer des emails après commandes en proposant des codes de réductions automatisés"
2
+ "Rule with ID ""%s"" does not exists","La règle d'id ""%s"" n'existe pas"
3
+ "Send after how many days ?","Envoyer après combien de jours ?"
4
+ "Offer After Order","Offre après commande"
app/locale/fr_FR/template/email/emailcampaign/offer_after_order.html ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject You're short in time ! @-->
2
+ <!--@vars
3
+ {"store url=\"\"":"Store Url",
4
+ "var logo_url":"Email Logo Image Url",
5
+ "htmlescape var=$customer.name":"Customer Name",
6
+ "store url=\"customer/account/\"":"Customer Account Url",
7
+ "var customer.email":"Customer Email"
8
+ }
9
+ @-->
10
+
11
+ <!--@styles
12
+ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; }
13
+ @-->
14
+
15
+ <body style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
16
+ <div style="background:#F6F6F6; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; margin:0; padding:0;">
17
+ <table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
18
+ <tr>
19
+ <td align="center" valign="top" style="padding:20px 0 20px 0">
20
+ <!-- [ header starts here] -->
21
+ <table bgcolor="FFFFFF" cellspacing="0" cellpadding="10" border="0" width="650" style="border:1px solid #E0E0E0;">
22
+ <tr>
23
+ <td valign="top">
24
+ <a href="{{store url=""}}"><img src="{{var logo_url}}" alt="{{var logo_alt}}" style="margin-bottom:10px;" border="0"/></a></td>
25
+ </tr>
26
+ <!-- [ middle starts here] -->
27
+ <tr>
28
+ <td valign="top">
29
+ <h1 style="font-size:22px; font-weight:normal; line-height:22px; margin:0 0 11px 0;"">Cher {{htmlescape var=$customer.name}},</h1>
30
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Vous n'avez pas commandé sur <a href="{{store url="/"}}" style="color:#1E7EC8;">notre site</a> depuis {{htmlescape var=$send_after_days}}].</p>
31
+ <p style="font-size:12px; line-height:16px; margin:0 0 16px 0;">Profitez du code de réduction {{htmlescape var=$customer.campaign_coupon_code}} pour votre prochaine commande</p>
32
+ <p style="font-size:12px; line-height:16px; margin:0;">Pour toute question au sujet de votre compte, contactez par mail <a href="mailto:{{config path='trans_email/ident_support/email'}}" style="color:#1E7EC8;">{{config path='trans_email/ident_support/email'}}</a> ou par téléphone au {{config path='general/store_information/phone'}}.</p>
33
+ </td>
34
+ </tr>
35
+ <tr>
36
+ <td bgcolor="#EAEAEA" align="center" style="background:#EAEAEA; text-align:center;"><center><p style="font-size:12px; margin:0;">Thank you again, <strong>{{var store.getFrontendName()}}</strong></p></center></td>
37
+ </tr>
38
+ </table>
39
+ </td>
40
+ </tr>
41
+ </table>
42
+ </div>
43
+ </body>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adfab_Emailcampaign</name>
4
- <version>1.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">MIT</license>
7
  <channel>community</channel>
@@ -23,15 +23,19 @@ We've decided to offer you this incredibly efficient tool ! &#xD;
23
  <notes>&lt;h2&gt; Stories&#xD;
24
  &lt;/h2&gt;&#xD;
25
  &lt;ul&gt;&#xD;
26
- &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-50'&gt;ECAMPAIGN-50&lt;/a&gt;] - Error on input field for campaign variables&#xD;
27
  &lt;/li&gt;&#xD;
28
- &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-51'&gt;ECAMPAIGN-51&lt;/a&gt;] - Campaign abandoned_cart: remove those who bought&#xD;
 
 
 
 
29
  &lt;/li&gt;&#xD;
30
  &lt;/ul&gt;</notes>
31
  <authors><author><name>Adfab</name><user>Connect</user><email>dev@adfab.fr</email></author><author><name>Arnaud</name><user>Hours</user><email>arnaud.hours@adfab.fr</email></author><author><name>Gr&#xE9;gory</name><user>Besson</user><email>gregory.besson@adfab.fr</email></author><author><name>Fabien</name><user>Logarinho</user><email>fabien.logarinho@adfab.fr</email></author></authors>
32
- <date>2014-09-01</date>
33
- <time>16:26:54</time>
34
- <contents><target name="magecommunity"><dir name="Adfab"><dir name="Emailcampaign"><dir name="Block"><dir name="Adminhtml"><dir name="Campaign"><dir name="Edit"><file name="Form.php" hash="38d57e4be14d61760ea5ca9c2332c1cd"/><dir name="Tab"><file name="Cron.php" hash="ea1e1369ffa49f9769ea01c99a3f33d2"/><file name="Form.php" hash="82ede399adfdf869675c6ef58887ecd7"/></dir><file name="Tabs.php" hash="49c73b5c188788bc4555f90e6b9fc0b8"/></dir><file name="Edit.php" hash="0a295843e2249465087af280f06df179"/><dir name="Forms"><file name="AbandonedCart.php" hash="aeeb014d69eb474788e7d70a3ad91e66"/><file name="Abstract.php" hash="7a520a7c1e8518ca78d4762296a7a1ef"/><file name="CustomerBirthday.php" hash="d06856eb66ddc6f451502d9ca9edd054"/><file name="Nursing.php" hash="a601713fc6dcee213018fb953058ee90"/><file name="WelcomeReminder.php" hash="ec3bf8ad71709469e793dbc5dc50a904"/><file name="WishlistReminder.php" hash="e0d48c5ac2729755f05d458ce7a8ba6f"/><file name="WishlistStockAlert.php" hash="76ed4b5e0fef4dd3054778e4eab7956c"/></dir><file name="Grid.php" hash="f501eb5c2e9a73a39dde4aba31f65eb7"/></dir><file name="Campaign.php" hash="f04e05aeb7069c4dbca1de34a440b3f8"/><dir name="Form"><dir name="Edit"><dir name="Renderer"><file name="Cron.php" hash="66473bf095f32c7bb7c54c4283065d11"/></dir></dir></dir><dir name="Notification"><file name="Toolbar.php" hash="be40e4dba0ccd9b93e689dc7b210dd60"/></dir><dir name="Recipient"><file name="Grid.php" hash="e4e7fb3758f7e984373f0000d10025a7"/></dir><file name="Recipient.php" hash="62c555f70bae4588040cbd3e9d9c6f09"/><dir name="System"><dir name="Email"><dir name="Template"><file name="Preview.php" hash="daad77cd95f3fcff86b1043d2fd0a917"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Connector.php" hash="905978c328a28b488f93564f5a61e0d8"/><file name="Data.php" hash="0e2194d99e8210d7cebd7f4fd870f0eb"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Notification.php" hash="74add7866eead70769ffc45ec20a716c"/><file name="Observer.php" hash="d16bd2a407612392e368fe98bf255d74"/></dir><dir name="Campaign"><file name="AbandonedCart.php" hash="f150d6796a831bdc0c1cc59f615a2e45"/><file name="Abstract.php" hash="46c5f101a34ad7a6478de5bac082f19a"/><file name="Cron.php" hash="e6ce7eb666f4004d6d5e6badf866fde9"/><file name="CustomerBirthday.php" hash="ca0a0815fb518b3aab54ff02652cb366"/><file name="InscriptionAnniversary.php" hash="9bd7b33e55fa334c2d1a66f974a825af"/><file name="Nursing.php" hash="4796a032bec4cc7193439412eb30ac02"/><file name="Observer.php" hash="fd7df54d5027794a406751b8603b1d0f"/><file name="OrderSuccess.php" hash="04e0fb677ff43fb3ddf3febe16a71214"/><dir name="State"><file name="Abstract.php" hash="1b3569e77742011692316fd3ba274299"/><file name="Production.php" hash="1d072e2bf7bc2991596c709f96793574"/><file name="Test.php" hash="655693f73bc87f50768ab6ae34a06667"/><file name="TestAllEmail.php" hash="8213f1424490c0a638294d9b7cf13fd6"/></dir><file name="WelcomeReminder.php" hash="6e17fe38a7ce85e6a69448235910eb5f"/><file name="WishlistReminder.php" hash="b3608c014115ec5f2f3d12b9d460875e"/><file name="WishlistStockAlert.php" hash="6edd1e5c31d8819a946441619f220034"/></dir><file name="Campaign.php" hash="fbef74c9482f7ffd25ae6814f1f47a49"/><dir name="Connector"><file name="Abstract.php" hash="e54d842728fe6693baf84b8e10e78886"/><file name="Magento.php" hash="d5f5f408ad4cb2a7a34e4f9ba2a404ab"/><file name="Void.php" hash="cd5279f607c424524149745f29923628"/></dir><dir name="Cron"><file name="Observer.php" hash="362eea820924b4d48f7881eb5632c9d6"/></dir><file name="Cron.php" hash="d9193bb51f8c10e6df333a8d49ccff22"/><file name="Flag.php" hash="45c1adafa319cd4c7ad6ae33f488f7a9"/><file name="Observer.php" hash="1e381c9c966b47c3d538ab1f0d68a5ff"/><dir name="Resource"><dir name="Adminhtml"><dir name="Notification"><file name="Collection.php" hash="3f67feeb81bc2af50473487c3f946c35"/></dir><file name="Notification.php" hash="fed59a2d370cc925ad4d96d8cdf6252f"/></dir><dir name="Campaign"><file name="Collection.php" hash="c099bd0d4f772cb9fb7264dfcc89f1a4"/></dir><file name="Campaign.php" hash="23d238af26c9e8541e261b74755e97df"/></dir><dir name="Source"><file name="Campaign.php" hash="ad5e32b9342dfa0f9b10cb8dd4ba0fba"/><file name="Connector.php" hash="3266cb74618deacb4e5de06b28aceeb7"/><file name="Mode.php" hash="c0908ca6704bea3915799e3d3b27a4f5"/><file name="Template.php" hash="b00741e9685d6dd4fb2422648b2802da"/></dir><file name="Status.php" hash="555097dde09b0cdb49a91af8deb7399a"/></dir><dir name="Test"><dir name="Model"><dir name="Campaign"><dir name="State"><file name="Config.php" hash="dd1651f1305e8ddbf0ff2012eaee693d"/></dir></dir><file name="Campaign.php" hash="ee494b41dc1cf8ea579ec5b02ab42539"/><file name="Config.php" hash="b45e5ea3d4b71559eeeb02bf16a1be95"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CampaignController.php" hash="1a49ccd3f565f3e6e33f52830e28811f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="17c682b2b7fb4913a4188b6d87a69c81"/><file name="config.xml" hash="5fec4bfe51d6e20aa814ebc61f9dd80d"/><file name="system.xml" hash="d63724f9a64b1850ef1f6310f124a975"/></dir><dir name="sql"><dir name="adfab_emailcampaign_setup"><file name="mysql4-install-0.1.0.php" hash="5ad95df2af791ec795e0e7a3c7d7bf5f"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="6e4cdae76f993ad980650c5e456d61f6"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="7c92fe8a203dc06db0cde68fe660936d"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="97d172952a7e88f2da9d1f730623e880"/><file name="mysql4-upgrade-0.1.3-1.1.4.php" hash="60ca085cfd3eb743bbfe5023072c3ce7"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="jquery-cron.css" hash="d2c80b786c31d1f149bdc23efa4f8dc9"/></dir><dir name="js"><file name="emailcampaign.js" hash="9503e0128221ddda88e3ed7a96c532ce"/><file name="promoboost.js" hash="3ed5d51b01c30b28d6b308c523c170db"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="emailcampaign.xml" hash="e33be069a902bbdb2f06db0bee3969f7"/></dir><dir name="template"><dir name="emailcampaign"><dir name="notification"><file name="toolbar.phtml" hash="d34f7ad086c70032c9fb1486d9fb0ed1"/><file name="window.phtml" hash="c8495623259d7142ffdc0a2e0990efe1"/></dir><dir name="system"><dir name="email"><dir name="template"><file name="edit.phtml" hash="8a631cc2f30e751038a47459dcd4c2c2"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adfab_Emailcampaign.xml" hash="de9adb4d334e9b28430f039c236e90cb"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="emailcampaign"><file name="Adfab_Emailcampaign.csv" hash="175ed476c2aa21abc528abfedc66d938"/><file name="Adfab_Emailcampaign_AbandonedCart.csv" hash="ee4435a37b05062c23c088c137c32cc0"/><file name="Adfab_Emailcampaign_CustomerBirthday.csv" hash="f29be5ecbcdffb5eb7cc407baafba821"/><file name="Adfab_Emailcampaign_InscriptionAnniversary.csv" hash="befaa0fa1f6fce97d8571407e94f7d9f"/><file name="Adfab_Emailcampaign_Nursing.csv" hash="392113e808ea2bd8cdbbec3a2a2505a5"/><file name="Adfab_Emailcampaign_OrderSuccess.csv" hash="e3ff726605dd139054ffe6e7f91ab1d8"/><file name="Adfab_Emailcampaign_WelcomeReminder.csv" hash="8edb549e7b5cf31718361d6d1885340e"/><file name="Adfab_Emailcampaign_WishlistReminder.csv" hash="bd615da4bfcf92fe312bcb366d5a3baf"/><file name="Adfab_Emailcampaign_WishlistStockAlert.csv" hash="8dc3196198e9cc0b9e10d9ce79a2dabb"/></dir><dir name="template"><dir name="email"><dir name="emailcampaign"><file name="abandoned_cart.html" hash="e1da3bd3c8898e66fa86ed2c7f25f0a1"/><file name="customer_birthday.html" hash="1c8700144a93f2f0f51f65b7c2b9cea5"/><file name="inscription_anniversary.html" hash="1063b67ad73a35e761b2152ea2b227ac"/><file name="nursing.html" hash="41a55fb6d2d2bec03a1bd314413690c4"/><file name="order_success.html" hash="27f50eb0f7dc590b1a775aed6232f24c"/><file name="welcome_reminder.html" hash="a7efe6d290216c92cfbb488de88408de"/><file name="wishlist_reminder.html" hash="d3ea8b42d506b81e88e96e24cf396ad4"/><file name="wishlist_stock_alert.html" hash="fe75dc922b483433db7d646c973a2432"/></dir></dir></dir></dir><dir name="fr_FR"><dir name="emailcampaign"><file name="Adfab_Emailcampaign.csv" hash="424e0b8fe6deba48ffc624b72776030f"/><file name="Adfab_Emailcampaign_AbandonedCart.csv" hash="962c2f9b0b13302b5c910bd776a0e177"/><file name="Adfab_Emailcampaign_CustomerBirthday.csv" hash="789b307d91ed3df3722ebf47ba88e3ce"/><file name="Adfab_Emailcampaign_InscriptionAnniversary.csv" hash="32314f7b43a6431890c196f7ac0b9dea"/><file name="Adfab_Emailcampaign_Nursing.csv" hash="a94b29f96a3fa3dfb1726fef5323b499"/><file name="Adfab_Emailcampaign_OrderSuccess.csv" hash="6b1cd6e24298331c4a3e317e24695d1c"/><file name="Adfab_Emailcampaign_WelcomeReminder.csv" hash="de057c50c853f81ed0f2bc10a7565f6a"/><file name="Adfab_Emailcampaign_WishlistReminder.csv" hash="f4071c638993793d001d6902d1cbca44"/><file name="Adfab_Emailcampaign_WishlistStockAlert.csv" hash="a6cb9f4041c03fe2565393fbf132df32"/></dir><dir name="template"><dir name="email"><dir name="emailcampaign"><file name="abandoned_cart.html" hash="9c07490d6d2c48e373c41e21bc5faf6b"/><file name="customer_birthday.html" hash="2c63c5a9d9551c7f5c09637d98725ccf"/><file name="inscription_anniversary.html" hash="d7742a3632fda1d2a7af02ada64316ee"/><file name="nursing.html" hash="74e4745914d0db37f7b00b1bda79c42d"/><file name="order_success.html" hash="27f50eb0f7dc590b1a775aed6232f24c"/><file name="welcome_reminder.html" hash="11878a468f48e52ab9b8bcdf1c7a80eb"/><file name="wishlist_reminder.html" hash="bdd9b11d9b453bca83fe2e7116b385f7"/><file name="wishlist_stock_alert.html" hash="67495578ab15182417fd9088daab4dd3"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery.min.js" hash="19cc2d381510a7f54d17d4f363db76d2"/><file name="jquery-cron.min.js" hash="7102f517bb2ffb5d6d5f4d9f4ccb5a1e"/></dir></dir></target></contents>
35
  <compatible/>
36
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
37
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Adfab_Emailcampaign</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/MIT">MIT</license>
7
  <channel>community</channel>
23
  <notes>&lt;h2&gt; Stories&#xD;
24
  &lt;/h2&gt;&#xD;
25
  &lt;ul&gt;&#xD;
26
+ &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-20'&gt;ECAMPAIGN-20&lt;/a&gt;] - Campaign satisfaction implemented&#xD;
27
  &lt;/li&gt;&#xD;
28
+ &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-23'&gt;ECAMPAIGN-23&lt;/a&gt;] - Campaign Offer after order implemented, ability to use discount coupons&#xD;
29
+ &lt;/li&gt;&#xD;
30
+ &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-49'&gt;ECAMPAIGN-49&lt;/a&gt;] - Mail preview when creating a campaign&#xD;
31
+ &lt;/li&gt;&#xD;
32
+ &lt;li&gt;[&lt;a href='http://support.adfab.fr/support/browse/ECAMPAIGN-52'&gt;ECAMPAIGN-52&lt;/a&gt;] - Adding a date filter for the Wishlist Stock Alert campaign&#xD;
33
  &lt;/li&gt;&#xD;
34
  &lt;/ul&gt;</notes>
35
  <authors><author><name>Adfab</name><user>Connect</user><email>dev@adfab.fr</email></author><author><name>Arnaud</name><user>Hours</user><email>arnaud.hours@adfab.fr</email></author><author><name>Gr&#xE9;gory</name><user>Besson</user><email>gregory.besson@adfab.fr</email></author><author><name>Fabien</name><user>Logarinho</user><email>fabien.logarinho@adfab.fr</email></author></authors>
36
+ <date>2014-09-19</date>
37
+ <time>14:41:07</time>
38
+ <contents><target name="magecommunity"><dir name="Adfab"><dir name="Emailcampaign"><dir name="Block"><dir name="Adminhtml"><dir name="Campaign"><dir name="Edit"><file name="Form.php" hash="36d3b87a645fb854f21402b12338c57a"/><dir name="Tab"><file name="Cron.php" hash="ea1e1369ffa49f9769ea01c99a3f33d2"/><file name="Form.php" hash="82ede399adfdf869675c6ef58887ecd7"/></dir><file name="Tabs.php" hash="5880eaa7bbaf7e5487cf38b257edc269"/></dir><file name="Edit.php" hash="0a295843e2249465087af280f06df179"/><dir name="Forms"><file name="AbandonedCart.php" hash="aeeb014d69eb474788e7d70a3ad91e66"/><file name="Abstract.php" hash="27b2b29d1ba0030a38caa6270d943c06"/><file name="Coupons.php" hash="9600e4d6b4d98480e8f28e0ce064c4ad"/><file name="CustomerBirthday.php" hash="d06856eb66ddc6f451502d9ca9edd054"/><file name="Nursing.php" hash="a601713fc6dcee213018fb953058ee90"/><file name="OfferAfterOrder.php" hash="5e35c4a6371fcea31250c310ed7ca1d0"/><file name="WelcomeReminder.php" hash="ec3bf8ad71709469e793dbc5dc50a904"/><file name="WishlistReminder.php" hash="e0d48c5ac2729755f05d458ce7a8ba6f"/><file name="WishlistStockAlert.php" hash="76ed4b5e0fef4dd3054778e4eab7956c"/></dir><file name="Grid.php" hash="f501eb5c2e9a73a39dde4aba31f65eb7"/></dir><file name="Campaign.php" hash="f04e05aeb7069c4dbca1de34a440b3f8"/><dir name="Form"><dir name="Edit"><dir name="Renderer"><file name="Cron.php" hash="66473bf095f32c7bb7c54c4283065d11"/></dir></dir></dir><dir name="Notification"><file name="Toolbar.php" hash="be40e4dba0ccd9b93e689dc7b210dd60"/></dir><dir name="Recipient"><file name="Grid.php" hash="e4e7fb3758f7e984373f0000d10025a7"/></dir><file name="Recipient.php" hash="62c555f70bae4588040cbd3e9d9c6f09"/><dir name="System"><dir name="Email"><dir name="Template"><file name="Preview.php" hash="daad77cd95f3fcff86b1043d2fd0a917"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Connector.php" hash="905978c328a28b488f93564f5a61e0d8"/><file name="Coupon.php" hash="6c588024e45bc669442f4654b387870f"/><file name="Data.php" hash="0e2194d99e8210d7cebd7f4fd870f0eb"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Notification.php" hash="74add7866eead70769ffc45ec20a716c"/><file name="Observer.php" hash="d16bd2a407612392e368fe98bf255d74"/></dir><dir name="Campaign"><file name="AbandonedCart.php" hash="f150d6796a831bdc0c1cc59f615a2e45"/><file name="Abstract.php" hash="cf15270f0a0cbc2982ae6a31b7c86593"/><file name="Cron.php" hash="e6ce7eb666f4004d6d5e6badf866fde9"/><file name="CustomerBirthday.php" hash="ca0a0815fb518b3aab54ff02652cb366"/><file name="InscriptionAnniversary.php" hash="9bd7b33e55fa334c2d1a66f974a825af"/><file name="Nursing.php" hash="4796a032bec4cc7193439412eb30ac02"/><file name="Observer.php" hash="fd7df54d5027794a406751b8603b1d0f"/><file name="OfferAfterOrder.php" hash="3a81dbb2d708a433ba54cf2ce944447d"/><file name="OrderSuccess.php" hash="04e0fb677ff43fb3ddf3febe16a71214"/><dir name="State"><file name="Abstract.php" hash="1b3569e77742011692316fd3ba274299"/><file name="Production.php" hash="1d072e2bf7bc2991596c709f96793574"/><file name="Test.php" hash="655693f73bc87f50768ab6ae34a06667"/><file name="TestAllEmail.php" hash="8213f1424490c0a638294d9b7cf13fd6"/></dir><file name="WelcomeReminder.php" hash="6e17fe38a7ce85e6a69448235910eb5f"/><file name="WishlistReminder.php" hash="b3608c014115ec5f2f3d12b9d460875e"/><file name="WishlistStockAlert.php" hash="6edd1e5c31d8819a946441619f220034"/></dir><file name="Campaign.php" hash="3736b9f73b9ae58286e2f8e6ae0f02e7"/><dir name="Connector"><file name="Abstract.php" hash="e54d842728fe6693baf84b8e10e78886"/><file name="Magento.php" hash="d5f5f408ad4cb2a7a34e4f9ba2a404ab"/><file name="Void.php" hash="cd5279f607c424524149745f29923628"/></dir><dir name="Cron"><file name="Observer.php" hash="d62347e6c1c0c37050503ff15ce9da69"/></dir><file name="Cron.php" hash="d9193bb51f8c10e6df333a8d49ccff22"/><file name="Flag.php" hash="45c1adafa319cd4c7ad6ae33f488f7a9"/><dir name="Mailing"><file name="Recipient.php" hash="42c9f4b73206c7fe64f05bb08bbb71c4"/></dir><file name="Mailing.php" hash="8ff2c3f496d9e2944d1b1365651d7586"/><file name="Observer.php" hash="4f9ba57304902ca2fca5a928791e369a"/><dir name="Resource"><dir name="Adminhtml"><dir name="Notification"><file name="Collection.php" hash="3f67feeb81bc2af50473487c3f946c35"/></dir><file name="Notification.php" hash="fed59a2d370cc925ad4d96d8cdf6252f"/></dir><dir name="Campaign"><file name="Collection.php" hash="c099bd0d4f772cb9fb7264dfcc89f1a4"/></dir><file name="Campaign.php" hash="d9eea7dbe63161dc62c83b235f0643c9"/><dir name="Mailing"><file name="Collection.php" hash="459bdbbf0678a3b23e1a7625f8589509"/><dir name="Recipient"><file name="Collection.php" hash="03da8a837639be8b04e73b1275c3adc7"/></dir><file name="Recipient.php" hash="3f905b1f4508e606b1afc699dd0f2baa"/></dir><file name="Mailing.php" hash="a1f998b32a1c55dea097843a9baf1cca"/></dir><dir name="Source"><file name="Campaign.php" hash="ad5e32b9342dfa0f9b10cb8dd4ba0fba"/><file name="Connector.php" hash="3266cb74618deacb4e5de06b28aceeb7"/><file name="Mode.php" hash="c0908ca6704bea3915799e3d3b27a4f5"/><dir name="SalesRule"><file name="Rule.php" hash="e63368ce5f1fabd6b6d57e34a6513c8f"/></dir><file name="Template.php" hash="b00741e9685d6dd4fb2422648b2802da"/></dir><file name="Status.php" hash="555097dde09b0cdb49a91af8deb7399a"/></dir><dir name="Test"><dir name="Model"><dir name="Campaign"><dir name="State"><file name="Config.php" hash="dd1651f1305e8ddbf0ff2012eaee693d"/></dir></dir><file name="Campaign.php" hash="ee494b41dc1cf8ea579ec5b02ab42539"/><file name="Config.php" hash="b45e5ea3d4b71559eeeb02bf16a1be95"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CampaignController.php" hash="bbca868bed048c951711d78bc5d0e850"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="17c682b2b7fb4913a4188b6d87a69c81"/><file name="config.xml" hash="7942733671fc8531209616326a4ea57d"/><file name="system.xml" hash="d63724f9a64b1850ef1f6310f124a975"/></dir><dir name="sql"><dir name="adfab_emailcampaign_setup"><file name="mysql4-install-0.1.0.php" hash="5ad95df2af791ec795e0e7a3c7d7bf5f"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="6e4cdae76f993ad980650c5e456d61f6"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="7c92fe8a203dc06db0cde68fe660936d"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="f06e39217f0cfc2360de0fb6c0ad7f66"/><file name="mysql4-upgrade-0.1.3-1.1.4.php" hash="60ca085cfd3eb743bbfe5023072c3ce7"/><file name="mysql4-upgrade-1.2.1-1.2.2.php" hash="2419218d97373e115eda9327bf3b15b0"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="jquery-cron.css" hash="d2c80b786c31d1f149bdc23efa4f8dc9"/></dir><dir name="js"><file name="emailcampaign.js" hash="9503e0128221ddda88e3ed7a96c532ce"/><file name="promoboost.js" hash="3ed5d51b01c30b28d6b308c523c170db"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="emailcampaign.xml" hash="e33be069a902bbdb2f06db0bee3969f7"/></dir><dir name="template"><dir name="emailcampaign"><dir name="notification"><file name="toolbar.phtml" hash="d34f7ad086c70032c9fb1486d9fb0ed1"/><file name="window.phtml" hash="c8495623259d7142ffdc0a2e0990efe1"/></dir><dir name="system"><dir name="email"><dir name="template"><file name="edit.phtml" hash="8a631cc2f30e751038a47459dcd4c2c2"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Adfab_Emailcampaign.xml" hash="de9adb4d334e9b28430f039c236e90cb"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="emailcampaign"><file name="Adfab_Emailcampaign.csv" hash="175ed476c2aa21abc528abfedc66d938"/><file name="Adfab_Emailcampaign_AbandonedCart.csv" hash="ee4435a37b05062c23c088c137c32cc0"/><file name="Adfab_Emailcampaign_CustomerBirthday.csv" hash="f29be5ecbcdffb5eb7cc407baafba821"/><file name="Adfab_Emailcampaign_InscriptionAnniversary.csv" hash="befaa0fa1f6fce97d8571407e94f7d9f"/><file name="Adfab_Emailcampaign_Nursing.csv" hash="392113e808ea2bd8cdbbec3a2a2505a5"/><file name="Adfab_Emailcampaign_OrderSuccess.csv" hash="e3ff726605dd139054ffe6e7f91ab1d8"/><file name="Adfab_Emailcampaign_WelcomeReminder.csv" hash="8edb549e7b5cf31718361d6d1885340e"/><file name="Adfab_Emailcampaign_WishlistReminder.csv" hash="bd615da4bfcf92fe312bcb366d5a3baf"/><file name="Adfab_Emailcampaign_WishlistStockAlert.csv" hash="8dc3196198e9cc0b9e10d9ce79a2dabb"/></dir><dir name="template"><dir name="email"><dir name="emailcampaign"><file name="abandoned_cart.html" hash="e1da3bd3c8898e66fa86ed2c7f25f0a1"/><file name="customer_birthday.html" hash="1c8700144a93f2f0f51f65b7c2b9cea5"/><file name="inscription_anniversary.html" hash="1063b67ad73a35e761b2152ea2b227ac"/><file name="nursing.html" hash="41a55fb6d2d2bec03a1bd314413690c4"/><file name="offer_after_order.html" hash="a0d867e25f6ce96d69e58ad1652c59ee"/><file name="order_success.html" hash="27f50eb0f7dc590b1a775aed6232f24c"/><file name="welcome_reminder.html" hash="a7efe6d290216c92cfbb488de88408de"/><file name="wishlist_reminder.html" hash="d3ea8b42d506b81e88e96e24cf396ad4"/><file name="wishlist_stock_alert.html" hash="fe75dc922b483433db7d646c973a2432"/></dir></dir></dir></dir><dir name="fr_FR"><dir name="emailcampaign"><file name="Adfab_Emailcampaign.csv" hash="c3f256168b0b52d66ac19c8716c05485"/><file name="Adfab_Emailcampaign_AbandonedCart.csv" hash="962c2f9b0b13302b5c910bd776a0e177"/><file name="Adfab_Emailcampaign_CustomerBirthday.csv" hash="789b307d91ed3df3722ebf47ba88e3ce"/><file name="Adfab_Emailcampaign_InscriptionAnniversary.csv" hash="32314f7b43a6431890c196f7ac0b9dea"/><file name="Adfab_Emailcampaign_Nursing.csv" hash="a94b29f96a3fa3dfb1726fef5323b499"/><file name="Adfab_Emailcampaign_OfferAfterOrder.csv" hash="8740702c850b23dceb1403645ce67c46"/><file name="Adfab_Emailcampaign_OrderSuccess.csv" hash="6b1cd6e24298331c4a3e317e24695d1c"/><file name="Adfab_Emailcampaign_WelcomeReminder.csv" hash="de057c50c853f81ed0f2bc10a7565f6a"/><file name="Adfab_Emailcampaign_WishlistReminder.csv" hash="f4071c638993793d001d6902d1cbca44"/><file name="Adfab_Emailcampaign_WishlistStockAlert.csv" hash="a6cb9f4041c03fe2565393fbf132df32"/></dir><dir name="template"><dir name="email"><dir name="emailcampaign"><file name="abandoned_cart.html" hash="9c07490d6d2c48e373c41e21bc5faf6b"/><file name="customer_birthday.html" hash="2c63c5a9d9551c7f5c09637d98725ccf"/><file name="inscription_anniversary.html" hash="d7742a3632fda1d2a7af02ada64316ee"/><file name="nursing.html" hash="74e4745914d0db37f7b00b1bda79c42d"/><file name="offer_after_order.html" hash="e6ba7a221a5268b7befd6f25482e8723"/><file name="order_success.html" hash="27f50eb0f7dc590b1a775aed6232f24c"/><file name="welcome_reminder.html" hash="11878a468f48e52ab9b8bcdf1c7a80eb"/><file name="wishlist_reminder.html" hash="bdd9b11d9b453bca83fe2e7116b385f7"/><file name="wishlist_stock_alert.html" hash="67495578ab15182417fd9088daab4dd3"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery.min.js" hash="19cc2d381510a7f54d17d4f363db76d2"/><file name="jquery-cron.min.js" hash="7102f517bb2ffb5d6d5f4d9f4ccb5a1e"/></dir></dir></target></contents>
39
  <compatible/>
40
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
41
  </package>