EmailDirect_Integration - Version 1.5.1

Version Notes

Bug Fixes

Download this release

Release Info

Developer Magento Core Team
Extension EmailDirect_Integration
Version 1.5.1
Comparing to
See all releases


Code changes from version 1.5.0 to 1.5.1

Files changed (19) hide show
  1. app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php +110 -89
  2. app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Addressmapfields.php +1 -1
  3. app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Common.php +6 -3
  4. app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Mapfields.php +1 -1
  5. app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Shippingmapfields.php +1 -1
  6. app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Troubleshooting.php +8 -2
  7. app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting.php +0 -96
  8. app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php +0 -1
  9. app/code/local/EmailDirect/Integration/Helper/Data.php +36 -18
  10. app/code/local/EmailDirect/Integration/Helper/Fields.php +8 -1
  11. app/code/local/EmailDirect/Integration/Model/Observer.php +458 -360
  12. app/code/local/EmailDirect/Integration/Model/Wrapper/Execute.php +15 -10
  13. app/code/local/EmailDirect/Integration/controllers/Admin/AbandonedController.php +2 -1
  14. app/code/local/EmailDirect/Integration/controllers/Admin/ExportController.php +0 -9
  15. app/code/local/EmailDirect/Integration/controllers/ExportController.php +11 -0
  16. app/code/local/EmailDirect/Integration/etc/config.xml +8 -8
  17. app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/trouble.phtml +1 -1
  18. app/design/frontend/base/default/layout/emaildirect.xml +2 -2
  19. package.xml +5 -18
app/code/local/EmailDirect/Integration/Block/Adminhtml/Abandoned/Grid.php CHANGED
@@ -4,9 +4,14 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
4
  {
5
 
6
  /**
7
- * ids of current stores
8
- */
9
- protected $_storeIds = array();
 
 
 
 
 
10
 
11
  public function __construct()
12
  {
@@ -21,11 +26,27 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
21
  }
22
 
23
  /**
24
- * storeIds setter
25
- *
26
- * @param array $storeIds
27
- * @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
28
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  public function setStoreIds($storeIds)
30
  {
31
  $this->_storeIds = $storeIds;
@@ -34,13 +55,13 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
34
 
35
  private function prepareForAbandonedReport($storeIds, $filter = null)
36
  {
37
- $collection = $this->getCollection();
38
 
39
  $collection->addFieldToFilter('items_count', array('neq' => '0'))
40
- ->addFieldToFilter('main_table.is_active', '1')
41
- ->addSubtotal($storeIds, $filter)
42
  ->addFieldToFilter('customer_email',array('notnull'=>1))
43
- ->setOrder('updated_at');
44
  if (is_array($storeIds) && !empty($storeIds))
45
  {
46
  $collection->addFieldToFilter('store_id', array('in' => $storeIds));
@@ -65,10 +86,10 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
65
  $this->setCollection($collection);
66
 
67
  if (!empty($data))
68
- $this->prepareForAbandonedReport($this->_storeIds, $data);
69
  else
70
- $this->prepareForAbandonedReport($this->_storeIds);
71
-
72
  return parent::_prepareCollection();
73
  }
74
 
@@ -103,26 +124,26 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
103
  return $options;
104
  }
105
 
106
- protected function _prepareColumns()
107
- {
108
  $this->addColumn('customer_firstname', array(
109
- 'header' =>Mage::helper('reports')->__('Customer First Name'),
110
- 'index' =>'customer_firstname'
111
  ));
112
 
113
  $this->addColumn('customer_lastname', array(
114
- 'header' =>Mage::helper('reports')->__('Last Name'),
115
- 'index' =>'customer_lastname'
116
- ));
117
 
118
  $this->addColumn('email', array(
119
- 'header' =>Mage::helper('reports')->__('Email'),
120
- 'index' =>'customer_email'
121
- ));
122
 
123
  $this->addColumn('customer_group_id', array(
124
- 'header' => Mage::helper('sales')->__('Customer Group'),
125
- 'index' => 'customer_group_id',
126
  //'filter_index' => 'IFNULL(cust.group_id,0)',
127
  'type' => 'options',
128
  'width' => 200,
@@ -130,20 +151,20 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
130
  ));
131
 
132
  $this->addColumn('items_count', array(
133
- 'header' =>Mage::helper('reports')->__('Number of Items'),
134
- 'width' =>'80px',
135
- 'align' =>'right',
136
- 'index' =>'items_count',
137
- 'type' =>'number'
138
- ));
139
 
140
  $this->addColumn('items_qty', array(
141
- 'header' =>Mage::helper('reports')->__('Quantity of Items'),
142
- 'width' =>'80px',
143
- 'align' =>'right',
144
- 'index' =>'items_qty',
145
- 'type' =>'number'
146
- ));
147
 
148
  if ($this->getRequest()->getParam('website'))
149
  $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
@@ -158,75 +179,75 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
158
  $currencyCode = $this->getCurrentCurrencyCode();
159
 
160
  $this->addColumn('subtotal', array(
161
- 'header' => Mage::helper('reports')->__('Subtotal'),
162
- 'width' => '80px',
163
- 'type' => 'currency',
164
- 'currency_code' => $currencyCode,
165
- 'index' => 'subtotal',
166
- 'renderer' => 'adminhtml/report_grid_column_renderer_currency',
167
- 'rate' => $this->getRate($currencyCode),
168
- ));
169
 
170
  $this->addColumn('updated_at', array(
171
- 'header' =>Mage::helper('reports')->__('Abandoned Date'),
172
- 'width' =>'170px',
173
- 'type' =>'datetime',
174
- 'index' =>'updated_at',
175
- 'filter_index'=>'main_table.updated_at'
176
- ));
177
 
178
  $this->addColumn('abandoned_minutes', array(
179
- 'header' =>Mage::helper('reports')->__('Minutes'),
180
- 'width' =>'100px',
181
- 'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes',
182
- 'index' =>'abandoned_minutes',
183
- 'sortable' => false,
184
- 'filter' => false,
185
- 'filter_index'=>'main_table.updated_at'
186
-
187
- ));
188
 
189
  $this->addColumn('remote_ip', array(
190
- 'header' =>Mage::helper('reports')->__('IP Address'),
191
- 'width' =>'80px',
192
- 'index' =>'remote_ip'
193
- ));
194
 
195
  $this->addColumn('emaildirect_abandoned_date', array(
196
- 'header' =>Mage::helper('reports')->__('Date Sent to EmailDirect'),
197
- //'width' =>'80px',
198
- 'index' =>'emaildirect_abandoned_date',
199
- 'type' => 'datetime',
200
-
201
- ));
202
 
203
  if (Mage::helper('emaildirect')->getAbandonedEnabled())
204
  {
205
 
206
  $this->addColumn('action',
207
  array(
208
- 'header' => Mage::helper('emaildirect')->__('Action'),
209
- 'width' => '100',
210
- 'type' => 'action',
211
- 'getter' => 'getId',
212
  'actions' => array(
213
  array(
214
  'caption' => Mage::helper('emaildirect')->__('Send'),
215
- 'url' => array('base'=> '*/*/send'),
216
- 'field' => 'id',
217
  'sent' => false
218
  ),
219
  array(
220
  'caption' => Mage::helper('emaildirect')->__('Resend'),
221
- 'url' => array('base'=> '*/*/send'),
222
- 'field' => 'id',
223
  'sent' => true
224
  )
225
  ),
226
- 'filter' => false,
227
  'sortable' => false,
228
  'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action',
229
- 'index' => 'stores',
230
  'is_system' => true,
231
  ));
232
  }
@@ -236,7 +257,7 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
236
 
237
  return parent::_prepareColumns();
238
  }
239
-
240
  protected function _prepareMassaction()
241
  {
242
  if (!Mage::helper('emaildirect')->getAbandonedEnabled())
@@ -246,16 +267,16 @@ class Emaildirect_Integration_Block_Adminhtml_Abandoned_Grid extends Mage_Adminh
246
  $this->getMassactionBlock()->setFormFieldName('id');
247
 
248
  $this->getMassactionBlock()->addItem('send', array(
249
- 'label' => Mage::helper('emaildirect')->__('Send or Resend'),
250
- 'url' => $this->getUrl('*/*/massSend')
251
- ));
252
 
253
  return $this;
254
- }
255
-
256
  public function getGridUrl()
257
  {
258
- return $this->getUrl('*/*/grid', array('_current'=> true));
259
  }
260
 
261
  public function getRowUrl($row)
4
  {
5
 
6
  /**
7
+ * ids of current stores
8
+ */
9
+ protected $_storeIds = array();
10
+
11
+ /**
12
+ * stores current currency code
13
+ */
14
+ protected $_currentCurrencyCode = null;
15
 
16
  public function __construct()
17
  {
26
  }
27
 
28
  /**
29
+ * Retrieve currency code based on selected store
30
+ *
31
+ * @return string
32
+ */
33
+ public function getCurrentCurrencyCode()
34
+ {
35
+ if (is_null($this->_currentCurrencyCode)) {
36
+ reset($this->_storeIds);
37
+ $this->_currentCurrencyCode = (count($this->_storeIds) > 0)
38
+ ? Mage::app()->getStore(current($this->_storeIds))->getBaseCurrencyCode()
39
+ : Mage::app()->getStore()->getBaseCurrencyCode();
40
+ }
41
+ return $this->_currentCurrencyCode;
42
+ }
43
+
44
+ /**
45
+ * storeIds setter
46
+ *
47
+ * @param array $storeIds
48
+ * @return Mage_Adminhtml_Block_Report_Grid_Shopcart_Abstract
49
+ */
50
  public function setStoreIds($storeIds)
51
  {
52
  $this->_storeIds = $storeIds;
55
 
56
  private function prepareForAbandonedReport($storeIds, $filter = null)
57
  {
58
+ $collection = $this->getCollection();
59
 
60
  $collection->addFieldToFilter('items_count', array('neq' => '0'))
61
+ ->addFieldToFilter('main_table.is_active', '1')
62
+ ->addSubtotal($storeIds, $filter)
63
  ->addFieldToFilter('customer_email',array('notnull'=>1))
64
+ ->setOrder('updated_at');
65
  if (is_array($storeIds) && !empty($storeIds))
66
  {
67
  $collection->addFieldToFilter('store_id', array('in' => $storeIds));
86
  $this->setCollection($collection);
87
 
88
  if (!empty($data))
89
+ $this->prepareForAbandonedReport($this->_storeIds, $data);
90
  else
91
+ $this->prepareForAbandonedReport($this->_storeIds);
92
+
93
  return parent::_prepareCollection();
94
  }
95
 
124
  return $options;
125
  }
126
 
127
+ protected function _prepareColumns()
128
+ {
129
  $this->addColumn('customer_firstname', array(
130
+ 'header' =>Mage::helper('reports')->__('Customer First Name'),
131
+ 'index' =>'customer_firstname'
132
  ));
133
 
134
  $this->addColumn('customer_lastname', array(
135
+ 'header' =>Mage::helper('reports')->__('Last Name'),
136
+ 'index' =>'customer_lastname'
137
+ ));
138
 
139
  $this->addColumn('email', array(
140
+ 'header' =>Mage::helper('reports')->__('Email'),
141
+ 'index' =>'customer_email'
142
+ ));
143
 
144
  $this->addColumn('customer_group_id', array(
145
+ 'header' => Mage::helper('sales')->__('Customer Group'),
146
+ 'index' => 'customer_group_id',
147
  //'filter_index' => 'IFNULL(cust.group_id,0)',
148
  'type' => 'options',
149
  'width' => 200,
151
  ));
152
 
153
  $this->addColumn('items_count', array(
154
+ 'header' =>Mage::helper('reports')->__('Number of Items'),
155
+ 'width' =>'80px',
156
+ 'align' =>'right',
157
+ 'index' =>'items_count',
158
+ 'type' =>'number'
159
+ ));
160
 
161
  $this->addColumn('items_qty', array(
162
+ 'header' =>Mage::helper('reports')->__('Quantity of Items'),
163
+ 'width' =>'80px',
164
+ 'align' =>'right',
165
+ 'index' =>'items_qty',
166
+ 'type' =>'number'
167
+ ));
168
 
169
  if ($this->getRequest()->getParam('website'))
170
  $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
179
  $currencyCode = $this->getCurrentCurrencyCode();
180
 
181
  $this->addColumn('subtotal', array(
182
+ 'header' => Mage::helper('reports')->__('Subtotal'),
183
+ 'width' => '80px',
184
+ 'type' => 'currency',
185
+ 'currency_code' => $currencyCode,
186
+ 'index' => 'subtotal',
187
+ 'renderer' => 'adminhtml/report_grid_column_renderer_currency',
188
+ 'rate' => $this->getRate($currencyCode),
189
+ ));
190
 
191
  $this->addColumn('updated_at', array(
192
+ 'header' =>Mage::helper('reports')->__('Abandoned Date'),
193
+ 'width' =>'170px',
194
+ 'type' =>'datetime',
195
+ 'index' =>'updated_at',
196
+ 'filter_index'=>'main_table.updated_at'
197
+ ));
198
 
199
  $this->addColumn('abandoned_minutes', array(
200
+ 'header' =>Mage::helper('reports')->__('Minutes'),
201
+ 'width' =>'100px',
202
+ 'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_AbandonedMinutes',
203
+ 'index' =>'abandoned_minutes',
204
+ 'sortable' => false,
205
+ 'filter' => false,
206
+ 'filter_index'=>'main_table.updated_at'
207
+
208
+ ));
209
 
210
  $this->addColumn('remote_ip', array(
211
+ 'header' =>Mage::helper('reports')->__('IP Address'),
212
+ 'width' =>'80px',
213
+ 'index' =>'remote_ip'
214
+ ));
215
 
216
  $this->addColumn('emaildirect_abandoned_date', array(
217
+ 'header' =>Mage::helper('reports')->__('Date Sent to EmailDirect'),
218
+ //'width' =>'80px',
219
+ 'index' =>'emaildirect_abandoned_date',
220
+ 'type' => 'datetime',
221
+
222
+ ));
223
 
224
  if (Mage::helper('emaildirect')->getAbandonedEnabled())
225
  {
226
 
227
  $this->addColumn('action',
228
  array(
229
+ 'header' => Mage::helper('emaildirect')->__('Action'),
230
+ 'width' => '100',
231
+ 'type' => 'action',
232
+ 'getter' => 'getId',
233
  'actions' => array(
234
  array(
235
  'caption' => Mage::helper('emaildirect')->__('Send'),
236
+ 'url' => array('base'=> '*/*/send'),
237
+ 'field' => 'id',
238
  'sent' => false
239
  ),
240
  array(
241
  'caption' => Mage::helper('emaildirect')->__('Resend'),
242
+ 'url' => array('base'=> '*/*/send'),
243
+ 'field' => 'id',
244
  'sent' => true
245
  )
246
  ),
247
+ 'filter' => false,
248
  'sortable' => false,
249
  'renderer' => 'EmailDirect_Integration_Block_Widget_Grid_Column_Renderer_Action',
250
+ 'index' => 'stores',
251
  'is_system' => true,
252
  ));
253
  }
257
 
258
  return parent::_prepareColumns();
259
  }
260
+
261
  protected function _prepareMassaction()
262
  {
263
  if (!Mage::helper('emaildirect')->getAbandonedEnabled())
267
  $this->getMassactionBlock()->setFormFieldName('id');
268
 
269
  $this->getMassactionBlock()->addItem('send', array(
270
+ 'label' => Mage::helper('emaildirect')->__('Send or Resend'),
271
+ 'url' => $this->getUrl('*/*/massSend')
272
+ ));
273
 
274
  return $this;
275
+ }
276
+
277
  public function getGridUrl()
278
  {
279
+ return $this->getUrl('*/*/grid', array('_current'=> true));
280
  }
281
 
282
  public function getRowUrl($row)
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Addressmapfields.php CHANGED
@@ -9,7 +9,7 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Addressma
9
  'style' => 'width:120px',
10
  ));
11
  $this->addColumn('emaildirect', array(
12
- 'label' => Mage::helper('emaildirect')->__('Emaildirect'),
13
  'type' => 'options',
14
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
15
  'style' => 'width:120px',
9
  'style' => 'width:120px',
10
  ));
11
  $this->addColumn('emaildirect', array(
12
+ 'label' => Mage::helper('emaildirect')->__('EmailDirect'),
13
  'type' => 'options',
14
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
15
  'style' => 'width:120px',
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Common.php CHANGED
@@ -25,7 +25,7 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common ex
25
  'style' => empty($params['style']) ? null : $params['style'],
26
  'class' => empty($params['class']) ? null : $params['class'],
27
  'type' => empty($params['type']) ? null : $params['type'],
28
- 'options' => empty($params['options']) ? null : $params['options'],
29
  'renderer' => false,
30
  );
31
  if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
@@ -47,7 +47,8 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common ex
47
  $column = $this->_columns[$columnName];
48
  $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
49
 
50
- if ($column['renderer']) {
 
51
  return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
52
  ->toHtml();
53
  }
@@ -59,7 +60,9 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Common ex
59
  (isset($column['class']) ? $column['class'] : 'input-text') . '"'.
60
  (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '>';
61
  //$value = $row->getData($this->getColumn()->getIndex());
62
- foreach ($column['options'] as $val => $label){
 
 
63
  //$selected = ( ($val == $value && (!is_null($value))) ? ' selected="selected"' : '' );
64
  $html .= '<option #{_selected_' . $this->escapeHtml($val) . '} value="' . $this->escapeHtml($val) . '">';
65
  $html .= $this->escapeHtml($label) . '</option>';
25
  'style' => empty($params['style']) ? null : $params['style'],
26
  'class' => empty($params['class']) ? null : $params['class'],
27
  'type' => empty($params['type']) ? null : $params['type'],
28
+ 'options' => empty($params['options']) ? array() : $params['options'],
29
  'renderer' => false,
30
  );
31
  if ((!empty($params['renderer'])) && ($params['renderer'] instanceof Mage_Core_Block_Abstract)) {
47
  $column = $this->_columns[$columnName];
48
  $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
49
 
50
+ if ($column['renderer'])
51
+ {
52
  return $column['renderer']->setInputName($inputName)->setColumnName($columnName)->setColumn($column)
53
  ->toHtml();
54
  }
60
  (isset($column['class']) ? $column['class'] : 'input-text') . '"'.
61
  (isset($column['style']) ? ' style="'.$column['style'] . '"' : '') . '>';
62
  //$value = $row->getData($this->getColumn()->getIndex());
63
+
64
+ foreach ($column['options'] as $val => $label)
65
+ {
66
  //$selected = ( ($val == $value && (!is_null($value))) ? ' selected="selected"' : '' );
67
  $html .= '<option #{_selected_' . $this->escapeHtml($val) . '} value="' . $this->escapeHtml($val) . '">';
68
  $html .= $this->escapeHtml($label) . '</option>';
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Mapfields.php CHANGED
@@ -9,7 +9,7 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Mapfields
9
  'style' => 'width:120px',
10
  ));
11
  $this->addColumn('emaildirect', array(
12
- 'label' => Mage::helper('emaildirect')->__('Emaildirect'),
13
  'style' => 'width:120px',
14
  'type' => 'options',
15
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
9
  'style' => 'width:120px',
10
  ));
11
  $this->addColumn('emaildirect', array(
12
+ 'label' => Mage::helper('emaildirect')->__('EmailDirect'),
13
  'style' => 'width:120px',
14
  'type' => 'options',
15
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Shippingmapfields.php CHANGED
@@ -12,7 +12,7 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Shippingm
12
  'style' => 'width:120px',
13
  ));
14
  $this->addColumn('emaildirect', array(
15
- 'label' => Mage::helper('emaildirect')->__('Emaildirect'),
16
  'type' => 'options',
17
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
18
  'style' => 'width:120px',
12
  'style' => 'width:120px',
13
  ));
14
  $this->addColumn('emaildirect', array(
15
+ 'label' => Mage::helper('emaildirect')->__('EmailDirect'),
16
  'type' => 'options',
17
  'options' => Mage::helper('emaildirect')->getEmailDirectColumnOptions(),
18
  'style' => 'width:120px',
app/code/local/EmailDirect/Integration/Block/Adminhtml/System/Config/Form/Field/Troubleshooting.php CHANGED
@@ -83,10 +83,16 @@ class EmailDirect_Integration_Block_Adminhtml_System_Config_Form_Field_Troublesh
83
 
84
  $file_date = $helper->getLogFilelastUpdate();
85
 
86
- $last_update = $date = Mage::helper('core')->formatTime(date("Y-m-d H:i:s",$file_date), 'long', true);
 
 
 
87
 
88
  $ago = $helper->timeElapsed2string($file_date);
89
 
90
- return "emaildirect.log ({$formatted_size})<br />{$last_update}<br />({$ago} ago.)";
 
 
 
91
  }
92
  }
83
 
84
  $file_date = $helper->getLogFilelastUpdate();
85
 
86
+ if ($file_date == "")
87
+ $last_update = "";
88
+ else
89
+ $last_update = "<br />" . Mage::helper('core')->formatTime(date("Y-m-d H:i:s",$file_date), 'long', true);
90
 
91
  $ago = $helper->timeElapsed2string($file_date);
92
 
93
+ if ($ago != "")
94
+ $ago = "<br />({$ago} ago.)";
95
+
96
+ return "emaildirect.log ({$formatted_size}){$last_update}{$ago}";
97
  }
98
  }
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
-
3
- class Emaildirect_Integration_Block_Adminhtml_Troubleshooting extends Mage_Adminhtml_Block_Template
4
- implements Mage_Adminhtml_Block_Widget_Tab_Interface
5
- {
6
- /**
7
- * ######################## TAB settings #################################
8
- */
9
- public function getTabLabel()
10
- {
11
- return Mage::helper('sales')->__('Test1');
12
- }
13
-
14
- public function getTabTitle()
15
- {
16
- return Mage::helper('sales')->__('Test2');
17
- }
18
-
19
- public function canShowTab()
20
- {
21
- return true;
22
- }
23
-
24
- public function isHidden()
25
- {
26
- return false;
27
- }
28
-
29
- public function __construct()
30
- {
31
- parent::__construct();
32
- $this->setTemplate('emaildirect/troubleshooting/details.phtml');
33
- }
34
-
35
- private function getArrayData($data)
36
- {
37
- $output = "<table width='100%'><tr><th>Magento</th><th>EmailDirect</th></tr>";
38
- foreach ($data as $row)
39
- {
40
- $output .= "<tr><td>{$row['magento']}</td><td>{$row['emaildirect']}</td></tr>";
41
-
42
- }
43
-
44
- $output .= "</table>";
45
-
46
- return $output;
47
- }
48
-
49
- public function getEnvironmentInfo()
50
- {
51
- $data = array(
52
- 'Magento Version' => Mage::getVersion(),
53
- 'Magento Edition' => Mage::getEdition(),
54
- 'EmailDirect Version' => (string) Mage::getConfig()->getNode('modules/EmailDirect_Integration/version'),
55
- 'Website URL' => Mage::getBaseUrl(),
56
- 'PHP Version' => phpversion(),
57
- 'Server Software' => $_SERVER['SERVER_SOFTWARE']
58
-
59
- );
60
- return $data;
61
- }
62
-
63
- public function getConfigurationInfo()
64
- {
65
- $data = array();
66
-
67
- $store = Mage::app()->getStore();
68
-
69
- $e_config = Mage::getStoreConfig("emaildirect/general", $store);
70
-
71
- foreach ($e_config as $key => $value)
72
- {
73
- if (is_array($value))
74
- {
75
- // Ignore for now
76
- }
77
- else
78
- {
79
- $test_data = @unserialize($value);
80
- if ($test_data !== false)
81
- $data[$key] = $this->getArrayData($test_data);
82
- else
83
- $data[$key] = $value;;
84
- }
85
- }
86
-
87
- return $data;
88
- }
89
-
90
- public function getLogFile()
91
- {
92
- $log_file = Mage::getBaseDir('log') . DS. "emaildirect.log";
93
-
94
- return file_get_contents($log_file);
95
- }
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/EmailDirect/Integration/Block/Adminhtml/Troubleshooting/View.php CHANGED
@@ -36,7 +36,6 @@ class EmailDirect_Integration_Block_Adminhtml_Troubleshooting_View extends Mage_
36
 
37
  public function getUrl($params='', $params2=array())
38
  {
39
- //$params2['order_id'] = $this->getOrderId();
40
  return parent::getUrl($params, $params2);
41
  }
42
 
36
 
37
  public function getUrl($params='', $params2=array())
38
  {
 
39
  return parent::getUrl($params, $params2);
40
  }
41
 
app/code/local/EmailDirect/Integration/Helper/Data.php CHANGED
@@ -17,6 +17,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
17
 
18
  public function formatSize($size)
19
  {
 
 
 
20
  $unit=array('b','kb','mb','gb','tb','pb');
21
  return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
22
  }
@@ -100,19 +103,28 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
100
  public function getEmailDirectColumnOptions()
101
  {
102
  $columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
103
-
 
 
 
 
 
 
 
 
 
104
  $options = array();
105
 
106
  foreach ($columns as $column)
107
  {
108
- if ($column->IsCustom == 'true')
109
  {
110
  $key = (string)$column->ColumnName;
111
 
112
  $options[$key] = $key;
113
  }
114
  }
115
-
116
  return $options;
117
  }
118
 
@@ -128,21 +140,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
128
  return $options;
129
  }
130
 
131
- public function getDefaultList($storeId)
132
- {
133
- $curstore = Mage::app()->getStore();
134
- Mage::app()->setCurrentStore($storeId);
135
- $list = $this->config('list', $storeId);
136
- Mage::app()->setCurrentStore($curstore);
137
- return $list;
138
- }
139
  public function getDefaultPublication($storeId)
140
  {
141
- $curstore = Mage::app()->getStore();
142
- Mage::app()->setCurrentStore($storeId);
143
- $publication = $this->config('publication', $storeId);
144
- Mage::app()->setCurrentStore($curstore);
145
- return $publication;
146
  }
147
 
148
  public function getMergeVars($customer, $includeEmail = FALSE)
@@ -582,7 +582,10 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
582
  {
583
  $log_file = $this->getLogFilePath();
584
 
585
- return filesize($log_file);
 
 
 
586
  }
587
 
588
  public function getLogFilelastUpdate()
@@ -641,6 +644,11 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
641
  $list_count = 0;
642
  $publication_subscribed = false;
643
 
 
 
 
 
 
644
  foreach($properties->Publications->Publication as $publication)
645
  {
646
  if ((int) $publication->PublicationID == $data['publication']['id'])
@@ -663,6 +671,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
663
  return $data;
664
  }
665
 
 
 
 
666
  foreach($properties->Lists->List as $list)
667
  {
668
  $list_id = (int)$list->ListID;
@@ -721,7 +732,9 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
721
  {
722
  $data = array(
723
  'publication' => $this->getPublication(),
724
- 'lists' => $this->getLists()
 
 
725
  );
726
 
727
  $data = $this->getSubscriberData($data, $email);
@@ -758,6 +771,11 @@ class EmailDirect_Integration_Helper_Data extends Mage_Core_Helper_Abstract
758
  $this->log($data,self::DISABLED_REASON_PREFIX, $area);
759
  }
760
 
 
 
 
 
 
761
  public function setLogArea($area)
762
  {
763
  $this->_log_area = $area;
17
 
18
  public function formatSize($size)
19
  {
20
+ if ($size == 0 || $size == null || $size = "")
21
+ return "0b";
22
+
23
  $unit=array('b','kb','mb','gb','tb','pb');
24
  return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
25
  }
103
  public function getEmailDirectColumnOptions()
104
  {
105
  $columns = Mage::getSingleton('emaildirect/wrapper_database')->getAllColumns();
106
+
107
+ $custom_fields = Mage::helper('emaildirect/fields')->getCustomFields(true);
108
+
109
+ $invalid_columns = array();
110
+
111
+ foreach ($custom_fields as $cf)
112
+ {
113
+ $invalid_columns[] = $cf['name'];
114
+ }
115
+
116
  $options = array();
117
 
118
  foreach ($columns as $column)
119
  {
120
+ if ($column->IsCustom == 'true' && !in_array((string)$column->ColumnName,$invalid_columns))
121
  {
122
  $key = (string)$column->ColumnName;
123
 
124
  $options[$key] = $key;
125
  }
126
  }
127
+
128
  return $options;
129
  }
130
 
140
  return $options;
141
  }
142
 
 
 
 
 
 
 
 
 
143
  public function getDefaultPublication($storeId)
144
  {
145
+ return $this->config('publication', $storeId);
 
 
 
 
146
  }
147
 
148
  public function getMergeVars($customer, $includeEmail = FALSE)
582
  {
583
  $log_file = $this->getLogFilePath();
584
 
585
+ if (file_exists($log_file))
586
+ return filesize($log_file);
587
+
588
+ return 0;
589
  }
590
 
591
  public function getLogFilelastUpdate()
644
  $list_count = 0;
645
  $publication_subscribed = false;
646
 
647
+ //CHECK THAT THERE ARE PUBLICATIONS?
648
+
649
+ if (!isset($properties->Publications->Publication))
650
+ return $data;
651
+
652
  foreach($properties->Publications->Publication as $publication)
653
  {
654
  if ((int) $publication->PublicationID == $data['publication']['id'])
671
  return $data;
672
  }
673
 
674
+ if (!isset($properties->Lists->List))
675
+ return $data;
676
+
677
  foreach($properties->Lists->List as $list)
678
  {
679
  $list_id = (int)$list->ListID;
732
  {
733
  $data = array(
734
  'publication' => $this->getPublication(),
735
+ 'lists' => $this->getLists(),
736
+ 'count' => 0,
737
+ 'list_count' => 0
738
  );
739
 
740
  $data = $this->getSubscriberData($data, $email);
771
  $this->log($data,self::DISABLED_REASON_PREFIX, $area);
772
  }
773
 
774
+ public function logException($e, $area = "")
775
+ {
776
+ $this->log($e->__toString(),"Exception", $area);
777
+ }
778
+
779
  public function setLogArea($area)
780
  {
781
  $this->_log_area = $area;
app/code/local/EmailDirect/Integration/Helper/Fields.php CHANGED
@@ -96,7 +96,7 @@ class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
96
  return $missing;
97
  }
98
 
99
- public function verifyFields($force_product = false)
100
  {
101
  $fields = array();
102
 
@@ -124,6 +124,13 @@ class EmailDirect_Integration_Helper_Fields extends Mage_Core_Helper_Abstract
124
 
125
  $fields = $this->getMultiFields($fields,"AB");
126
 
 
 
 
 
 
 
 
127
  $missing = $this->getMissingColumns($fields);
128
 
129
  if (count($missing) > 0)
96
  return $missing;
97
  }
98
 
99
+ public function getCustomFields($force_product = false)
100
  {
101
  $fields = array();
102
 
124
 
125
  $fields = $this->getMultiFields($fields,"AB");
126
 
127
+ return $fields;
128
+ }
129
+
130
+ public function verifyFields($force_product = false)
131
+ {
132
+ $fields = $this->getCustomFields($force_product);
133
+
134
  $missing = $this->getMissingColumns($fields);
135
 
136
  if (count($missing) > 0)
app/code/local/EmailDirect/Integration/Model/Observer.php CHANGED
@@ -16,113 +16,129 @@ class EmailDirect_Integration_Model_Observer
16
  */
17
  public function handleSubscriber(Varien_Event_Observer $observer)
18
  {
19
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
20
- $this->_helper->log('handleSubscriber Start');
21
-
22
- if (!$this->_helper->canEdirect())
23
- {
24
- $this->_helper->logReason($this->_helper->getDisabledReason());
25
- return $observer;
26
- }
27
-
28
- $subscriber = $observer->getEvent()->getSubscriber();
29
- $subscriber->setImportMode(false);
30
-
31
- $email = $subscriber->getSubscriberEmail();
32
- $listId = $this->_helper->getDefaultPublication($subscriber->getStoreId());
33
- $isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
34
-
35
- //New subscriber, just add
36
- if( $subscriber->isObjectNew() )
37
  {
38
- $this->_helper->log("New Subscriber");
39
- if( TRUE === $isConfirmNeed )
 
 
40
  {
41
- $this->_helper->log("Confirmation Needed");
42
- $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
43
- if( !Mage::helper('customer')->isLoggedIn() && Mage::registry('ed_guest_customer'))
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  {
45
- $this->_helper->log("Guest Customer");
46
- $guestCustomer = Mage::registry('ed_guest_customer');
47
- $subscriber->setFirstname($guestCustomer->getFirstname());
48
- $subscriber->setLastname($guestCustomer->getLastname());
49
- Mage::unregister('ed_guest_customer');
50
- $subscriber->save();
 
 
 
 
 
 
 
51
  }
52
  else
53
- $this->_helper->log("Not a Guest Customer (Doing Nothing?)");
 
 
 
 
 
 
 
 
 
54
  }
55
  else
56
  {
57
- $this->_helper->log("Confirmation Not Required");
58
- $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
59
- $merge_vars = $this->_mergeVars($subscriber);
60
-
61
- $this->_helper->log($merge_vars,"Merge Vars");
62
-
63
- $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
64
- ->subscriberAdd($email,$merge_vars);
65
- }
66
- }
67
- else
68
- {
69
- $this->_helper->log("Existing Subscriber");
70
- $status = (int)$subscriber->getData('subscriber_status');
71
-
72
- $oldSubscriber = Mage::getModel('newsletter/subscriber')
73
- ->load($subscriber->getId());
74
- $oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
75
- if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
76
- {
77
- $this->_helper->log("Unconfirmed to Subscribed");
78
- $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
79
- $merge_vars = $this->_mergeVars($subscriber);
80
 
81
- $this->_helper->log($merge_vars,"Merge Vars");
82
- $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
83
- ->subscriberAdd($email,$merge_vars);
84
- }
85
- elseif( $status !== $oldstatus )
86
- {
87
- //Status change
88
- $this->_helper->log("Status Change");
89
-
90
- //Unsubscribe customer
91
- if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
92
  {
93
- $this->_helper->log("Unsubscribed");
94
- $rc = Mage::getSingleton('emaildirect/wrapper_publications')
95
- ->unsubscribe($listId, $email);
 
 
 
 
96
  }
97
- else if($status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
98
  {
99
- $this->_helper->log("Subscribed");
100
- if( $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE || $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED )
 
 
 
101
  {
102
- $this->_helper->log("Changing Status");
103
  $rc = Mage::getSingleton('emaildirect/wrapper_publications')
104
- ->subscribe($listId, $email);
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
- else
107
- $this->_helper->log("Status Not Changed");
108
  }
109
  }
 
 
 
 
 
 
110
  }
111
- $this->_helper->log('handleSubscriber End');
112
  }
113
 
114
  // Remove Unsubscribe option from Newsletter grid
115
  public function updateNewsletterMassAction($observer)
116
  {
117
- if (!$this->_helper->canEdirect())
118
- return $observer;
 
 
 
 
119
 
120
- $block = $observer->getEvent()->getBlock();
121
-
122
- if (get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
123
- && $block->getRequest()->getControllerName() == 'newsletter_subscriber')
 
 
 
124
  {
125
- $block->removeItem('unsubscribe');
 
126
  }
127
  }
128
 
@@ -132,23 +148,31 @@ class EmailDirect_Integration_Model_Observer
132
  */
133
  public function handleSubscriberDeletion(Varien_Event_Observer $observer)
134
  {
135
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
136
- $this->_helper->log("Handle Subscriber Deletion Start");
137
-
138
- if (!$this->_helper->canEdirect())
139
  {
140
- $this->_helper->logReason($this->_helper->getDisabledReason());
141
- return $observer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
-
144
- $subscriber = $observer->getEvent()->getSubscriber();
145
-
146
- $email = $subscriber->getSubscriberEmail();
147
-
148
- $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
149
- ->subscriberDelete($email);
150
-
151
- $this->_helper->log("Handle Subscriber Deletion End");
152
  }
153
 
154
  private function validateSource($source, $sources, $store)
@@ -213,6 +237,7 @@ class EmailDirect_Integration_Model_Observer
213
  if ($apiKey == '')
214
  {
215
  $this->_helper->updateConfig('setup', false, $store);
 
216
  return $observer;
217
  }
218
 
@@ -404,65 +429,81 @@ class EmailDirect_Integration_Model_Observer
404
 
405
  public function updateCustomer(Varien_Event_Observer $observer)
406
  {
407
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::CUSTOMER);
408
- $this->_helper->log("Update Customer Start");
409
-
410
- if (!$this->_helper->canEdirect())
411
- {
412
- $this->_helper->logReason($this->_helper->getDisabledReason());
413
- return $observer;
414
- }
415
-
416
- $store = Mage::app()->getStore()->getId();
417
- $customer = $observer->getEvent()->getCustomer();
418
-
419
- $merge_vars = $this->_mergeVars($customer, TRUE);
420
-
421
- $this->_helper->log($merge_vars,"Merge Vars");
422
-
423
- $api = Mage::getSingleton('emaildirect/wrapper_subscribers');
424
-
425
- $oldEmail = $customer->getOrigData('email');
426
- $email = $customer->getEmail();
427
-
428
- if ($oldEmail == '')
429
  {
430
- $this->_helper->log("Original Email was blank. Adding Subscriber");
431
- $rc = $api->subscriberAdd($email,$merge_vars);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  }
433
- elseif ($oldEmail != $email)
434
  {
435
- $this->_helper->log("Modifying Email");
436
- $rc = $api->mailModify($oldEmail,$email);
437
-
438
- $this->_helper->log("Adding Subscriber");
439
- $rc = $api->subscriberAdd($email,$merge_vars);
440
  }
441
- else
442
- $this->_helper->logReason("Email has not been changed");
443
-
444
- $this->_helper->log("Update Customer End");
445
 
446
  return $observer;
447
  }
448
 
449
  public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
450
  {
451
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
452
- $this->_helper->log("Register Checkout Subscribe Start");
453
- if(!$this->_helper->canEdirect())
454
  {
455
- $this->_helper->logReason($this->_helper->getDisabledReason());
456
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  }
458
- $subscribe = Mage::app()->getRequest()->getPost('emaildirect_subscribe');
459
-
460
- if(!is_null($subscribe))
461
  {
462
- Mage::getSingleton('core/session')->setEmaildirectCheckout($subscribe);
 
463
  }
464
-
465
- $this->_helper->log("Register Checkout Subscribe End");
466
  }
467
 
468
  /**
@@ -470,158 +511,182 @@ class EmailDirect_Integration_Model_Observer
470
  */
471
  public function registerCheckoutSuccess(Varien_Event_Observer $observer)
472
  {
473
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
474
- $this->_helper->log("Register Checkout Success Start");
475
- if(!$this->_helper->canEdirect())
476
- {
477
- $this->_helper->logReason($this->_helper->getDisabledReason());
478
- return;
479
- }
480
-
481
- $sessionFlag = Mage::getSingleton('core/session')->getEmaildirectCheckout(TRUE);
482
- if (!$sessionFlag)
483
- {
484
- $this->_helper->logReason("Session flag not found.");
485
- return;
486
- }
487
-
488
- $orderId = (int)current($observer->getEvent()->getOrderIds());
489
-
490
- if (!$orderId)
491
  {
492
- $this->_helper->logReason("Order ID not found.");
493
- return;
494
- }
 
 
 
 
495
 
496
- $order = Mage::getModel('sales/order')->load($orderId);
497
- if (!$order->getId())
498
- {
499
- $this->_helper->logReason("Failed to Load Order ({$orderId}).");
500
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
  }
502
-
503
- $this->_helper->log("Processing Order # " . $order->getIncrementId());
504
-
505
- //Guest Checkout
506
- if( (int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID )
507
  {
508
- $this->_helper->log("Guest Checkout");
509
- $this->_helper->registerGuestCustomer($order);
510
  }
511
-
512
- $rc = $subscriber = Mage::getModel('newsletter/subscriber')
513
- ->subscribe($order->getCustomerEmail());
514
-
515
- $this->_helper->log("Register Checkout Success End");
516
  }
517
 
518
  public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
519
  {
520
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ORDERS);
521
- $this->_helper->log("Sales Order Shipment Track Save After Start");
522
- if(!$this->_helper->canEdirect())
523
- {
524
- $this->_helper->logReason($this->_helper->getDisabledReason());
525
- return;
526
- }
527
- $track = $observer->getEvent()->getTrack();
528
-
529
- $order = $track->getShipment()->getOrder();
530
- $shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
531
- if (!$shippingMethod)
532
  {
533
- $this->_helper->logReason("Shipping Method not found");
534
- return $observer;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  }
536
-
537
- $email = $order->getCustomerEmail();
538
-
539
- $merge_vars = array();
540
-
541
- $merge_vars = $this->_helper->getTrackingMergeVars($track, $order);
542
-
543
- if ($merge_vars == null)
544
  {
545
- $this->_helper->logReason("No shipping fields setup");
546
- return $observer;
547
  }
548
-
549
- $this->_helper->log($merge_vars,"Merge Vars");
550
-
551
- $rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberTracking($email, $merge_vars);
552
-
553
- $this->_helper->log("Sales Order Shipment Track Save After Start");
554
-
555
- return $observer;
556
  }
557
 
558
  public function orderSaveAfter(Varien_Event_Observer $observer)
559
  {
560
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
561
- $this->_helper->log("Order Save After Start");
562
-
563
- if (!$this->_helper->getOrdersEnabled())
564
  {
565
- $this->_helper->logReason($this->_helper->getOrdersDisabledReason());
566
- return $observer;
567
- }
568
-
569
- $order = $observer->getEvent()->getOrder();
570
-
571
- $this->_helper->log("Order Save After: " . $order->getIncrementId());
572
- if($order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE)
573
- {
574
- $this->_helper->logReason("Order is not complete.");
575
- return $observer;
576
- }
577
-
578
- //$this->_helper->log("Order is complete. Processing...");
 
 
 
 
 
 
 
 
 
 
 
579
 
580
- $email = $order->getCustomerEmail();
581
-
582
- if ($order->getData('customer_is_guest'))
583
- {
584
- $this->_helper->log("Guest Customer");
 
 
 
 
 
 
 
 
 
 
 
 
 
585
 
586
- $customer = new Varien_Object;
587
-
588
- $customer->setData('email',$email);
589
- $customer->setData('firstname',$order->getData('customer_firstname'));
590
- $customer->setData('lastname',$order->getData('customer_lastname'));
591
- $customer->setData('store_id',$order->getStoreId());
592
-
593
- $customer->setBillingAddress($order->getBillingAddress());
594
- }
595
- else
596
- {
597
- $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
598
- $address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
599
- $customer->setBillingAddress($address);
600
- }
601
-
602
- $merge_vars = $this->_helper->getMergeVars($customer, true);
603
- $merge_vars = $this->_helper->getOrderMergeVars($merge_vars,$order);
604
-
605
- if ($this->_helper->config('save_latest_order'))
606
- {
607
- $this->_helper->log("Getting Latest Order Info");
608
- $merge_vars['LastOrderNumber'] = $order->getIncrementId();
609
- $merge_vars['LastPurchaseDate'] = $order->getData('created_at');
610
- $merge_vars['LastPurchaseTotal'] = Mage::helper('core')->currency($order->getData('total_paid'), true, false);
611
 
612
- $merge_vars = $this->getMergeOrderItems($order, $merge_vars);
613
- $merge_vars = $this->getRelatedOrderItems($order, $merge_vars);
 
 
 
 
 
 
614
  }
615
-
616
- $this->_helper->log($merge_vars, "Merge Vars");
617
-
618
- Mage::helper('emaildirect/fields')->checkFields();
619
-
620
- $rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberOrder($email,$order, $merge_vars);
621
-
622
- $this->_helper->log("Order Save After End");
623
-
624
- return $observer;
625
  }
626
 
627
  // START ABANDONED CRON
@@ -675,6 +740,7 @@ class EmailDirect_Integration_Model_Observer
675
  catch (Exception $e)
676
  {
677
  Mage::logException($e);
 
678
  }
679
  }
680
 
@@ -753,7 +819,7 @@ class EmailDirect_Integration_Model_Observer
753
  if (!$subscribers)
754
  {
755
  $this->_helper->logReason("No Carts Found");
756
- return $observer; // No abandoned carts found
757
  }
758
 
759
  $this->_helper->log("Sending Abandoned Carts");
@@ -763,84 +829,108 @@ class EmailDirect_Integration_Model_Observer
763
 
764
  public function abandonedStoreProcessor($store, $check_date)
765
  {
766
- $store_code = $store->getCode();
767
-
768
- $this->_helper->log("Processing Store: {$store_code}");
769
-
770
- if (!$this->_helper->getAbandonedEnabled())
771
  {
772
- $this->_helper->logReason($this->_helper->getAbandonedDisabledReason());
773
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
  }
775
-
776
- Mage::helper('emaildirect/fields')->checkFields();
777
-
778
- // Get abandoned collection
779
- $collection = Mage::getResourceModel('reports/quote_collection');
780
-
781
- $collection->addFieldToFilter('items_count', array('neq' => '0'))
782
- ->addFieldToFilter('main_table.is_active', '1')
783
- ->setOrder('updated_at');
784
-
785
- $collection->addFieldToFilter('main_table.updated_at', array('lt' => $check_date));
786
- $collection->addFieldToFilter('main_table.emaildirect_abandoned_date', array('null' => true));
787
- $collection->addFieldToFilter('main_table.emaildirect_abandoned_url', array('notnull' => true));
788
- $collection->addFieldToFilter('main_table.customer_email', array('notnull' => true));
789
-
790
- $collection->addFieldToFilter('store_id', array('eq' => $store->getId()));
791
-
792
- $this->_helper->log("SQL: " . $collection->getSelect()->__toString());
793
-
794
- $this->_abandonedCartsProcessor($collection);
795
-
796
- $this->_helper->log("Finished Processing Store: {$store_code}");
797
  }
798
 
799
  public function abandonedCartsProcessor()
800
  {
801
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
802
- $this->_helper->log("Abandoned Carts Processor Start");
803
-
804
- $check_date = $this->getAbandonedTime();
805
-
806
- $this->_helper->log("Check Date: {$check_date}");
807
-
808
- $stores = Mage::app()->getStores();
809
-
810
- $starting_store = Mage::app()->getStore()->getCode();
811
-
812
- foreach ($stores as $store)
813
- {
814
- Mage::app()->setCurrentStore($store->getCode());
815
 
816
- $this->abandonedStoreProcessor($store, $check_date);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
817
  }
818
-
819
- Mage::app()->setCurrentStore($starting_store);
820
-
821
- $this->_helper->log("Abandoned Carts Processor End");
822
  }
823
 
824
  public function SendAbandonedCarts($id_list)
825
  {
826
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
827
- $this->_helper->log("Sending Specific Abandoned Carts Start");
828
-
829
- Mage::helper('emaildirect/fields')->checkFields();
830
-
831
- $this->_helper->log($id_list, "ID LIST");
832
-
833
- // Get abandoned collection
834
- $collection = Mage::getResourceModel('reports/quote_collection');
835
-
836
- $collection->addFieldToFilter('entity_id', array('in' => $id_list))
837
- ->setOrder('updated_at');
838
-
839
- $this->_helper->log("SQL: " . $collection->getSelect()->__toString());
840
-
841
- $this->_abandonedCartsProcessor($collection, false);
842
-
843
- $this->_helper->log("Sending Specific Abandoned Carts End");
 
 
 
 
 
 
 
 
844
  }
845
  // END ABANDONED CRON
846
 
@@ -899,30 +989,38 @@ class EmailDirect_Integration_Model_Observer
899
 
900
  public function quoteSaveAfter(Varien_Event_Observer $observer)
901
  {
902
- $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
903
- $this->_helper->log("Quote Save After Start");
904
- $quote = $observer->getEvent()->getQuote();
905
-
906
- if (trim($quote->getEmaildirectAbandonedDate()))
907
- {
908
- $this->_helper->logReason("Already sent.");
909
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
911
-
912
- $url = $this->getAbandonedUrl($quote);
913
-
914
- $this->_helper->log("Abandoned Url: {$url}");
915
-
916
- if ($quote->getEmaildirectAbandonedUrl() == $url)
917
  {
918
- $this->_helper->logReason("Abandoned Url is up to date.");
919
- return;
920
  }
921
-
922
- $this->_helper->log("Saving Quote.");
923
- // Re-save quote with new URL
924
- $this->setAbandonedUrl($quote, $url);
925
- $this->_helper->log("Quote Save After End");
926
  }
927
  // END QUOTE SAVE AFTER
928
  }
16
  */
17
  public function handleSubscriber(Varien_Event_Observer $observer)
18
  {
19
+ try
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  {
21
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
22
+ $this->_helper->log('handleSubscriber Start');
23
+
24
+ if (!$this->_helper->canEdirect())
25
  {
26
+ $this->_helper->logReason($this->_helper->getDisabledReason());
27
+ return $observer;
28
+ }
29
+
30
+ $subscriber = $observer->getEvent()->getSubscriber();
31
+ $subscriber->setImportMode(false);
32
+
33
+ $email = $subscriber->getSubscriberEmail();
34
+ $listId = $this->_helper->getDefaultPublication($subscriber->getStoreId());
35
+ $isConfirmNeed = (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_CONFIRMATION_FLAG, $subscriber->getStoreId()) == 1) ? TRUE : FALSE;
36
+
37
+ //New subscriber, just add
38
+ if( $subscriber->isObjectNew() )
39
+ {
40
+ $this->_helper->log("New Subscriber");
41
+ if( TRUE === $isConfirmNeed )
42
  {
43
+ $this->_helper->log("Confirmation Needed");
44
+ $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED);
45
+ if( !Mage::helper('customer')->isLoggedIn() && Mage::registry('ed_guest_customer'))
46
+ {
47
+ $this->_helper->log("Guest Customer");
48
+ $guestCustomer = Mage::registry('ed_guest_customer');
49
+ $subscriber->setFirstname($guestCustomer->getFirstname());
50
+ $subscriber->setLastname($guestCustomer->getLastname());
51
+ Mage::unregister('ed_guest_customer');
52
+ $subscriber->save();
53
+ }
54
+ else
55
+ $this->_helper->log("Not a Guest Customer (Doing Nothing?)");
56
  }
57
  else
58
+ {
59
+ $this->_helper->log("Confirmation Not Required");
60
+ $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
61
+ $merge_vars = $this->_mergeVars($subscriber);
62
+
63
+ $this->_helper->log($merge_vars,"Merge Vars");
64
+
65
+ $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
66
+ ->subscriberAdd($email,$merge_vars);
67
+ }
68
  }
69
  else
70
  {
71
+ $this->_helper->log("Existing Subscriber");
72
+ $status = (int)$subscriber->getData('subscriber_status');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ $oldSubscriber = Mage::getModel('newsletter/subscriber')
75
+ ->load($subscriber->getId());
76
+ $oldstatus = (int)$oldSubscriber->getOrigData('subscriber_status');
77
+ if ($oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED && $status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
 
 
 
 
 
 
 
78
  {
79
+ $this->_helper->log("Unconfirmed to Subscribed");
80
+ $subscriber->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED);
81
+ $merge_vars = $this->_mergeVars($subscriber);
82
+
83
+ $this->_helper->log($merge_vars,"Merge Vars");
84
+ $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
85
+ ->subscriberAdd($email,$merge_vars);
86
  }
87
+ elseif( $status !== $oldstatus )
88
  {
89
+ //Status change
90
+ $this->_helper->log("Status Change");
91
+
92
+ //Unsubscribe customer
93
+ if($status == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
94
  {
95
+ $this->_helper->log("Unsubscribed");
96
  $rc = Mage::getSingleton('emaildirect/wrapper_publications')
97
+ ->unsubscribe($listId, $email);
98
+ }
99
+ else if($status == Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
100
+ {
101
+ $this->_helper->log("Subscribed");
102
+ if( $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE || $oldstatus == Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED )
103
+ {
104
+ $this->_helper->log("Changing Status");
105
+ $rc = Mage::getSingleton('emaildirect/wrapper_publications')
106
+ ->subscribe($listId, $email);
107
+ }
108
+ else
109
+ $this->_helper->log("Status Not Changed");
110
  }
 
 
111
  }
112
  }
113
+ $this->_helper->log('handleSubscriber End');
114
+ }
115
+ catch (Exception $e)
116
+ {
117
+ Mage::logException($e);
118
+ $this->_helper->logException($e);
119
  }
 
120
  }
121
 
122
  // Remove Unsubscribe option from Newsletter grid
123
  public function updateNewsletterMassAction($observer)
124
  {
125
+ try
126
+ {
127
+ if (!$this->_helper->canEdirect())
128
+ return $observer;
129
+
130
+ $block = $observer->getEvent()->getBlock();
131
 
132
+ if (get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction'
133
+ && $block->getRequest()->getControllerName() == 'newsletter_subscriber')
134
+ {
135
+ $block->removeItem('unsubscribe');
136
+ }
137
+ }
138
+ catch (Exception $e)
139
  {
140
+ Mage::logException($e);
141
+ $this->_helper->logException($e);
142
  }
143
  }
144
 
148
  */
149
  public function handleSubscriberDeletion(Varien_Event_Observer $observer)
150
  {
151
+ try
 
 
 
152
  {
153
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
154
+ $this->_helper->log("Handle Subscriber Deletion Start");
155
+
156
+ if (!$this->_helper->canEdirect())
157
+ {
158
+ $this->_helper->logReason($this->_helper->getDisabledReason());
159
+ return $observer;
160
+ }
161
+
162
+ $subscriber = $observer->getEvent()->getSubscriber();
163
+
164
+ $email = $subscriber->getSubscriberEmail();
165
+
166
+ $rc = Mage::getSingleton('emaildirect/wrapper_subscribers')
167
+ ->subscriberDelete($email);
168
+
169
+ $this->_helper->log("Handle Subscriber Deletion End");
170
+ }
171
+ catch (Exception $e)
172
+ {
173
+ Mage::logException($e);
174
+ $this->_helper->logException($e);
175
  }
 
 
 
 
 
 
 
 
 
176
  }
177
 
178
  private function validateSource($source, $sources, $store)
237
  if ($apiKey == '')
238
  {
239
  $this->_helper->updateConfig('setup', false, $store);
240
+ $this->_helper->updateConfig('active', false, $store);
241
  return $observer;
242
  }
243
 
429
 
430
  public function updateCustomer(Varien_Event_Observer $observer)
431
  {
432
+ try
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  {
434
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::CUSTOMER);
435
+ $this->_helper->log("Update Customer Start");
436
+
437
+ if (!$this->_helper->canEdirect())
438
+ {
439
+ $this->_helper->logReason($this->_helper->getDisabledReason());
440
+ return $observer;
441
+ }
442
+
443
+ $store = Mage::app()->getStore()->getId();
444
+ $customer = $observer->getEvent()->getCustomer();
445
+
446
+ $merge_vars = $this->_mergeVars($customer, TRUE);
447
+
448
+ $this->_helper->log($merge_vars,"Merge Vars");
449
+
450
+ $api = Mage::getSingleton('emaildirect/wrapper_subscribers');
451
+
452
+ $oldEmail = $customer->getOrigData('email');
453
+ $email = $customer->getEmail();
454
+
455
+ if ($oldEmail == '')
456
+ {
457
+ $this->_helper->log("Original Email was blank. Adding Subscriber");
458
+ $rc = $api->subscriberAdd($email,$merge_vars);
459
+ }
460
+ elseif ($oldEmail != $email)
461
+ {
462
+ $this->_helper->log("Modifying Email");
463
+ $rc = $api->mailModify($oldEmail,$email);
464
+
465
+ $this->_helper->log("Adding Subscriber");
466
+ $rc = $api->subscriberAdd($email,$merge_vars);
467
+ }
468
+ else
469
+ $this->_helper->logReason("Email has not been changed");
470
+
471
+ $this->_helper->log("Update Customer End");
472
  }
473
+ catch (Exception $e)
474
  {
475
+ Mage::logException($e);
476
+ $this->_helper->logException($e);
 
 
 
477
  }
 
 
 
 
478
 
479
  return $observer;
480
  }
481
 
482
  public function registerCheckoutSubscribe(Varien_Event_Observer $observer)
483
  {
484
+ try
 
 
485
  {
486
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
487
+ $this->_helper->log("Register Checkout Subscribe Start");
488
+ if(!$this->_helper->canEdirect())
489
+ {
490
+ $this->_helper->logReason($this->_helper->getDisabledReason());
491
+ return;
492
+ }
493
+ $subscribe = Mage::app()->getRequest()->getPost('emaildirect_subscribe');
494
+
495
+ if(!is_null($subscribe))
496
+ {
497
+ Mage::getSingleton('core/session')->setEmaildirectCheckout($subscribe);
498
+ }
499
+
500
+ $this->_helper->log("Register Checkout Subscribe End");
501
  }
502
+ catch (Exception $e)
 
 
503
  {
504
+ Mage::logException($e);
505
+ $this->_helper->logException($e);
506
  }
 
 
507
  }
508
 
509
  /**
511
  */
512
  public function registerCheckoutSuccess(Varien_Event_Observer $observer)
513
  {
514
+ try
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
515
  {
516
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::NEWSLETTER);
517
+ $this->_helper->log("Register Checkout Success Start");
518
+ if(!$this->_helper->canEdirect())
519
+ {
520
+ $this->_helper->logReason($this->_helper->getDisabledReason());
521
+ return;
522
+ }
523
 
524
+ $sessionFlag = Mage::getSingleton('core/session')->getEmaildirectCheckout(TRUE);
525
+ if (!$sessionFlag)
526
+ {
527
+ $this->_helper->logReason("Session flag not found.");
528
+ return;
529
+ }
530
+
531
+ $orderId = (int)current($observer->getEvent()->getOrderIds());
532
+
533
+ if (!$orderId)
534
+ {
535
+ $this->_helper->logReason("Order ID not found.");
536
+ return;
537
+ }
538
+
539
+ $order = Mage::getModel('sales/order')->load($orderId);
540
+ if (!$order->getId())
541
+ {
542
+ $this->_helper->logReason("Failed to Load Order ({$orderId}).");
543
+ return;
544
+ }
545
+
546
+ $this->_helper->log("Processing Order # " . $order->getIncrementId());
547
+
548
+ //Guest Checkout
549
+ if( (int)$order->getCustomerGroupId() === Mage_Customer_Model_Group::NOT_LOGGED_IN_ID )
550
+ {
551
+ $this->_helper->log("Guest Checkout");
552
+ $this->_helper->registerGuestCustomer($order);
553
+ }
554
+
555
+ $rc = $subscriber = Mage::getModel('newsletter/subscriber')
556
+ ->subscribe($order->getCustomerEmail());
557
+
558
+ $this->_helper->log("Register Checkout Success End");
559
  }
560
+ catch (Exception $e)
 
 
 
 
561
  {
562
+ Mage::logException($e);
563
+ $this->_helper->logException($e);
564
  }
 
 
 
 
 
565
  }
566
 
567
  public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer)
568
  {
569
+ try
 
 
 
 
 
 
 
 
 
 
 
570
  {
571
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ORDERS);
572
+ $this->_helper->log("Sales Order Shipment Track Save After Start");
573
+ if(!$this->_helper->canEdirect())
574
+ {
575
+ $this->_helper->logReason($this->_helper->getDisabledReason());
576
+ return;
577
+ }
578
+ $track = $observer->getEvent()->getTrack();
579
+
580
+ $order = $track->getShipment()->getOrder();
581
+ $shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method'
582
+ if (!$shippingMethod)
583
+ {
584
+ $this->_helper->logReason("Shipping Method not found");
585
+ return $observer;
586
+ }
587
+
588
+ $email = $order->getCustomerEmail();
589
+
590
+ $merge_vars = array();
591
+
592
+ $merge_vars = $this->_helper->getTrackingMergeVars($track, $order);
593
+
594
+ if ($merge_vars == null)
595
+ {
596
+ $this->_helper->logReason("No shipping fields setup");
597
+ return $observer;
598
+ }
599
+
600
+ $this->_helper->log($merge_vars,"Merge Vars");
601
+
602
+ $rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberTracking($email, $merge_vars);
603
+
604
+ $this->_helper->log("Sales Order Shipment Track Save After Start");
605
+
606
+ return $observer;
607
  }
608
+ catch (Exception $e)
 
 
 
 
 
 
 
609
  {
610
+ Mage::logException($e);
611
+ $this->_helper->logException($e);
612
  }
 
 
 
 
 
 
 
 
613
  }
614
 
615
  public function orderSaveAfter(Varien_Event_Observer $observer)
616
  {
617
+ try
 
 
 
618
  {
619
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
620
+ $this->_helper->log("Order Save After Start");
621
+
622
+ if (!$this->_helper->getOrdersEnabled())
623
+ {
624
+ $this->_helper->logReason($this->_helper->getOrdersDisabledReason());
625
+ return $observer;
626
+ }
627
+
628
+ $order = $observer->getEvent()->getOrder();
629
+
630
+ $this->_helper->log("Order Save After: " . $order->getIncrementId());
631
+ if($order->getState() !== Mage_Sales_Model_Order::STATE_COMPLETE)
632
+ {
633
+ $this->_helper->logReason("Order is not complete.");
634
+ return $observer;
635
+ }
636
+
637
+ //$this->_helper->log("Order is complete. Processing...");
638
+
639
+ $email = $order->getCustomerEmail();
640
+
641
+ if ($order->getData('customer_is_guest'))
642
+ {
643
+ $this->_helper->log("Guest Customer");
644
 
645
+ $customer = new Varien_Object;
646
+
647
+ $customer->setData('email',$email);
648
+ $customer->setData('firstname',$order->getData('customer_firstname'));
649
+ $customer->setData('lastname',$order->getData('customer_lastname'));
650
+ $customer->setData('store_id',$order->getStoreId());
651
+
652
+ $customer->setBillingAddress($order->getBillingAddress());
653
+ }
654
+ else
655
+ {
656
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
657
+ $address = Mage::getModel('customer/address')->load($customer->getDefaultBilling());
658
+ $customer->setBillingAddress($address);
659
+ }
660
+
661
+ $merge_vars = $this->_helper->getMergeVars($customer, true);
662
+ $merge_vars = $this->_helper->getOrderMergeVars($merge_vars,$order);
663
 
664
+ if ($this->_helper->config('save_latest_order'))
665
+ {
666
+ $this->_helper->log("Getting Latest Order Info");
667
+ $merge_vars['LastOrderNumber'] = $order->getIncrementId();
668
+ $merge_vars['LastPurchaseDate'] = $order->getData('created_at');
669
+ $merge_vars['LastPurchaseTotal'] = Mage::helper('core')->currency($order->getData('total_paid'), true, false);
670
+
671
+ $merge_vars = $this->getMergeOrderItems($order, $merge_vars);
672
+ $merge_vars = $this->getRelatedOrderItems($order, $merge_vars);
673
+ }
674
+
675
+ $this->_helper->log($merge_vars, "Merge Vars");
676
+
677
+ Mage::helper('emaildirect/fields')->checkFields();
678
+
679
+ $rc = Mage::getSingleton('emaildirect/wrapper_orders')->addSubscriberOrder($email,$order, $merge_vars);
 
 
 
 
 
 
 
 
 
680
 
681
+ $this->_helper->log("Order Save After End");
682
+
683
+ return $observer;
684
+ }
685
+ catch (Exception $e)
686
+ {
687
+ Mage::logException($e);
688
+ $this->_helper->logException($e);
689
  }
 
 
 
 
 
 
 
 
 
 
690
  }
691
 
692
  // START ABANDONED CRON
740
  catch (Exception $e)
741
  {
742
  Mage::logException($e);
743
+ $this->_helper->logException($e);
744
  }
745
  }
746
 
819
  if (!$subscribers)
820
  {
821
  $this->_helper->logReason("No Carts Found");
822
+ return; // No abandoned carts found
823
  }
824
 
825
  $this->_helper->log("Sending Abandoned Carts");
829
 
830
  public function abandonedStoreProcessor($store, $check_date)
831
  {
832
+ try
 
 
 
 
833
  {
834
+ $store_code = $store->getCode();
835
+
836
+ $this->_helper->log("Processing Store: {$store_code}");
837
+
838
+ if (!$this->_helper->getAbandonedEnabled())
839
+ {
840
+ $this->_helper->logReason($this->_helper->getAbandonedDisabledReason());
841
+ return;
842
+ }
843
+
844
+ Mage::helper('emaildirect/fields')->checkFields();
845
+
846
+ // Get abandoned collection
847
+ $collection = Mage::getResourceModel('reports/quote_collection');
848
+
849
+ $collection->addFieldToFilter('items_count', array('neq' => '0'))
850
+ ->addFieldToFilter('main_table.is_active', '1')
851
+ ->setOrder('updated_at');
852
+
853
+ $collection->addFieldToFilter('main_table.updated_at', array('lt' => $check_date));
854
+ $collection->addFieldToFilter('main_table.emaildirect_abandoned_date', array('null' => true));
855
+ $collection->addFieldToFilter('main_table.emaildirect_abandoned_url', array('notnull' => true));
856
+ $collection->addFieldToFilter('main_table.customer_email', array('notnull' => true));
857
+
858
+ $collection->addFieldToFilter('store_id', array('eq' => $store->getId()));
859
+
860
+ $this->_helper->log("SQL: " . $collection->getSelect()->__toString());
861
+
862
+ $this->_abandonedCartsProcessor($collection);
863
+
864
+ $this->_helper->log("Finished Processing Store: {$store_code}");
865
+ }
866
+ catch (Exception $e)
867
+ {
868
+ Mage::logException($e);
869
+ $this->_helper->logException($e);
870
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
  }
872
 
873
  public function abandonedCartsProcessor()
874
  {
875
+ try
876
+ {
877
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
878
+ $this->_helper->log("Abandoned Carts Processor Start");
879
+
880
+ $check_date = $this->getAbandonedTime();
 
 
 
 
 
 
 
 
881
 
882
+ $this->_helper->log("Check Date: {$check_date}");
883
+
884
+ $stores = Mage::app()->getStores();
885
+
886
+ $starting_store = Mage::app()->getStore()->getCode();
887
+
888
+ foreach ($stores as $store)
889
+ {
890
+ Mage::app()->setCurrentStore($store->getCode());
891
+
892
+ $this->abandonedStoreProcessor($store, $check_date);
893
+ }
894
+
895
+ Mage::app()->setCurrentStore($starting_store);
896
+
897
+ $this->_helper->log("Abandoned Carts Processor End");
898
+ }
899
+ catch (Exception $e)
900
+ {
901
+ Mage::logException($e);
902
+ $this->_helper->logException($e);
903
  }
 
 
 
 
904
  }
905
 
906
  public function SendAbandonedCarts($id_list)
907
  {
908
+ try
909
+ {
910
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
911
+ $this->_helper->log("Sending Specific Abandoned Carts Start");
912
+
913
+ Mage::helper('emaildirect/fields')->checkFields();
914
+
915
+ $this->_helper->log($id_list, "ID LIST");
916
+
917
+ // Get abandoned collection
918
+ $collection = Mage::getResourceModel('reports/quote_collection');
919
+
920
+ $collection->addFieldToFilter('entity_id', array('in' => $id_list))
921
+ ->setOrder('updated_at');
922
+
923
+ $this->_helper->log("SQL: " . $collection->getSelect()->__toString());
924
+
925
+ $this->_abandonedCartsProcessor($collection, false);
926
+
927
+ $this->_helper->log("Sending Specific Abandoned Carts End");
928
+ }
929
+ catch (Exception $e)
930
+ {
931
+ Mage::logException($e);
932
+ $this->_helper->logException($e);
933
+ }
934
  }
935
  // END ABANDONED CRON
936
 
989
 
990
  public function quoteSaveAfter(Varien_Event_Observer $observer)
991
  {
992
+ try
993
+ {
994
+ $this->_helper->setLogArea(EmailDirect_Integration_Helper_Data::ABANDONED_CART);
995
+ $this->_helper->log("Quote Save After Start");
996
+ $quote = $observer->getEvent()->getQuote();
997
+
998
+ if (trim($quote->getEmaildirectAbandonedDate()))
999
+ {
1000
+ $this->_helper->logReason("Already sent.");
1001
+ return;
1002
+ }
1003
+
1004
+ $url = $this->getAbandonedUrl($quote);
1005
+
1006
+ $this->_helper->log("Abandoned Url: {$url}");
1007
+
1008
+ if ($quote->getEmaildirectAbandonedUrl() == $url)
1009
+ {
1010
+ $this->_helper->logReason("Abandoned Url is up to date.");
1011
+ return;
1012
+ }
1013
+
1014
+ $this->_helper->log("Saving Quote.");
1015
+ // Re-save quote with new URL
1016
+ $this->setAbandonedUrl($quote, $url);
1017
+ $this->_helper->log("Quote Save After End");
1018
  }
1019
+ catch (Exception $e)
 
 
 
 
 
1020
  {
1021
+ Mage::logException($e);
1022
+ $this->_helper->logException($e);
1023
  }
 
 
 
 
 
1024
  }
1025
  // END QUOTE SAVE AFTER
1026
  }
app/code/local/EmailDirect/Integration/Model/Wrapper/Execute.php CHANGED
@@ -13,21 +13,26 @@ class EmailDirect_Integration_Model_Wrapper_Execute
13
 
14
  public function sendCommand($command, $subcommand = null, $id= null, $xmldata=null, $method = "POST")
15
  {
 
 
 
 
 
16
  $apikey = Mage::helper('emaildirect')->getApiKey();
17
 
18
  if ($xmldata != null)
19
- Mage::helper('emaildirect')->log($xmldata,"Xml Data ({$command})");
20
 
21
- $URL = Mage::helper('emaildirect')->config('urls/accesspoint');
22
- $urlsuffix = Mage::helper('emaildirect')->config("urls/{$command}");
23
  $URL .= $urlsuffix;
24
  if ($id)
25
  $URL .= "/$id";
26
  if ($subcommand)
27
  $URL .= "/$subcommand";
28
 
29
- Mage::helper('emaildirect')->log("API KEY: {$apikey}");
30
- Mage::helper('emaildirect')->log("URL: {$URL}");
31
 
32
  $header = array('Content-Type: text/xml','ApiKey: '.$apikey,'Accept: application/xml');
33
  $ch = curl_init($URL);
@@ -60,18 +65,18 @@ class EmailDirect_Integration_Model_Wrapper_Execute
60
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
61
  curl_setopt($ch, CURLOPT_PUT, true);
62
  curl_setopt($ch, CURLOPT_INFILE, $putData);
63
- curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
64
- } break;
65
  }
66
 
67
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
68
  $output = curl_exec($ch);
69
 
70
  curl_close($ch);
71
- $start = strpos($output,'<?xml',true);
72
  if(!$start)
73
  {
74
- $start = strpos($output,'<Response>',true);
75
  }
76
  if (!$start)
77
  {
@@ -91,7 +96,7 @@ class EmailDirect_Integration_Model_Wrapper_Execute
91
  }
92
 
93
  if ($command != 'Database')
94
- Mage::helper('emaildirect')->log($xml, "Response");
95
 
96
  return $xml;
97
  }
13
 
14
  public function sendCommand($command, $subcommand = null, $id= null, $xmldata=null, $method = "POST")
15
  {
16
+ $helper = Mage::helper('emaildirect');
17
+
18
+ if (!$helper->canEdirect())
19
+ return;
20
+
21
  $apikey = Mage::helper('emaildirect')->getApiKey();
22
 
23
  if ($xmldata != null)
24
+ $helper->log($xmldata,"Xml Data ({$command})");
25
 
26
+ $URL = $helper->config('urls/accesspoint');
27
+ $urlsuffix = $helper->config("urls/{$command}");
28
  $URL .= $urlsuffix;
29
  if ($id)
30
  $URL .= "/$id";
31
  if ($subcommand)
32
  $URL .= "/$subcommand";
33
 
34
+ $helper->log("API KEY: {$apikey}");
35
+ $helper->log("URL: {$URL}");
36
 
37
  $header = array('Content-Type: text/xml','ApiKey: '.$apikey,'Accept: application/xml');
38
  $ch = curl_init($URL);
65
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
66
  curl_setopt($ch, CURLOPT_PUT, true);
67
  curl_setopt($ch, CURLOPT_INFILE, $putData);
68
+ curl_setopt($ch, CURLOPT_INFILESIZE, strlen($putString));
69
+ } break;
70
  }
71
 
72
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
73
  $output = curl_exec($ch);
74
 
75
  curl_close($ch);
76
+ $start = strpos($output,'<?xml');
77
  if(!$start)
78
  {
79
+ $start = strpos($output,'<Response>');
80
  }
81
  if (!$start)
82
  {
96
  }
97
 
98
  if ($command != 'Database')
99
+ $helper->log($xml, "Response");
100
 
101
  return $xml;
102
  }
app/code/local/EmailDirect/Integration/controllers/Admin/AbandonedController.php CHANGED
@@ -6,6 +6,7 @@ class Emaildirect_Integration_Admin_AbandonedController extends Mage_Adminhtml_C
6
  {
7
  $this->loadLayout();
8
 
 
9
  $this->_setActiveMenu('sales');
10
  $this->renderLayout();
11
  }
@@ -20,7 +21,7 @@ class Emaildirect_Integration_Admin_AbandonedController extends Mage_Adminhtml_C
20
  $this->loadLayout();
21
  $this->getResponse()->setBody($this->getLayout()->createBlock('emaildirect/adminhtml_abandoned_grid')->toHtml());
22
  }
23
-
24
  public function runAction()
25
  {
26
  Mage::getSingleton('emaildirect/observer')->abandonedCartsProcessor();
6
  {
7
  $this->loadLayout();
8
 
9
+ $this->getLayout()->getBlock('head')->setTitle($this->__('EmailDirect Abandoned Carts'));
10
  $this->_setActiveMenu('sales');
11
  $this->renderLayout();
12
  }
21
  $this->loadLayout();
22
  $this->getResponse()->setBody($this->getLayout()->createBlock('emaildirect/adminhtml_abandoned_grid')->toHtml());
23
  }
24
+
25
  public function runAction()
26
  {
27
  Mage::getSingleton('emaildirect/observer')->abandonedCartsProcessor();
app/code/local/EmailDirect/Integration/controllers/Admin/ExportController.php CHANGED
@@ -130,8 +130,6 @@ class Emaildirect_Integration_Admin_ExportController extends Mage_Adminhtml_Cont
130
  $product_id = $this->getRequest()->getPost('id', 0);
131
  $file_name = $this->getRequest()->getPost('filename', 0);
132
 
133
- //Mage::log($product_id,null,'1_export.log');
134
-
135
  if (is_array($product_id))
136
  {
137
  foreach ($product_id as $id)
@@ -188,8 +186,6 @@ class Emaildirect_Integration_Admin_ExportController extends Mage_Adminhtml_Cont
188
  $api = Mage::getSingleton('emaildirect/wrapper_ftp');
189
  $rc = $api->upload($ed_url,"magento_products_{$file_name}.csv");
190
 
191
- //Mage::log($rc,null,'1_export.log');
192
-
193
  if (isset($rc->ErrorCode))
194
  {
195
  $result['error'] = "EmailDirect Error: (" . (string) $rc->ErrorCode . "): " . (string)$rc->Message;
@@ -200,9 +196,4 @@ class Emaildirect_Integration_Admin_ExportController extends Mage_Adminhtml_Cont
200
  }
201
 
202
  }
203
- /*
204
- protected function _isAllowed()
205
- {
206
- return Mage::getSingleton('admin/session')->isAllowed('admin/system/convert/profiles');
207
- }*/
208
  }
130
  $product_id = $this->getRequest()->getPost('id', 0);
131
  $file_name = $this->getRequest()->getPost('filename', 0);
132
 
 
 
133
  if (is_array($product_id))
134
  {
135
  foreach ($product_id as $id)
186
  $api = Mage::getSingleton('emaildirect/wrapper_ftp');
187
  $rc = $api->upload($ed_url,"magento_products_{$file_name}.csv");
188
 
 
 
189
  if (isset($rc->ErrorCode))
190
  {
191
  $result['error'] = "EmailDirect Error: (" . (string) $rc->ErrorCode . "): " . (string)$rc->Message;
196
  }
197
 
198
  }
 
 
 
 
 
199
  }
app/code/local/EmailDirect/Integration/controllers/ExportController.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class EmailDirect_Integration_ExportController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function downloadAction()
5
+ {
6
+ $file_name = "emaildirect_products_" . $this->getRequest()->getParam('filename');
7
+ $file = Mage::helper('emaildirect')->getExportFileName($file_name);
8
+
9
+ $this->_prepareDownloadResponse(Mage::helper('emaildirect')->getExportFileName($file_name,false), file_get_contents($file));
10
+ }
11
+ }
app/code/local/EmailDirect/Integration/etc/config.xml CHANGED
@@ -2,19 +2,19 @@
2
  <config>
3
  <modules>
4
  <EmailDirect_Integration>
5
- <version>1.5.0</version>
6
  </EmailDirect_Integration>
7
  </modules>
8
  <global>
9
  <events>
10
- <newsletter_subscriber_save_before>
11
  <observers>
12
  <emaildirect_subscribe_observer>
13
  <class>emaildirect/observer</class>
14
  <method>handleSubscriber</method>
15
  </emaildirect_subscribe_observer>
16
  </observers>
17
- </newsletter_subscriber_save_before>
18
  <newsletter_subscriber_delete_after>
19
  <observers>
20
  <emaildirect_subscribe_delete_observer>
@@ -30,7 +30,7 @@
30
  <method>updateCustomer</method>
31
  </emaildirect_update_customer>
32
  </observers>
33
- </customer_save_after>
34
  <sales_order_save_after>
35
  <observers>
36
  <emaildirect_order_save_after>
@@ -123,8 +123,8 @@
123
  </emaildirect>
124
  </updates>
125
  </layout>
126
- <events>
127
- <controller_action_postdispatch_checkout_onepage_saveOrder>
128
  <observers>
129
  <emaildirect_subscribe_checkout>
130
  <class>emaildirect/observer</class>
@@ -213,11 +213,11 @@
213
  </core_block_abstract_to_html_before>
214
  <sales_order_shipment_track_save_after>
215
  <observers>
216
- <googlecheckout>
217
  <type>model</type>
218
  <class>emaildirect/observer</class>
219
  <method>salesOrderShipmentTrackSaveAfter</method>
220
- </googlecheckout>
221
  </observers>
222
  </sales_order_shipment_track_save_after>
223
  <admin_system_config_changed_section_emaildirect>
2
  <config>
3
  <modules>
4
  <EmailDirect_Integration>
5
+ <version>1.5.1</version>
6
  </EmailDirect_Integration>
7
  </modules>
8
  <global>
9
  <events>
10
+ <newsletter_subscriber_save_before>
11
  <observers>
12
  <emaildirect_subscribe_observer>
13
  <class>emaildirect/observer</class>
14
  <method>handleSubscriber</method>
15
  </emaildirect_subscribe_observer>
16
  </observers>
17
+ </newsletter_subscriber_save_before>
18
  <newsletter_subscriber_delete_after>
19
  <observers>
20
  <emaildirect_subscribe_delete_observer>
30
  <method>updateCustomer</method>
31
  </emaildirect_update_customer>
32
  </observers>
33
+ </customer_save_after>
34
  <sales_order_save_after>
35
  <observers>
36
  <emaildirect_order_save_after>
123
  </emaildirect>
124
  </updates>
125
  </layout>
126
+ <events>
127
+ <controller_action_postdispatch_checkout_onepage_saveOrder>
128
  <observers>
129
  <emaildirect_subscribe_checkout>
130
  <class>emaildirect/observer</class>
213
  </core_block_abstract_to_html_before>
214
  <sales_order_shipment_track_save_after>
215
  <observers>
216
+ <emaildirect_track_save_after>
217
  <type>model</type>
218
  <class>emaildirect/observer</class>
219
  <method>salesOrderShipmentTrackSaveAfter</method>
220
+ </emaildirect_track_save_after>
221
  </observers>
222
  </sales_order_shipment_track_save_after>
223
  <admin_system_config_changed_section_emaildirect>
app/design/adminhtml/default/default/template/emaildirect/system/config/form/field/trouble.phtml CHANGED
@@ -2,7 +2,7 @@
2
  <?php
3
  $element = $this->getElement();
4
 
5
- $enabled = $element->getValue();
6
  ?>
7
 
8
  <span class='trouble_status'>Status: <strong><?php if ($enabled) echo "Enabled"; else echo "Disabled" ?></strong></span>
2
  <?php
3
  $element = $this->getElement();
4
 
5
+ $enabled = $element->getValue() == true;
6
  ?>
7
 
8
  <span class='trouble_status'>Status: <strong><?php if ($enabled) echo "Enabled"; else echo "Disabled" ?></strong></span>
app/design/frontend/base/default/layout/emaildirect.xml CHANGED
@@ -2,9 +2,9 @@
2
 
3
  <layout version="0.1.0">
4
  <checkout_onepage_review>
5
- <reference name="checkout.onepage.review.info.items.after">
6
  <block type="emaildirect/checkout_subscribe" name="emaildirect.subscribe" template="emaildirect/checkout/subscribe.phtml" />
7
- </reference>
8
  </checkout_onepage_review>
9
 
10
  <!-- Customer -->
2
 
3
  <layout version="0.1.0">
4
  <checkout_onepage_review>
5
+ <reference name="checkout.onepage.review.info.items.after">
6
  <block type="emaildirect/checkout_subscribe" name="emaildirect.subscribe" template="emaildirect/checkout/subscribe.phtml" />
7
+ </reference>
8
  </checkout_onepage_review>
9
 
10
  <!-- Customer -->
package.xml CHANGED
@@ -1,31 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EmailDirect_Integration</name>
4
- <version>1.5.0</version>
5
  <stability>stable</stability>
6
  <license>GNU</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>EmailDirect integration for magento</summary>
10
  <description>EmailDirect integration for magento</description>
11
- <notes>Release Notes:&#xD;
12
- - Currency Symbol added to Cost Fields&#xD;
13
- - Troubleshooting system implemented&#xD;
14
- - Customer Account Dashboard Improvements&#xD;
15
- - Subscribe/Unsubscribe to Newsletter and Interests (Lists)&#xD;
16
- - Bug Fixes&#xD;
17
- - Bad API Key fix&#xD;
18
- - Multi-store Support Improved&#xD;
19
- - Separate API keys per Store&#xD;
20
- - Abandoned Cart process runs per Store&#xD;
21
- - Improved support for Disabling of Module&#xD;
22
- - Disabling module stops calls to API and turns off custom blocks on front end&#xD;
23
- - Disable module per store&#xD;
24
- - Tested on Enterprise 1.13</notes>
25
  <authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
26
- <date>2013-06-09</date>
27
- <time>01:24:35</time>
28
- <contents><target name="magelocal"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><file name="Grid.php" hash="193034247dab3a6c367c980b21032ebc"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="7649b64cf2319484207c5179df7b4e9f"/></dir><dir name="Form"><dir name="Field"><file name="Addressmapfields.php" hash="2e8456508018770ac0a41b7cdbb8616f"/><file name="Button.php" hash="ca555e93c55812795d2504ee6de13f3a"/><file name="Common.php" hash="98d9d69a46e88033eb308f8cd0a0fca7"/><file name="Mapfields.php" hash="82d6fe522f46880685ab047ee67b839f"/><file name="Shippingmapfields.php" hash="9e464ed63d0315ef0f534d036517ceb6"/><file name="Troubleshooting.php" hash="fe89a76362a109ab778796d58040386e"/></dir></dir><file name="Account.php" hash="60fa8e43a87e1f2ff71c319c979556b2"/></dir><dir name="Convert"><dir name="Profile"><file name="Export.php" hash="95956414af4ec5b400244b246b8f1cf9"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="9315a364a46f9e39972bbd0a47152e90"/><file name="Info.php" hash="6714b756a3fa7a5812356e544fe48f1b"/><file name="Log.php" hash="7c3661722d1197cd8a564f76275353c7"/><file name="Submit.php" hash="8831d886858fde08a4323eea66ec76d2"/></dir><file name="Form.php" hash="e527a3a2335b109c48a69f06c1b0d01f"/></dir><file name="Tabs.php" hash="ab1fdbe561e8572c2c50cdbec9573f82"/><file name="View.php" hash="1693280ace7a4a5f2c537644b646a452"/></dir><file name="Abandoned.php" hash="9d69cb3b2d561a97d0df0b456aa8f7b5"/><file name="Troubleshooting.php" hash="e6bc8a637c05d17bd98384d1df331b48"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="ae325e815a54bde93507562cf0d86b8a"/></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="0d56c53c7c98046c435a2b87621c3e3b"/></dir><file name="Lists.php" hash="e56926d8681b4dacd5ecf8d0ccc31fc7"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="AbandonedMinutes.php" hash="22e33be85dc8348fce9b49637ead919d"/><file name="Action.php" hash="b85ef0454ab5c65ef0c43c7ef057ecc2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5651ea1611cde7c85bde0b4cfa0be807"/><file name="Fields.php" hash="d1728e9d1ee85ba45c6e9c1ad4618d3a"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="fd2fcedc80472895b2081e21af8fa7f5"/></dir><file name="Abandoned.php" hash="d4985049dbd47d79a9d8f3361528bc87"/><file name="Abandonedlist.php" hash="a5d3b987ea2a2d8672c9c2c3473c24e2"/><file name="Additionallist.php" hash="1fcede7a1efe84ce13104194f3dc9962"/><file name="Checkoutsubscribe.php" hash="fd90252a1f19649a420dae136ad2a2ba"/><file name="List.php" hash="00611b9215b54e86171a8e4a9a5e54db"/><file name="Maxtimes.php" hash="465ffb2acf45adf594b6e8c720dd23dc"/><file name="Publication.php" hash="903657f0b2a911af97f8bccb6d9cffab"/><file name="Source.php" hash="fb706f2418208b2a8f7a29a6050e815d"/><file name="Time.php" hash="0e26839880e25ec0eedce1ce8a663c0f"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="f33d3ef289c147ce572bcafdce47665c"/><file name="Abstract.php" hash="90935a39addc872b82639ae97855c894"/><file name="Database.php" hash="3cceb467358d13584baff58c043762ec"/><file name="Execute.php" hash="4e8cf3590be46182ca282f0cc16a8756"/><file name="Ftp.php" hash="d5335cfb68f99761d6902dd390a3d7a8"/><file name="Lists.php" hash="07436322d71a6065e75b3fcb902a5952"/><file name="Orders.php" hash="0c5f01418fa2f0fabc8bed26b4434704"/><file name="Publications.php" hash="72ccdc495868308d9831cbf01ddea3b0"/><file name="Sources.php" hash="c67d1e8877e7f3ce907090d8fb7d4f00"/><file name="Subscribers.php" hash="c3093bd2f86fdc3a7e4b2a2d4beadd2b"/></dir><file name="Observer.php" hash="5aa6f7d15e858bdf7889b37b143acf1a"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="e0345fe3a43f469ec53e992a24c70fb9"/><file name="ExportController.php" hash="d23ab90df4910a7ae4f9c5c491e8fd33"/><file name="TroubleshootingController.php" hash="7a4939b33d875417f19429614d8896ae"/></dir><dir name="Customer"><file name="AccountController.php" hash="16bfdb6de4804a5d71cb972afbff4537"/></dir><file name="AbandonedController.php" hash="12d8655ed118d280320e5457f4933881"/></dir><dir name="etc"><file name="adminhtml.xml" hash="896c10d8a3f932346e7d301052b1b6a6"/><file name="config.xml" hash="8efc48e5f7d62906d56dc44274558f9b"/><file name="system.xml" hash="fb3e4ced708718df052a9e429bbfa8ed"/></dir><dir name="sql"><dir name="emaildirect_setup"><file name="mysql4-install-1.0.0.php" hash="9dc51edb346e9676735e15d3e78fa3eb"/><file name="mysql4-upgrade-1.0.13-1.0.14.php" hash="c42e2677b3960a049d7137b622552084"/><file name="mysql4-upgrade-1.0.19-1.2.0.php" hash="742be042b7f56e7ff2002b0606270ca6"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="emaildirect"><file name="emaildirect-connected-ebizmarts-title.png" hash="faf3858f23eafe3a89cce144fef6bd2a"/><file name="emaildirect-section-background.png" hash="c205ce454fe63280d7d7dd74428b7ea4"/><file name="emaildirect-tab.png" hash="9ddb077b74a7078ac509d79b024631a1"/><file name="emaildirect.css" hash="016ecc627aa3e7e971d53ec73d52858e"/><file name="emaildirect.js" hash="ce03dd6f51ea529fc4acdc5116f4e030"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="emaildirect"><dir name="images"><file name="bkg_block-title.gif" hash="f8c1f130ad69464fe7aff2f589b2ec75"/><file name="dotted_divider.gif" hash="260ebae91ffb1b7c663906b29a069925"/><file name="emaildirect-tile.png" hash="86a0ed36169ab9691480fc995ab674a8"/><file name="i_block-subscribe.gif" hash="9e5fee06a543742045118a95f2debcb8"/></dir><file name="integration.js" hash="d8c8d5bf0ddb4f6ead23bec8a2814475"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="91d689f9f169c4b1e5c59cf19aa89301"/></dir><dir name="template"><dir name="emaildirect"><dir name="abandoned"><file name="grid.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4d7607ecb15d13cfe8bb0cc889cb724f"/></dir><dir name="form"><dir name="field"><file name="array.phtml" hash="d6af9f840f4dda9c73d106e167ec1bc6"/><file name="button.phtml" hash="ad2811d37509d0919d3b41ecad1f37df"/><file name="trouble.phtml" hash="2d83e8be9aa43e2330bce9fa84435fac"/></dir></dir></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="86339d17e83bd8dcc2a268b3ace3d9e7"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="78ec34fd9c3c8b660b19f9e799d8e76e"/><file name="info.phtml" hash="547b1e906ed142983d1034e05f6251bd"/><file name="log.phtml" hash="c9e2c9493a2dad579bba4ed53795cf5e"/><file name="submit.phtml" hash="c2269f4a6a52d66bff5eac660d0831bd"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="view.phtml" hash="ee6af3fe79d916af764f41e7e8c5cc37"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="578a3bd30d7ccba863a6f22027108647"/></dir><dir name="template"><dir name="emaildirect"><dir name="checkout"><file name="subscribe.phtml" hash="351ea790305f0a3ec99c34180bbee235"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="4256a03d67ec2a6f97867a87564cff92"/></dir><file name="lists.phtml" hash="4c697dcfa63ece1db7885cadb02982d1"/></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="default.phtml" hash="2d65f3d02b9baa08969d68f2a2cca348"/></dir></dir><file name="items.phtml" hash="e6b15e6460010c5acae66017d177bfb9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="newsletter_subscr_success_emaildirect.html" hash="f6afb69d207bbc3f8920e7a72ac9dd07"/><file name="newsletter_unsub_success_emaildirect.html" hash="bd9f97e8f5485180d4420097b5200ef4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EmailDirect_Integration.xml" hash="2d2666e6d9cd8d40a4974d5e242721d6"/></dir></target></contents>
29
  <compatible/>
30
  <dependencies/>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>EmailDirect_Integration</name>
4
+ <version>1.5.1</version>
5
  <stability>stable</stability>
6
  <license>GNU</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>EmailDirect integration for magento</summary>
10
  <description>EmailDirect integration for magento</description>
11
+ <notes>Bug Fixes</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <authors><author><name>Kevin Linden</name><user>auto-converted</user><email>Kevin@EmailDirect.com</email></author></authors>
13
+ <date>2013-06-19</date>
14
+ <time>18:56:12</time>
15
+ <contents><target name="magelocal"><dir name="EmailDirect"><dir name="Integration"><dir name="Block"><dir name="Adminhtml"><dir name="Abandoned"><file name="Grid.php" hash="b664b1a7b368199656db734788cfb72c"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="7649b64cf2319484207c5179df7b4e9f"/></dir><dir name="Form"><dir name="Field"><file name="Addressmapfields.php" hash="97b75c8340d561e863a3985ad73ce228"/><file name="Button.php" hash="ca555e93c55812795d2504ee6de13f3a"/><file name="Common.php" hash="e597ff375c4b46b92d6aa35646e3d8c9"/><file name="Mapfields.php" hash="677ebfd526fba11a1c177c00ae085526"/><file name="Shippingmapfields.php" hash="589a74260f394a5eae1b57ca89a74a8b"/><file name="Troubleshooting.php" hash="3699df84e4856983e679bd6c8fc9513e"/></dir></dir><file name="Account.php" hash="60fa8e43a87e1f2ff71c319c979556b2"/></dir><dir name="Convert"><dir name="Profile"><file name="Export.php" hash="95956414af4ec5b400244b246b8f1cf9"/></dir></dir></dir><dir name="Troubleshooting"><dir name="View"><dir name="Tab"><file name="Download.php" hash="9315a364a46f9e39972bbd0a47152e90"/><file name="Info.php" hash="6714b756a3fa7a5812356e544fe48f1b"/><file name="Log.php" hash="7c3661722d1197cd8a564f76275353c7"/><file name="Submit.php" hash="8831d886858fde08a4323eea66ec76d2"/></dir><file name="Form.php" hash="e527a3a2335b109c48a69f06c1b0d01f"/></dir><file name="Tabs.php" hash="ab1fdbe561e8572c2c50cdbec9573f82"/><file name="View.php" hash="7cd8350545f6b6119b2c91b3fc6ae562"/></dir><file name="Abandoned.php" hash="9d69cb3b2d561a97d0df0b456aa8f7b5"/></dir><dir name="Checkout"><file name="Subscribe.php" hash="ae325e815a54bde93507562cf0d86b8a"/></dir><dir name="Customer"><dir name="Account"><dir name="Dashboard"><file name="Info.php" hash="0d56c53c7c98046c435a2b87621c3e3b"/></dir><file name="Lists.php" hash="e56926d8681b4dacd5ecf8d0ccc31fc7"/></dir></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="AbandonedMinutes.php" hash="22e33be85dc8348fce9b49637ead919d"/><file name="Action.php" hash="b85ef0454ab5c65ef0c43c7ef057ecc2"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="820afaa8459b860cbd7384380ecd4229"/><file name="Fields.php" hash="3517ad00c7323e9bc5ef7d97ec076514"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Export"><file name="Batch.php" hash="fd2fcedc80472895b2081e21af8fa7f5"/></dir><file name="Abandoned.php" hash="d4985049dbd47d79a9d8f3361528bc87"/><file name="Abandonedlist.php" hash="a5d3b987ea2a2d8672c9c2c3473c24e2"/><file name="Additionallist.php" hash="1fcede7a1efe84ce13104194f3dc9962"/><file name="Checkoutsubscribe.php" hash="fd90252a1f19649a420dae136ad2a2ba"/><file name="List.php" hash="00611b9215b54e86171a8e4a9a5e54db"/><file name="Maxtimes.php" hash="465ffb2acf45adf594b6e8c720dd23dc"/><file name="Publication.php" hash="903657f0b2a911af97f8bccb6d9cffab"/><file name="Source.php" hash="fb706f2418208b2a8f7a29a6050e815d"/><file name="Time.php" hash="0e26839880e25ec0eedce1ce8a663c0f"/></dir></dir></dir><dir name="Wrapper"><file name="Abandoned.php" hash="f33d3ef289c147ce572bcafdce47665c"/><file name="Abstract.php" hash="90935a39addc872b82639ae97855c894"/><file name="Database.php" hash="3cceb467358d13584baff58c043762ec"/><file name="Execute.php" hash="9ffc0b88992783e22b5d9e6817d859b3"/><file name="Ftp.php" hash="d5335cfb68f99761d6902dd390a3d7a8"/><file name="Lists.php" hash="07436322d71a6065e75b3fcb902a5952"/><file name="Orders.php" hash="0c5f01418fa2f0fabc8bed26b4434704"/><file name="Publications.php" hash="72ccdc495868308d9831cbf01ddea3b0"/><file name="Sources.php" hash="c67d1e8877e7f3ce907090d8fb7d4f00"/><file name="Subscribers.php" hash="c3093bd2f86fdc3a7e4b2a2d4beadd2b"/></dir><file name="Observer.php" hash="582f3510f6419107f607f029c8170a12"/></dir><dir name="controllers"><dir name="Admin"><file name="AbandonedController.php" hash="485bdcbe2ec956346e232287b8b48c5e"/><file name="ExportController.php" hash="e32b979b0fa256582a85d0d3116b356b"/><file name="TroubleshootingController.php" hash="7a4939b33d875417f19429614d8896ae"/></dir><dir name="Customer"><file name="AccountController.php" hash="16bfdb6de4804a5d71cb972afbff4537"/></dir><file name="AbandonedController.php" hash="12d8655ed118d280320e5457f4933881"/><file name="ExportController.php" hash="d34f5f1842db64f5eb1f18b4938c8c29"/></dir><dir name="etc"><file name="adminhtml.xml" hash="896c10d8a3f932346e7d301052b1b6a6"/><file name="config.xml" hash="e8204c973574a8ce8b364dd58ff218e5"/><file name="system.xml" hash="fb3e4ced708718df052a9e429bbfa8ed"/></dir><dir name="sql"><dir name="emaildirect_setup"><file name="mysql4-install-1.0.0.php" hash="9dc51edb346e9676735e15d3e78fa3eb"/><file name="mysql4-upgrade-1.0.13-1.0.14.php" hash="c42e2677b3960a049d7137b622552084"/><file name="mysql4-upgrade-1.0.19-1.2.0.php" hash="742be042b7f56e7ff2002b0606270ca6"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="emaildirect"><file name="emaildirect-connected-ebizmarts-title.png" hash="faf3858f23eafe3a89cce144fef6bd2a"/><file name="emaildirect-section-background.png" hash="c205ce454fe63280d7d7dd74428b7ea4"/><file name="emaildirect-tab.png" hash="9ddb077b74a7078ac509d79b024631a1"/><file name="emaildirect.css" hash="016ecc627aa3e7e971d53ec73d52858e"/><file name="emaildirect.js" hash="ce03dd6f51ea529fc4acdc5116f4e030"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="emaildirect"><dir name="images"><file name="bkg_block-title.gif" hash="f8c1f130ad69464fe7aff2f589b2ec75"/><file name="dotted_divider.gif" hash="260ebae91ffb1b7c663906b29a069925"/><file name="emaildirect-tile.png" hash="86a0ed36169ab9691480fc995ab674a8"/><file name="i_block-subscribe.gif" hash="9e5fee06a543742045118a95f2debcb8"/></dir><file name="integration.js" hash="d8c8d5bf0ddb4f6ead23bec8a2814475"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="91d689f9f169c4b1e5c59cf19aa89301"/></dir><dir name="template"><dir name="emaildirect"><dir name="abandoned"><file name="grid.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="4d7607ecb15d13cfe8bb0cc889cb724f"/></dir><dir name="form"><dir name="field"><file name="array.phtml" hash="d6af9f840f4dda9c73d106e167ec1bc6"/><file name="button.phtml" hash="ad2811d37509d0919d3b41ecad1f37df"/><file name="trouble.phtml" hash="d7eae00a25ceda36d5880d431a176c6c"/></dir></dir></dir><dir name="convert"><dir name="profile"><file name="export.phtml" hash="86339d17e83bd8dcc2a268b3ace3d9e7"/></dir></dir></dir><dir name="troubleshooting"><dir name="view"><dir name="tab"><file name="download.phtml" hash="78ec34fd9c3c8b660b19f9e799d8e76e"/><file name="info.phtml" hash="547b1e906ed142983d1034e05f6251bd"/><file name="log.phtml" hash="c9e2c9493a2dad579bba4ed53795cf5e"/><file name="submit.phtml" hash="c2269f4a6a52d66bff5eac660d0831bd"/></dir><file name="form.phtml" hash="d2338bfe3598e9315ca8f5ac8d9b5516"/></dir><file name="view.phtml" hash="ee6af3fe79d916af764f41e7e8c5cc37"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="emaildirect.xml" hash="9803fe9024b7eb6415713d81fe27c629"/></dir><dir name="template"><dir name="emaildirect"><dir name="checkout"><file name="subscribe.phtml" hash="351ea790305f0a3ec99c34180bbee235"/></dir><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="4256a03d67ec2a6f97867a87564cff92"/></dir><file name="lists.phtml" hash="4c697dcfa63ece1db7885cadb02982d1"/></dir></dir><dir name="email"><dir name="order"><dir name="items"><dir name="order"><file name="default.phtml" hash="2d65f3d02b9baa08969d68f2a2cca348"/></dir></dir><file name="items.phtml" hash="e6b15e6460010c5acae66017d177bfb9"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="newsletter_subscr_success_emaildirect.html" hash="f6afb69d207bbc3f8920e7a72ac9dd07"/><file name="newsletter_unsub_success_emaildirect.html" hash="bd9f97e8f5485180d4420097b5200ef4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="EmailDirect_Integration.xml" hash="2d2666e6d9cd8d40a4974d5e242721d6"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>