MailUp - Version 2.5.0

Version Notes


  • Allows Single Opt In as an optional setting

  • Make "send opt-in email..." unchecked by default

  • Bug Fix: Cannot overwrite with blank email address

  • Bug Fix: If incorrect URL or login details entered, checkout could be disrupted

Download this release

Release Info

Developer MailUp
Extension MailUp
Version 2.5.0
Comparing to
See all releases


Code changes from version 2.4.1 to 2.5.0

Files changed (30) hide show
  1. app/code/local/SevenLike/MailUp/Block/Adminhtml/Log/Grid.php +159 -159
  2. app/code/local/SevenLike/MailUp/Block/Adminhtml/Mailup/Grid.php +246 -246
  3. app/code/local/SevenLike/MailUp/Block/Adminhtml/Sync/Grid.php +180 -180
  4. app/code/local/SevenLike/MailUp/Helper/Data.php +24 -6
  5. app/code/local/SevenLike/MailUp/Model/Config.php +27 -3
  6. app/code/local/SevenLike/MailUp/Model/Job.php +1 -1
  7. app/code/local/SevenLike/MailUp/Model/Lists.php +23 -14
  8. app/code/local/SevenLike/MailUp/Model/MailUpWsImport.php +40 -15
  9. app/code/local/SevenLike/MailUp/Model/Mysql14/Job.php +0 -30
  10. app/code/local/SevenLike/MailUp/Model/Mysql14/Job/Collection.php +0 -11
  11. app/code/local/SevenLike/MailUp/Model/Mysql4/Job.php +29 -29
  12. app/code/local/SevenLike/MailUp/Model/Mysql4/Job/Collection.php +10 -10
  13. app/code/local/SevenLike/MailUp/Model/Mysql4/Log.php +24 -24
  14. app/code/local/SevenLike/MailUp/Model/Mysql4/Log/Collection.php +10 -10
  15. app/code/local/SevenLike/MailUp/Model/Mysql4/Sync.php +69 -69
  16. app/code/local/SevenLike/MailUp/Model/Mysql4/Sync/Collection.php +10 -10
  17. app/code/local/SevenLike/MailUp/Model/Observer.php +29 -19
  18. app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php +15 -20
  19. app/code/local/SevenLike/MailUp/controllers/TestController.php +6 -72
  20. app/code/local/SevenLike/MailUp/etc/config.xml +2 -0
  21. app/code/local/SevenLike/MailUp/etc/system.xml +10 -0
  22. app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml +1 -1
  23. app/design/adminhtml/default/default/template/sevenlike/mailup/filter_.phtml +0 -526
  24. app/design/frontend/base/default/layout/mailup.xml +0 -1
  25. app/etc/modules/SevenLike_MailUp.xml +1 -1
  26. app/locale/en_US/SevenLike_MailUp.csv +86 -86
  27. app/locale/it_IT/SevenLike_MailUp.csv +105 -105
  28. package.xml +47 -48
  29. skin/adminhtml/default/default/images/MailUp_300_200_transparent_small.png +0 -0
  30. skin/adminhtml/default/default/sevenlike/mailup/mailup.css +1 -1
app/code/local/SevenLike/MailUp/Block/Adminhtml/Log/Grid.php CHANGED
@@ -1,160 +1,160 @@
1
- <?php
2
- /**
3
- * Grid.php
4
- */
5
- class SevenLike_MailUp_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
- {
7
- /**
8
- * Constructor
9
- */
10
- public function __construct()
11
- {
12
- parent::__construct();
13
- $this->setId('MailUpLogGrid');
14
- $this->setDefaultSort('id');
15
- $this->setDefaultDir('ASC');
16
- $this->setSaveParametersInSession(true);
17
- }
18
-
19
- /**
20
- * Prepare Collection
21
- *
22
- * @return
23
- */
24
- protected function _prepareCollection()
25
- {
26
- $collection = Mage::getModel('mailup/log')->getCollection();
27
- $this->setCollection($collection);
28
-
29
- //var_dump(Mage::getModel('mailup/job')->load(1));
30
-
31
- return parent::_prepareCollection();
32
- }
33
-
34
- /**
35
- * Prepare Grid Columns
36
- */
37
- protected function _prepareColumns()
38
- {
39
- $this->addColumn('id', array(
40
- 'header' => Mage::helper('mailup')->__('ID'),
41
- //'align' =>'right',
42
- 'width' => '80px',
43
- 'index' => 'id',
44
- ));
45
-
46
- $this->addColumn('store_id', array(
47
- 'header' => Mage::helper('mailup')->__('Store'),
48
- 'align' => 'left',
49
- //'width' => '150px',
50
- 'index' => 'store_id',
51
- 'type' => 'options',
52
- 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
53
- ));
54
-
55
- $this->addColumn('type', array(
56
- 'header' => Mage::helper('mailup')->__('Type'),
57
- //'align' =>'right',
58
- //'width' => '80px',
59
- 'index' => 'type',
60
- ));
61
-
62
- $this->addColumn('job_id', array(
63
- 'header' => Mage::helper('mailup')->__('Job ID'),
64
- //'align' =>'right',
65
- 'width' => '80px',
66
- 'index' => 'job_id',
67
- ));
68
-
69
- // Not really in use yet!
70
- /*$this->addColumn('status', array(
71
- 'header' => Mage::helper('mailup')->__('Status'),
72
- //'align' =>'right',
73
- //'width' => '80px',
74
- 'index' => 'status',
75
- ));*/
76
-
77
- $this->addColumn('data', array(
78
- 'header' => Mage::helper('mailup')->__('Info'),
79
- //'align' =>'right',
80
- //'width' => '80px',
81
- 'index' => 'data',
82
- ));
83
-
84
- $this->addColumn('event_time', array(
85
- 'header' => Mage::helper('mailup')->__('Event Time'),
86
- 'type' => 'datetime', // Add in Date Picker
87
- //'type' => 'timestamp',
88
- //'align' => 'center',
89
- 'width' => '180px',
90
- 'index' => 'event_time',
91
- //'gmtoffset' => true
92
- ));
93
-
94
- //
95
- //
96
- // $this->addColumn('status', array(
97
- // 'header' => Mage::helper('importer')->__('Status'),
98
- // 'align' => 'left',
99
- // 'width' => '80px',
100
- // 'index' => 'status',
101
- // 'type' => 'options',
102
- // 'options' => array(
103
- // 1 => 'Enabled',
104
- // 2 => 'Disabled',
105
- // ),
106
- // ));
107
- //
108
-
109
- // $this->addColumn('action',
110
- // array(
111
- // 'header' => Mage::helper('mailup')->__('Action'),
112
- // 'width' => '100',
113
- // 'type' => 'action',
114
- // 'getter' => 'getId',
115
- // 'actions' => array(
116
- // array(
117
- // 'caption' => Mage::helper('mailup')->__('Sync'),
118
- // 'url' => array('base'=> '*/*/sync'),
119
- // 'field' => 'id'
120
- // )
121
- // ),
122
- // 'filter' => false,
123
- // 'sortable' => false,
124
- // 'index' => 'stores',
125
- // 'is_system' => true,
126
- // ));
127
-
128
- return parent::_prepareColumns();
129
- }
130
-
131
- // /**
132
- // * Prepare Mass Action
133
- // */
134
- // protected function _prepareMassaction()
135
- // {
136
- // $this->setMassactionIdField('id');
137
- // $this->getMassactionBlock()->setFormFieldName('importer');
138
- //
139
- // $this->getMassactionBlock()->addItem('delete', array(
140
- // 'label' => Mage::helper('importer')->__('Delete'),
141
- // 'url' => $this->getUrl('*/*/massDelete'),
142
- // 'confirm' => Mage::helper('importer')->__('Are you sure?')
143
- // ));
144
- //
145
- // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
146
- // array_unshift($statuses, array('label'=>'', 'value'=>''));
147
- //
148
- // return $this;
149
- // }
150
-
151
- /**
152
- * Get row url - None editable
153
- */
154
- public function getRowUrl($row)
155
- {
156
- return '';
157
- //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
158
- }
159
-
160
}
1
+ <?php
2
+ /**
3
+ * Grid.php
4
+ */
5
+ class SevenLike_MailUp_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
+ {
7
+ /**
8
+ * Constructor
9
+ */
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('MailUpLogGrid');
14
+ $this->setDefaultSort('id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ /**
20
+ * Prepare Collection
21
+ *
22
+ * @return
23
+ */
24
+ protected function _prepareCollection()
25
+ {
26
+ $collection = Mage::getModel('mailup/log')->getCollection();
27
+ $this->setCollection($collection);
28
+
29
+ //var_dump(Mage::getModel('mailup/job')->load(1));
30
+
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ /**
35
+ * Prepare Grid Columns
36
+ */
37
+ protected function _prepareColumns()
38
+ {
39
+ $this->addColumn('id', array(
40
+ 'header' => Mage::helper('mailup')->__('ID'),
41
+ //'align' =>'right',
42
+ 'width' => '80px',
43
+ 'index' => 'id',
44
+ ));
45
+
46
+ $this->addColumn('store_id', array(
47
+ 'header' => Mage::helper('mailup')->__('Store'),
48
+ 'align' => 'left',
49
+ //'width' => '150px',
50
+ 'index' => 'store_id',
51
+ 'type' => 'options',
52
+ 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
53
+ ));
54
+
55
+ $this->addColumn('type', array(
56
+ 'header' => Mage::helper('mailup')->__('Type'),
57
+ //'align' =>'right',
58
+ //'width' => '80px',
59
+ 'index' => 'type',
60
+ ));
61
+
62
+ $this->addColumn('job_id', array(
63
+ 'header' => Mage::helper('mailup')->__('Job ID'),
64
+ //'align' =>'right',
65
+ 'width' => '80px',
66
+ 'index' => 'job_id',
67
+ ));
68
+
69
+ // Not really in use yet!
70
+ /*$this->addColumn('status', array(
71
+ 'header' => Mage::helper('mailup')->__('Status'),
72
+ //'align' =>'right',
73
+ //'width' => '80px',
74
+ 'index' => 'status',
75
+ ));*/
76
+
77
+ $this->addColumn('data', array(
78
+ 'header' => Mage::helper('mailup')->__('Info'),
79
+ //'align' =>'right',
80
+ //'width' => '80px',
81
+ 'index' => 'data',
82
+ ));
83
+
84
+ $this->addColumn('event_time', array(
85
+ 'header' => Mage::helper('mailup')->__('Event Time'),
86
+ 'type' => 'datetime', // Add in Date Picker
87
+ //'type' => 'timestamp',
88
+ //'align' => 'center',
89
+ 'width' => '180px',
90
+ 'index' => 'event_time',
91
+ //'gmtoffset' => true
92
+ ));
93
+
94
+ //
95
+ //
96
+ // $this->addColumn('status', array(
97
+ // 'header' => Mage::helper('importer')->__('Status'),
98
+ // 'align' => 'left',
99
+ // 'width' => '80px',
100
+ // 'index' => 'status',
101
+ // 'type' => 'options',
102
+ // 'options' => array(
103
+ // 1 => 'Enabled',
104
+ // 2 => 'Disabled',
105
+ // ),
106
+ // ));
107
+ //
108
+
109
+ // $this->addColumn('action',
110
+ // array(
111
+ // 'header' => Mage::helper('mailup')->__('Action'),
112
+ // 'width' => '100',
113
+ // 'type' => 'action',
114
+ // 'getter' => 'getId',
115
+ // 'actions' => array(
116
+ // array(
117
+ // 'caption' => Mage::helper('mailup')->__('Sync'),
118
+ // 'url' => array('base'=> '*/*/sync'),
119
+ // 'field' => 'id'
120
+ // )
121
+ // ),
122
+ // 'filter' => false,
123
+ // 'sortable' => false,
124
+ // 'index' => 'stores',
125
+ // 'is_system' => true,
126
+ // ));
127
+
128
+ return parent::_prepareColumns();
129
+ }
130
+
131
+ // /**
132
+ // * Prepare Mass Action
133
+ // */
134
+ // protected function _prepareMassaction()
135
+ // {
136
+ // $this->setMassactionIdField('id');
137
+ // $this->getMassactionBlock()->setFormFieldName('importer');
138
+ //
139
+ // $this->getMassactionBlock()->addItem('delete', array(
140
+ // 'label' => Mage::helper('importer')->__('Delete'),
141
+ // 'url' => $this->getUrl('*/*/massDelete'),
142
+ // 'confirm' => Mage::helper('importer')->__('Are you sure?')
143
+ // ));
144
+ //
145
+ // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
146
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
147
+ //
148
+ // return $this;
149
+ // }
150
+
151
+ /**
152
+ * Get row url - None editable
153
+ */
154
+ public function getRowUrl($row)
155
+ {
156
+ return '';
157
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
158
+ }
159
+
160
}
app/code/local/SevenLike/MailUp/Block/Adminhtml/Mailup/Grid.php CHANGED
@@ -1,247 +1,247 @@
1
- <?php
2
- /**
3
- * Grid.php
4
- */
5
- class SevenLike_MailUp_Block_Adminhtml_MailUp_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
- {
7
- /**
8
- * Constructor
9
- */
10
- public function __construct()
11
- {
12
- parent::__construct();
13
- $this->setId('MailUpGrid');
14
- $this->setDefaultSort('id');
15
- $this->setDefaultDir('ASC');
16
- $this->setSaveParametersInSession(true);
17
- }
18
-
19
- /**
20
- * Prepare Collection
21
- *
22
- * @return
23
- */
24
- protected function _prepareCollection()
25
- {
26
- $collection = Mage::getModel('mailup/job')->getCollection();
27
- $this->setCollection($collection);
28
-
29
- //var_dump(Mage::getModel('mailup/job')->load(1));
30
-
31
- return parent::_prepareCollection();
32
- }
33
-
34
- /**
35
- * Prepare Grid Columns
36
- */
37
- protected function _prepareColumns()
38
- {
39
- $this->addColumn('id', array(
40
- 'header' => Mage::helper('mailup')->__('ID'),
41
- //'align' =>'right',
42
- 'width' => '80px',
43
- 'index' => 'id',
44
- ));
45
-
46
- $this->addColumn('type', array(
47
- 'header' => Mage::helper('mailup')->__('Type'),
48
- 'align' => 'left',
49
- 'index' => 'type',
50
- 'type' => 'options',
51
- 'options' => array(
52
- 0 => 'Manual Sync',
53
- 1 => 'Auto Sync',
54
- //2 => 'Disabled',
55
- ),
56
- ));
57
-
58
- $this->addColumn('store_id', array(
59
- 'header' => Mage::helper('mailup')->__('Store'),
60
- 'align' => 'left',
61
- //'width' => '150px',
62
- 'index' => 'store_id',
63
- 'type' => 'options',
64
- 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
65
- ));
66
-
67
- /*$this->addColumn('store_id', array(
68
- 'header' => Mage::helper('mailup')->__('Store ID'),
69
- //'align' =>'right',
70
- 'width' => '80px',
71
- 'index' => 'store_id',
72
- ));*/
73
-
74
- $this->addColumn('mailupgroupid', array(
75
- 'header' => Mage::helper('mailup')->__('Mailup Group ID'),
76
- //'align' =>'right',
77
- 'width' => '80px',
78
- 'index' => 'mailupgroupid',
79
- ));
80
-
81
- $this->addColumn('list_id', array(
82
- 'header' => Mage::helper('mailup')->__('Mailup List ID'),
83
- //'align' =>'right',
84
- 'width' => '80px',
85
- 'index' => 'list_id',
86
- ));
87
-
88
- $this->addColumn('list_guid', array(
89
- 'header' => Mage::helper('mailup')->__('Mailup List GUID'),
90
- 'index' => 'list_guid',
91
- ));
92
-
93
- $this->addColumn('send_optin', array(
94
- 'header' => Mage::helper('mailup')->__('Opt In'),
95
- 'align' => 'left',
96
- 'index' => 'send_optin',
97
- 'type' => 'options',
98
- 'options' => array(
99
- 0 => 'No',
100
- 1 => 'Yes',
101
- ),
102
- ));
103
-
104
- $this->addColumn('as_pending', array(
105
- 'header' => Mage::helper('mailup')->__('As Pending'),
106
- 'align' => 'left',
107
- 'index' => 'as_pending',
108
- 'type' => 'options',
109
- 'options' => array(
110
- 0 => 'No',
111
- 1 => 'Yes',
112
- ),
113
- ));
114
-
115
- $this->addColumn('status', array(
116
- 'header' => Mage::helper('mailup')->__('Status'),
117
- //'align' =>'right',
118
- 'index' => 'status',
119
- ));
120
-
121
- $this->addColumn('process_id', array(
122
- 'header' => Mage::helper('mailup')->__('Process ID'),
123
- //'align' =>'right',
124
- 'width' => '80px',
125
- 'index' => 'process_id',
126
- ));
127
-
128
- $this->addColumn('tries', array(
129
- 'header' => Mage::helper('mailup')->__('Tries'),
130
- //'align' =>'right',
131
- 'width' => '50px',
132
- 'index' => 'tries',
133
- ));
134
-
135
- $this->addColumn('queue_datetime', array(
136
- 'header' => Mage::helper('mailup')->__('Queue Time'),
137
- 'type' => 'datetime', // Add in Date Picker
138
- //'type' => 'timestamp',
139
- //'align' => 'center',
140
- 'width' => '180px',
141
- 'index' => 'queue_datetime',
142
- //'gmtoffset' => true
143
- ));
144
-
145
- $this->addColumn('start_datetime', array(
146
- 'header' => Mage::helper('mailup')->__('Started'),
147
- 'type' => 'datetime', // Add in Date Picker
148
- //'type' => 'timestamp',
149
- //'align' => 'center',
150
- 'width' => '180px',
151
- 'index' => 'start_datetime',
152
- //'gmtoffset' => true
153
- ));
154
-
155
- $this->addColumn('finish_datetime', array(
156
- 'header' => Mage::helper('mailup')->__('Finished'),
157
- 'type' => 'datetime', // Add in Date Picker
158
- //'type' => 'timestamp',
159
- //'align' => 'center',
160
- 'width' => '180px',
161
- 'index' => 'finish_datetime',
162
- //'gmtoffset' => true
163
- ));
164
-
165
- //
166
- //
167
- // $this->addColumn('status', array(
168
- // 'header' => Mage::helper('importer')->__('Status'),
169
- // 'align' => 'left',
170
- // 'width' => '80px',
171
- // 'index' => 'status',
172
- // 'type' => 'options',
173
- // 'options' => array(
174
- // 1 => 'Enabled',
175
- // 2 => 'Disabled',
176
- // ),
177
- // ));
178
- //
179
-
180
- $this->addColumn('action',
181
- array(
182
- 'header' => Mage::helper('mailup')->__('Action'),
183
- 'width' => '100',
184
- 'type' => 'action',
185
- 'getter' => 'getId',
186
- 'actions' => array(
187
- array(
188
- 'caption' => Mage::helper('mailup')->__('Run'),
189
- 'url' => array('base'=> '*/*/runjob'),
190
- 'field' => 'id'
191
- ),
192
- array(
193
- 'caption' => Mage::helper('mailup')->__('StartProcess'),
194
- 'url' => array('base'=> '*/*/startProcess'),
195
- 'field' => 'id'
196
- ),
197
- array(
198
- 'caption' => Mage::helper('mailup')->__('GetProcessDetail'),
199
- 'url' => array('base'=> '*/*/getProcessDetail'),
200
- 'field' => 'id'
201
- ),
202
- array(
203
- 'caption' => Mage::helper('mailup')->__('Delete'),
204
- 'url' => array('base'=> '*/*/delete'),
205
- 'field' => 'id'
206
- ),
207
- ),
208
- 'filter' => false,
209
- 'sortable' => false,
210
- 'index' => 'stores',
211
- 'is_system' => true,
212
- ));
213
-
214
-
215
- return parent::_prepareColumns();
216
- }
217
-
218
- // /**
219
- // * Prepare Mass Action
220
- // */
221
- // protected function _prepareMassaction()
222
- // {
223
- // $this->setMassactionIdField('id');
224
- // $this->getMassactionBlock()->setFormFieldName('importer');
225
- //
226
- // $this->getMassactionBlock()->addItem('delete', array(
227
- // 'label' => Mage::helper('importer')->__('Delete'),
228
- // 'url' => $this->getUrl('*/*/massDelete'),
229
- // 'confirm' => Mage::helper('importer')->__('Are you sure?')
230
- // ));
231
- //
232
- // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
233
- // array_unshift($statuses, array('label'=>'', 'value'=>''));
234
- //
235
- // return $this;
236
- // }
237
-
238
- /**
239
- * Get row url - None editable
240
- */
241
- public function getRowUrl($row)
242
- {
243
- return '';
244
- //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
245
- }
246
-
247
}
1
+ <?php
2
+ /**
3
+ * Grid.php
4
+ */
5
+ class SevenLike_MailUp_Block_Adminhtml_MailUp_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
+ {
7
+ /**
8
+ * Constructor
9
+ */
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('MailUpGrid');
14
+ $this->setDefaultSort('id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ /**
20
+ * Prepare Collection
21
+ *
22
+ * @return
23
+ */
24
+ protected function _prepareCollection()
25
+ {
26
+ $collection = Mage::getModel('mailup/job')->getCollection();
27
+ $this->setCollection($collection);
28
+
29
+ //var_dump(Mage::getModel('mailup/job')->load(1));
30
+
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ /**
35
+ * Prepare Grid Columns
36
+ */
37
+ protected function _prepareColumns()
38
+ {
39
+ $this->addColumn('id', array(
40
+ 'header' => Mage::helper('mailup')->__('ID'),
41
+ //'align' =>'right',
42
+ 'width' => '80px',
43
+ 'index' => 'id',
44
+ ));
45
+
46
+ $this->addColumn('type', array(
47
+ 'header' => Mage::helper('mailup')->__('Type'),
48
+ 'align' => 'left',
49
+ 'index' => 'type',
50
+ 'type' => 'options',
51
+ 'options' => array(
52
+ 0 => 'Manual Sync',
53
+ 1 => 'Auto Sync',
54
+ //2 => 'Disabled',
55
+ ),
56
+ ));
57
+
58
+ $this->addColumn('store_id', array(
59
+ 'header' => Mage::helper('mailup')->__('Store'),
60
+ 'align' => 'left',
61
+ //'width' => '150px',
62
+ 'index' => 'store_id',
63
+ 'type' => 'options',
64
+ 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
65
+ ));
66
+
67
+ /*$this->addColumn('store_id', array(
68
+ 'header' => Mage::helper('mailup')->__('Store ID'),
69
+ //'align' =>'right',
70
+ 'width' => '80px',
71
+ 'index' => 'store_id',
72
+ ));*/
73
+
74
+ $this->addColumn('mailupgroupid', array(
75
+ 'header' => Mage::helper('mailup')->__('Mailup Group ID'),
76
+ //'align' =>'right',
77
+ 'width' => '80px',
78
+ 'index' => 'mailupgroupid',
79
+ ));
80
+
81
+ $this->addColumn('list_id', array(
82
+ 'header' => Mage::helper('mailup')->__('Mailup List ID'),
83
+ //'align' =>'right',
84
+ 'width' => '80px',
85
+ 'index' => 'list_id',
86
+ ));
87
+
88
+ $this->addColumn('list_guid', array(
89
+ 'header' => Mage::helper('mailup')->__('Mailup List GUID'),
90
+ 'index' => 'list_guid',
91
+ ));
92
+
93
+ $this->addColumn('send_optin', array(
94
+ 'header' => Mage::helper('mailup')->__('Opt In'),
95
+ 'align' => 'left',
96
+ 'index' => 'send_optin',
97
+ 'type' => 'options',
98
+ 'options' => array(
99
+ 0 => 'No',
100
+ 1 => 'Yes',
101
+ ),
102
+ ));
103
+
104
+ $this->addColumn('as_pending', array(
105
+ 'header' => Mage::helper('mailup')->__('As Pending'),
106
+ 'align' => 'left',
107
+ 'index' => 'as_pending',
108
+ 'type' => 'options',
109
+ 'options' => array(
110
+ 0 => 'No',
111
+ 1 => 'Yes',
112
+ ),
113
+ ));
114
+
115
+ $this->addColumn('status', array(
116
+ 'header' => Mage::helper('mailup')->__('Status'),
117
+ //'align' =>'right',
118
+ 'index' => 'status',
119
+ ));
120
+
121
+ $this->addColumn('process_id', array(
122
+ 'header' => Mage::helper('mailup')->__('Process ID'),
123
+ //'align' =>'right',
124
+ 'width' => '80px',
125
+ 'index' => 'process_id',
126
+ ));
127
+
128
+ $this->addColumn('tries', array(
129
+ 'header' => Mage::helper('mailup')->__('Tries'),
130
+ //'align' =>'right',
131
+ 'width' => '50px',
132
+ 'index' => 'tries',
133
+ ));
134
+
135
+ $this->addColumn('queue_datetime', array(
136
+ 'header' => Mage::helper('mailup')->__('Queue Time'),
137
+ 'type' => 'datetime', // Add in Date Picker
138
+ //'type' => 'timestamp',
139
+ //'align' => 'center',
140
+ 'width' => '180px',
141
+ 'index' => 'queue_datetime',
142
+ //'gmtoffset' => true
143
+ ));
144
+
145
+ $this->addColumn('start_datetime', array(
146
+ 'header' => Mage::helper('mailup')->__('Started'),
147
+ 'type' => 'datetime', // Add in Date Picker
148
+ //'type' => 'timestamp',
149
+ //'align' => 'center',
150
+ 'width' => '180px',
151
+ 'index' => 'start_datetime',
152
+ //'gmtoffset' => true
153
+ ));
154
+
155
+ $this->addColumn('finish_datetime', array(
156
+ 'header' => Mage::helper('mailup')->__('Finished'),
157
+ 'type' => 'datetime', // Add in Date Picker
158
+ //'type' => 'timestamp',
159
+ //'align' => 'center',
160
+ 'width' => '180px',
161
+ 'index' => 'finish_datetime',
162
+ //'gmtoffset' => true
163
+ ));
164
+
165
+ //
166
+ //
167
+ // $this->addColumn('status', array(
168
+ // 'header' => Mage::helper('importer')->__('Status'),
169
+ // 'align' => 'left',
170
+ // 'width' => '80px',
171
+ // 'index' => 'status',
172
+ // 'type' => 'options',
173
+ // 'options' => array(
174
+ // 1 => 'Enabled',
175
+ // 2 => 'Disabled',
176
+ // ),
177
+ // ));
178
+ //
179
+
180
+ $this->addColumn('action',
181
+ array(
182
+ 'header' => Mage::helper('mailup')->__('Action'),
183
+ 'width' => '100',
184
+ 'type' => 'action',
185
+ 'getter' => 'getId',
186
+ 'actions' => array(
187
+ array(
188
+ 'caption' => Mage::helper('mailup')->__('Run'),
189
+ 'url' => array('base'=> '*/*/runjob'),
190
+ 'field' => 'id'
191
+ ),
192
+ array(
193
+ 'caption' => Mage::helper('mailup')->__('StartProcess'),
194
+ 'url' => array('base'=> '*/*/startProcess'),
195
+ 'field' => 'id'
196
+ ),
197
+ array(
198
+ 'caption' => Mage::helper('mailup')->__('GetProcessDetail'),
199
+ 'url' => array('base'=> '*/*/getProcessDetail'),
200
+ 'field' => 'id'
201
+ ),
202
+ array(
203
+ 'caption' => Mage::helper('mailup')->__('Delete'),
204
+ 'url' => array('base'=> '*/*/delete'),
205
+ 'field' => 'id'
206
+ ),
207
+ ),
208
+ 'filter' => false,
209
+ 'sortable' => false,
210
+ 'index' => 'stores',
211
+ 'is_system' => true,
212
+ ));
213
+
214
+
215
+ return parent::_prepareColumns();
216
+ }
217
+
218
+ // /**
219
+ // * Prepare Mass Action
220
+ // */
221
+ // protected function _prepareMassaction()
222
+ // {
223
+ // $this->setMassactionIdField('id');
224
+ // $this->getMassactionBlock()->setFormFieldName('importer');
225
+ //
226
+ // $this->getMassactionBlock()->addItem('delete', array(
227
+ // 'label' => Mage::helper('importer')->__('Delete'),
228
+ // 'url' => $this->getUrl('*/*/massDelete'),
229
+ // 'confirm' => Mage::helper('importer')->__('Are you sure?')
230
+ // ));
231
+ //
232
+ // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
233
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
234
+ //
235
+ // return $this;
236
+ // }
237
+
238
+ /**
239
+ * Get row url - None editable
240
+ */
241
+ public function getRowUrl($row)
242
+ {
243
+ return '';
244
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
245
+ }
246
+
247
}
app/code/local/SevenLike/MailUp/Block/Adminhtml/Sync/Grid.php CHANGED
@@ -1,181 +1,181 @@
1
- <?php
2
- /**
3
- * Grid.php
4
- */
5
- class SevenLike_MailUp_Block_Adminhtml_Sync_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
- {
7
- /**
8
- * Constructor
9
- */
10
- public function __construct()
11
- {
12
- parent::__construct();
13
- $this->setId('MailUpSyncGrid');
14
- $this->setDefaultSort('id');
15
- $this->setDefaultDir('ASC');
16
- $this->setSaveParametersInSession(true);
17
- }
18
-
19
- /**
20
- * Prepare Collection
21
- *
22
- * @return
23
- */
24
- protected function _prepareCollection()
25
- {
26
- $collection = Mage::getModel('mailup/sync')->getCollection();
27
- $this->setCollection($collection);
28
-
29
- //var_dump(Mage::getModel('mailup/job')->load(1));
30
-
31
- return parent::_prepareCollection();
32
- }
33
-
34
- /**
35
- * Prepare Grid Columns
36
- */
37
- protected function _prepareColumns()
38
- {
39
- $this->addColumn('id', array(
40
- 'header' => Mage::helper('mailup')->__('ID'),
41
- //'align' =>'right',
42
- 'width' => '80px',
43
- 'index' => 'id',
44
- ));
45
-
46
-
47
-
48
- $this->addColumn('store_id', array(
49
- 'header' => Mage::helper('mailup')->__('Store'),
50
- 'align' => 'left',
51
- //'width' => '150px',
52
- 'index' => 'store_id',
53
- 'type' => 'options',
54
- 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
55
- ));
56
-
57
- /*$this->addColumn('store_id', array(
58
- 'header' => Mage::helper('mailup')->__('Store ID'),
59
- //'align' =>'right',
60
- 'width' => '80px',
61
- 'index' => 'store_id',
62
- ));*/
63
-
64
- $this->addColumn('customer_id', array(
65
- 'header' => Mage::helper('mailup')->__('Customer ID'),
66
- //'align' =>'right',
67
- 'width' => '80px',
68
- 'index' => 'customer_id',
69
- ));
70
-
71
- $this->addColumn('entity', array(
72
- 'header' => Mage::helper('mailup')->__('Entity'),
73
- //'align' =>'right',
74
- //'width' => '80px',
75
- 'index' => 'entity',
76
- ));
77
-
78
- $this->addColumn('job_id', array(
79
- 'header' => Mage::helper('mailup')->__('Job ID'),
80
- //'align' =>'right',
81
- 'width' => '80px',
82
- 'index' => 'job_id',
83
- ));
84
-
85
- $this->addColumn('needs_sync', array(
86
- 'header' => Mage::helper('mailup')->__('Needs Sync'),
87
- 'align' => 'left',
88
- 'index' => 'needs_sync',
89
- 'type' => 'options',
90
- 'options' => array(
91
- 0 => 'No',
92
- 1 => 'Yes',
93
- ),
94
- ));
95
-
96
- $this->addColumn('created', array(
97
- 'header' => Mage::helper('mailup')->__('Created'),
98
- 'type' => 'timestamp',
99
- //'align' => 'center',
100
- 'width' => '180px',
101
- 'index' => 'created',
102
- //'gmtoffset' => true
103
- ));
104
-
105
- $this->addColumn('last_sync', array(
106
- 'header' => Mage::helper('mailup')->__('Last Sync Time'),
107
- 'type' => 'datetime', // Add in Date Picker
108
- //'type' => 'timestamp',
109
- //'align' => 'center',
110
- 'width' => '180px',
111
- 'index' => 'last_sync',
112
- //'gmtoffset' => true
113
- ));
114
-
115
- //
116
- //
117
- // $this->addColumn('status', array(
118
- // 'header' => Mage::helper('importer')->__('Status'),
119
- // 'align' => 'left',
120
- // 'width' => '80px',
121
- // 'index' => 'status',
122
- // 'type' => 'options',
123
- // 'options' => array(
124
- // 1 => 'Enabled',
125
- // 2 => 'Disabled',
126
- // ),
127
- // ));
128
- //
129
-
130
- // $this->addColumn('action',
131
- // array(
132
- // 'header' => Mage::helper('mailup')->__('Action'),
133
- // 'width' => '100',
134
- // 'type' => 'action',
135
- // 'getter' => 'getId',
136
- // 'actions' => array(
137
- // array(
138
- // 'caption' => Mage::helper('mailup')->__('Sync'),
139
- // 'url' => array('base'=> '*/*/sync'),
140
- // 'field' => 'id'
141
- // )
142
- // ),
143
- // 'filter' => false,
144
- // 'sortable' => false,
145
- // 'index' => 'stores',
146
- // 'is_system' => true,
147
- // ));
148
-
149
- return parent::_prepareColumns();
150
- }
151
-
152
- // /**
153
- // * Prepare Mass Action
154
- // */
155
- // protected function _prepareMassaction()
156
- // {
157
- // $this->setMassactionIdField('id');
158
- // $this->getMassactionBlock()->setFormFieldName('importer');
159
- //
160
- // $this->getMassactionBlock()->addItem('delete', array(
161
- // 'label' => Mage::helper('importer')->__('Delete'),
162
- // 'url' => $this->getUrl('*/*/massDelete'),
163
- // 'confirm' => Mage::helper('importer')->__('Are you sure?')
164
- // ));
165
- //
166
- // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
167
- // array_unshift($statuses, array('label'=>'', 'value'=>''));
168
- //
169
- // return $this;
170
- // }
171
-
172
- /**
173
- * Get row url - None editable
174
- */
175
- public function getRowUrl($row)
176
- {
177
- return '';
178
- //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
179
- }
180
-
181
}
1
+ <?php
2
+ /**
3
+ * Grid.php
4
+ */
5
+ class SevenLike_MailUp_Block_Adminhtml_Sync_Grid extends Mage_Adminhtml_Block_Widget_Grid
6
+ {
7
+ /**
8
+ * Constructor
9
+ */
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('MailUpSyncGrid');
14
+ $this->setDefaultSort('id');
15
+ $this->setDefaultDir('ASC');
16
+ $this->setSaveParametersInSession(true);
17
+ }
18
+
19
+ /**
20
+ * Prepare Collection
21
+ *
22
+ * @return
23
+ */
24
+ protected function _prepareCollection()
25
+ {
26
+ $collection = Mage::getModel('mailup/sync')->getCollection();
27
+ $this->setCollection($collection);
28
+
29
+ //var_dump(Mage::getModel('mailup/job')->load(1));
30
+
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ /**
35
+ * Prepare Grid Columns
36
+ */
37
+ protected function _prepareColumns()
38
+ {
39
+ $this->addColumn('id', array(
40
+ 'header' => Mage::helper('mailup')->__('ID'),
41
+ //'align' =>'right',
42
+ 'width' => '80px',
43
+ 'index' => 'id',
44
+ ));
45
+
46
+
47
+
48
+ $this->addColumn('store_id', array(
49
+ 'header' => Mage::helper('mailup')->__('Store'),
50
+ 'align' => 'left',
51
+ //'width' => '150px',
52
+ 'index' => 'store_id',
53
+ 'type' => 'options',
54
+ 'options' => Mage::getModel('mailup/source_store')->getSelectOptions(),
55
+ ));
56
+
57
+ /*$this->addColumn('store_id', array(
58
+ 'header' => Mage::helper('mailup')->__('Store ID'),
59
+ //'align' =>'right',
60
+ 'width' => '80px',
61
+ 'index' => 'store_id',
62
+ ));*/
63
+
64
+ $this->addColumn('customer_id', array(
65
+ 'header' => Mage::helper('mailup')->__('Customer ID'),
66
+ //'align' =>'right',
67
+ 'width' => '80px',
68
+ 'index' => 'customer_id',
69
+ ));
70
+
71
+ $this->addColumn('entity', array(
72
+ 'header' => Mage::helper('mailup')->__('Entity'),
73
+ //'align' =>'right',
74
+ //'width' => '80px',
75
+ 'index' => 'entity',
76
+ ));
77
+
78
+ $this->addColumn('job_id', array(
79
+ 'header' => Mage::helper('mailup')->__('Job ID'),
80
+ //'align' =>'right',
81
+ 'width' => '80px',
82
+ 'index' => 'job_id',
83
+ ));
84
+
85
+ $this->addColumn('needs_sync', array(
86
+ 'header' => Mage::helper('mailup')->__('Needs Sync'),
87
+ 'align' => 'left',
88
+ 'index' => 'needs_sync',
89
+ 'type' => 'options',
90
+ 'options' => array(
91
+ 0 => 'No',
92
+ 1 => 'Yes',
93
+ ),
94
+ ));
95
+
96
+ $this->addColumn('created', array(
97
+ 'header' => Mage::helper('mailup')->__('Created'),
98
+ 'type' => 'timestamp',
99
+ //'align' => 'center',
100
+ 'width' => '180px',
101
+ 'index' => 'created',
102
+ //'gmtoffset' => true
103
+ ));
104
+
105
+ $this->addColumn('last_sync', array(
106
+ 'header' => Mage::helper('mailup')->__('Last Sync Time'),
107
+ 'type' => 'datetime', // Add in Date Picker
108
+ //'type' => 'timestamp',
109
+ //'align' => 'center',
110
+ 'width' => '180px',
111
+ 'index' => 'last_sync',
112
+ //'gmtoffset' => true
113
+ ));
114
+
115
+ //
116
+ //
117
+ // $this->addColumn('status', array(
118
+ // 'header' => Mage::helper('importer')->__('Status'),
119
+ // 'align' => 'left',
120
+ // 'width' => '80px',
121
+ // 'index' => 'status',
122
+ // 'type' => 'options',
123
+ // 'options' => array(
124
+ // 1 => 'Enabled',
125
+ // 2 => 'Disabled',
126
+ // ),
127
+ // ));
128
+ //
129
+
130
+ // $this->addColumn('action',
131
+ // array(
132
+ // 'header' => Mage::helper('mailup')->__('Action'),
133
+ // 'width' => '100',
134
+ // 'type' => 'action',
135
+ // 'getter' => 'getId',
136
+ // 'actions' => array(
137
+ // array(
138
+ // 'caption' => Mage::helper('mailup')->__('Sync'),
139
+ // 'url' => array('base'=> '*/*/sync'),
140
+ // 'field' => 'id'
141
+ // )
142
+ // ),
143
+ // 'filter' => false,
144
+ // 'sortable' => false,
145
+ // 'index' => 'stores',
146
+ // 'is_system' => true,
147
+ // ));
148
+
149
+ return parent::_prepareColumns();
150
+ }
151
+
152
+ // /**
153
+ // * Prepare Mass Action
154
+ // */
155
+ // protected function _prepareMassaction()
156
+ // {
157
+ // $this->setMassactionIdField('id');
158
+ // $this->getMassactionBlock()->setFormFieldName('importer');
159
+ //
160
+ // $this->getMassactionBlock()->addItem('delete', array(
161
+ // 'label' => Mage::helper('importer')->__('Delete'),
162
+ // 'url' => $this->getUrl('*/*/massDelete'),
163
+ // 'confirm' => Mage::helper('importer')->__('Are you sure?')
164
+ // ));
165
+ //
166
+ // $statuses = Mage::getSingleton('importer/import')->getOptionArray();
167
+ // array_unshift($statuses, array('label'=>'', 'value'=>''));
168
+ //
169
+ // return $this;
170
+ // }
171
+
172
+ /**
173
+ * Get row url - None editable
174
+ */
175
+ public function getRowUrl($row)
176
+ {
177
+ return '';
178
+ //return $this->getUrl('*/*/edit', array('id' => $row->getId()));
179
+ }
180
+
181
}
app/code/local/SevenLike/MailUp/Helper/Data.php CHANGED
@@ -6,6 +6,24 @@
6
*/
7
class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
8
{
9
/**
10
* split customers into batches
11
*/
@@ -349,12 +367,12 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
349
"idGroup" => $groupId,
350
"xmlDoc" => "",
351
"idGroups" => $groupId,
352
- "importType" => 1,
353
- "mobileInputType" => 2,
354
"asPending" => $jobModel->getAsPending() ? 1 : 0,
355
"ConfirmEmail" => $jobModel->getSendOptin() ? 1 : 0,
356
"asOptOut" => 0,
357
- "forceOptIn" => 0, //1,
358
"replaceGroups" => 0,
359
"idConfirmNL" => 0
360
);
@@ -403,12 +421,12 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
403
'listsGUIDs' => $post['mailupListGUID'],
404
'groupsIDs' => $groupId,
405
"idList" => $idList,
406
- "importType" => 1,
407
- "mobileInputType" => 2,
408
"asPending" => $jobModel->getAsPending() ? 1 : 0,
409
"ConfirmEmail" => $jobModel->getSendOptin() ? 1 : 0,
410
"asOptOut" => 0,
411
- "forceOptIn" => 0, //1,
412
"replaceGroups" => 0,
413
"idConfirmNL" => 0
414
);
6
*/
7
class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
8
{
9
+ /**
10
+ * importType takes one of the following values, varying:
11
+ * - Whether to import email, sms or both (in the former cases, the other is discarded)
12
+ * - Whether empty fields over-write the values in MailUp (4-6) or are ignored (1-3)
13
+ */
14
+ const IMPORT_TYPE_IGNORE_EMPTY_ONLY_EMAIL = 1;
15
+ const IMPORT_TYPE_IGNORE_EMPTY_ONLY_SMS = 2;
16
+ const IMPORT_TYPE_IGNORE_EMPTY_EMAIL_AND_SMS = 3;
17
+ const IMPORT_TYPE_REPLACE_EMPTY_ONLY_EMAIL = 4;
18
+ const IMPORT_TYPE_REPLACE_EMPTY_ONLY_SMS = 5;
19
+ const IMPORT_TYPE_REPLACE_EMPTY_EMAIL_AND_SMS = 6;
20
+
21
+ /**
22
+ * Whether the mobile input type splits the international code into a seperate field
23
+ */
24
+ const MOBILE_INPUT_TYPE_INCLUDE_INTL_CODE = 1;
25
+ const MOBILE_INPUT_TYPE_SPLIT_INTL_CODE = 2;
26
+
27
/**
28
* split customers into batches
29
*/
367
"idGroup" => $groupId,
368
"xmlDoc" => "",
369
"idGroups" => $groupId,
370
+ "importType" => self::IMPORT_TYPE_REPLACE_EMPTY_ONLY_EMAIL,
371
+ "mobileInputType" => self::MOBILE_INPUT_TYPE_SPLIT_INTL_CODE,
372
"asPending" => $jobModel->getAsPending() ? 1 : 0,
373
"ConfirmEmail" => $jobModel->getSendOptin() ? 1 : 0,
374
"asOptOut" => 0,
375
+ "forceOptIn" => 0, // Dangerous to use as this can over-write pending/un-subscribe statuses
376
"replaceGroups" => 0,
377
"idConfirmNL" => 0
378
);
421
'listsGUIDs' => $post['mailupListGUID'],
422
'groupsIDs' => $groupId,
423
"idList" => $idList,
424
+ "importType" => self::IMPORT_TYPE_REPLACE_EMPTY_ONLY_EMAIL,
425
+ "mobileInputType" => self::MOBILE_INPUT_TYPE_SPLIT_INTL_CODE,
426
"asPending" => $jobModel->getAsPending() ? 1 : 0,
427
"ConfirmEmail" => $jobModel->getSendOptin() ? 1 : 0,
428
"asOptOut" => 0,
429
+ "forceOptIn" => 0, // Dangerous to use as this can over-write pending/un-subscribe statuses
430
"replaceGroups" => 0,
431
"idConfirmNL" => 0
432
);
app/code/local/SevenLike/MailUp/Model/Config.php CHANGED
@@ -13,12 +13,25 @@ class SevenLike_MailUp_Model_Config
13
const XML_MAILUP_PASSWORD = 'mailup_newsletter/mailup/password_ws';
14
const XML_MAILUP_LIST_ID = 'mailup_newsletter/mailup/list';
15
const XML_SUBSCRIBE_IN_CHECKOUT = 'mailup_newsletter/mailup/enable_subscribe_in_checkout';
16
const XML_CRON_FREQ = 'mailup_newsletter/mailup/mailup_cron_frequency';
17
const XML_WEBHOOK_KEY = 'mailup_newsletter/mailup/webhook_crypt_key';
18
const XML_DISABLE_NOTIFICATION = 'mailup_newsletter/mailup/disablenewslettersuccesses';
19
20
const XML_MAPPING_SECTION = 'mailup_newsletter/mailup_mapping';
21
-
22
/**
23
* Is the log enabled?
24
*
@@ -31,7 +44,7 @@ class SevenLike_MailUp_Model_Config
31
}
32
33
/**
34
- * Write a log entry it enabled.
35
*
36
* @param string
37
* @param int
@@ -47,7 +60,7 @@ class SevenLike_MailUp_Model_Config
47
}
48
49
/**
50
- * Write a log entry it enabled.
51
*
52
* @param string
53
* @param int
@@ -172,6 +185,17 @@ class SevenLike_MailUp_Model_Config
172
{
173
return (int) Mage::getStoreConfig(self::XML_SUBSCRIBE_IN_CHECKOUT, $storeId);
174
}
175
176
/**
177
* Get the cron freq settings
13
const XML_MAILUP_PASSWORD = 'mailup_newsletter/mailup/password_ws';
14
const XML_MAILUP_LIST_ID = 'mailup_newsletter/mailup/list';
15
const XML_SUBSCRIBE_IN_CHECKOUT = 'mailup_newsletter/mailup/enable_subscribe_in_checkout';
16
+ const XML_REQ_SUBSCRIPTION_CONF = 'mailup_newsletter/mailup/require_subscription_confirmation';
17
const XML_CRON_FREQ = 'mailup_newsletter/mailup/mailup_cron_frequency';
18
const XML_WEBHOOK_KEY = 'mailup_newsletter/mailup/webhook_crypt_key';
19
const XML_DISABLE_NOTIFICATION = 'mailup_newsletter/mailup/disablenewslettersuccesses';
20
+ const XML_TEST_MODE_ENABLE = 'mailup_newsletter/mailup/enable_testmode';
21
22
const XML_MAPPING_SECTION = 'mailup_newsletter/mailup_mapping';
23
+
24
+ /**
25
+ * Is test mode enabled
26
+ *
27
+ * @param int
28
+ * @return bool
29
+ */
30
+ public function isTestMode($storeId = NULL)
31
+ {
32
+ return (bool) Mage::getStoreConfig(self::XML_TEST_MODE_ENABLE, $storeId);
33
+ }
34
+
35
/**
36
* Is the log enabled?
37
*
44
}
45
46
/**
47
+ * Write a log entry if enabled.
48
*
49
* @param string
50
* @param int
60
}
61
62
/**
63
+ * Write a log entry if enabled.
64
*
65
* @param string
66
* @param int
185
{
186
return (int) Mage::getStoreConfig(self::XML_SUBSCRIBE_IN_CHECKOUT, $storeId);
187
}
188
+
189
+ /**
190
+ * Is Require Subscription Confirmation set in config?
191
+ *
192
+ * @param int
193
+ * @return int
194
+ */
195
+ public function isRequireSubscriptionConfirmation($storeId = NULL)
196
+ {
197
+ return (int) Mage::getStoreConfig(self::XML_REQ_SUBSCRIPTION_CONF, $storeId);
198
+ }
199
200
/**
201
* Get the cron freq settings
app/code/local/SevenLike/MailUp/Model/Job.php CHANGED
@@ -13,7 +13,7 @@
13
* @method void setStatus(string $status)
14
* @method void setTries(int $num) How many times we've tried.
15
* @method void setType(string $type) What type of job?
16
- * @method void setAsPending(int $int) Set the customers in this job to pending state or not
17
* @method void setQueueDatetime(string $dateTime) Set the Datetime the job was queued.
18
* @method void setStartDatetime(string $dateTime) Set when the job was started
19
* @method void setFinishDatetime(string $dateTime) Set when the job was finished / completed
13
* @method void setStatus(string $status)
14
* @method void setTries(int $num) How many times we've tried.
15
* @method void setType(string $type) What type of job?
16
+ * @method void setAsPending(int $yesOrNo) Set the customers in this job to pending state or not
17
* @method void setQueueDatetime(string $dateTime) Set the Datetime the job was queued.
18
* @method void setStartDatetime(string $dateTime) Set when the job was started
19
* @method void setFinishDatetime(string $dateTime) Set when the job was finished / completed
app/code/local/SevenLike/MailUp/Model/Lists.php CHANGED
@@ -103,21 +103,27 @@ class SevenLike_MailUp_Model_Lists
103
104
return $selectLists;
105
}
106
-
107
/**
108
- * Get an array of list data, and it's groups.
109
- *
110
- * @return array
111
*/
112
-
113
public function getListDataArray($listId, $storeId)
114
{
115
$listData = $this->getDataArray($storeId);
116
- if(isset($listData[$listId])) {
117
return $listData[$listId];
118
}
119
-
120
- throw new Mage_Exception('Invalid List ID: ' . $listId);
121
}
122
123
/**
@@ -125,7 +131,6 @@ class SevenLike_MailUp_Model_Lists
125
*
126
* @return array
127
*/
128
-
129
public function getDataArray($storeId)
130
{
131
$selectLists = array();
@@ -174,14 +179,14 @@ class SevenLike_MailUp_Model_Lists
174
*
175
* @param int
176
* @param int
177
- * @return string
178
*/
179
public function getListGuid($listId, $storeId)
180
{
181
$listData = $this->getListDataArray($listId, $storeId);
182
-
183
- if( ! isset($listData['listGUID'])) {
184
- throw new Mage_Exception("Cant find ListGuid for List [{$listId}] Store [{$storeId}]");
185
}
186
187
return $listData['listGUID'];
@@ -190,11 +195,15 @@ class SevenLike_MailUp_Model_Lists
190
/**
191
* Get the groups for a given list.
192
*
193
- * @param int
194
*/
195
public function getListGroups($listId, $storeId)
196
{
197
$listData = $this->getListDataArray($listId, $storeId);
198
199
return $listData['groups'];
200
}
103
104
return $selectLists;
105
}
106
+
107
/**
108
+ *
109
+ * Get an array of list data, and its groups.
110
+ * @param $listId
111
+ * @param $storeId
112
+ * @return bool|array
113
*/
114
public function getListDataArray($listId, $storeId)
115
{
116
$listData = $this->getDataArray($storeId);
117
+ if (isset($listData[$listId])) {
118
return $listData[$listId];
119
}
120
+
121
+ // If list not found, return false
122
+ if (Mage::getStoreConfig('mailup_newsletter/mailup/enable_log', $storeId)) {
123
+ Mage::log('Invalid List ID: ' . $listId);
124
+ }
125
+
126
+ return false;
127
}
128
129
/**
131
*
132
* @return array
133
*/
134
public function getDataArray($storeId)
135
{
136
$selectLists = array();
179
*
180
* @param int
181
* @param int
182
+ * @return string|false
183
*/
184
public function getListGuid($listId, $storeId)
185
{
186
$listData = $this->getListDataArray($listId, $storeId);
187
+
188
+ if ($listData === false || !isset($listData['listGUID'])) {
189
+ return false;
190
}
191
192
return $listData['listGUID'];
195
/**
196
* Get the groups for a given list.
197
*
198
+ * @param int|false
199
*/
200
public function getListGroups($listId, $storeId)
201
{
202
$listData = $this->getListDataArray($listId, $storeId);
203
+
204
+ if ($listData === false || !isset($listData['groups'])) {
205
+ return false;
206
+ }
207
208
return $listData['groups'];
209
}
app/code/local/SevenLike/MailUp/Model/MailUpWsImport.php CHANGED
@@ -555,7 +555,8 @@ class MailUpWsImport
555
$tempSubscribed[] = $customer;
556
}
557
}
558
- $customersFiltered = array_intersect($tempSubscribed, $customersFiltered);
559
}
560
/**
561
* FILTRO 1 ACQUISTATO: in base al fatto se ha effettuato o meno acquisti:
@@ -584,10 +585,10 @@ class MailUpWsImport
584
}
585
586
if ($request->getRequest()->getParam('mailupCustomers') == 1) {
587
- $customersFiltered = array_intersect($tempPurchased, $customersFiltered);
588
}
589
elseif ($request->getRequest()->getParam('mailupCustomers') == 2) {
590
- $customersFiltered = array_intersect($tempNoPurchased, $customersFiltered);
591
}
592
}
593
/**
@@ -642,7 +643,7 @@ class MailUpWsImport
642
$count++;
643
}
644
645
- $customersFiltered = array_intersect($tempProduct, $customersFiltered);
646
}
647
/**
648
* FILTER BOUGHT IN CATEGORY 3: Depending on whether bought at least one product in a given category
@@ -674,7 +675,7 @@ class MailUpWsImport
674
foreach ($items as $product) {
675
$_prod = Mage::getModel('catalog/product')->load($product->getProductId()); // ned to load full product for cats.
676
$productCategories = Mage::getResourceSingleton('catalog/product')->getCategoryIds($_prod);
677
- $matchingCategories = array_intersect($productCategories, $searchCategories);
678
if(is_array($matchingCategories) && ! empty($matchingCategories)) {
679
$tempCategory[] = $result[$count];
680
break 2;
@@ -684,7 +685,7 @@ class MailUpWsImport
684
unset($orders);
685
$count++;
686
}
687
- $customersFiltered = array_intersect($tempCategory, $customersFiltered);
688
}
689
690
/**
@@ -701,7 +702,7 @@ class MailUpWsImport
701
}
702
}
703
704
- $customersFiltered = array_intersect($tempGroup, $customersFiltered);
705
}
706
//FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
707
@@ -726,7 +727,7 @@ class MailUpWsImport
726
unset($customerItem); //->unsetData();
727
}
728
729
- $customersFiltered = array_intersect($tempCountry, $customersFiltered);
730
}
731
//FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
732
@@ -751,7 +752,7 @@ class MailUpWsImport
751
unset($customerItem); //->unsetData();
752
}
753
754
- $customersFiltered = array_intersect($tempPostCode, $customersFiltered);
755
}
756
//FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
757
@@ -816,7 +817,7 @@ class MailUpWsImport
816
}
817
}
818
819
- $customersFiltered = array_intersect($tempDate, $customersFiltered);
820
}
821
//FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
822
@@ -866,7 +867,7 @@ class MailUpWsImport
866
unset($orders); //->unsetData();
867
}
868
869
- $customersFiltered = array_intersect($tempTotal, $customersFiltered);
870
}
871
//FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
872
@@ -962,10 +963,10 @@ class MailUpWsImport
962
}
963
964
if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes') {
965
- $customersFiltered = array_intersect($tempOrderedDateYes, $customersFiltered);
966
}
967
else {
968
- $customersFiltered = array_intersect($tempOrderedDateNo, $customersFiltered);
969
}
970
}
971
//FINE FILTRO 9 DATA ACQUISTATO: testato ok
@@ -1000,7 +1001,7 @@ class MailUpWsImport
1000
}
1001
}
1002
1003
- //$customersFiltered = array_intersect($tempMod, $customersFiltered);
1004
$customersFiltered = $tempMod;
1005
}
1006
//FINE GESTISCO LE MODIFICHE MANUALI
@@ -1035,7 +1036,7 @@ class MailUpWsImport
1035
}
1036
1037
/**
1038
- * Save Filter Hiny
1039
*
1040
* @param type $filter_name
1041
* @param type $post
@@ -1137,4 +1138,28 @@ class MailUpWsImport
1137
{
1138
print_r($this->soapClient->__getFunctions());
1139
}
1140
}
555
$tempSubscribed[] = $customer;
556
}
557
}
558
+
559
+ $customersFiltered = self::intersectByEntityId($tempSubscribed, $customersFiltered);
560
}
561
/**
562
* FILTRO 1 ACQUISTATO: in base al fatto se ha effettuato o meno acquisti:
585
}
586
587
if ($request->getRequest()->getParam('mailupCustomers') == 1) {
588
+ $customersFiltered = self::intersectByEntityId($tempPurchased, $customersFiltered);
589
}
590
elseif ($request->getRequest()->getParam('mailupCustomers') == 2) {
591
+ $customersFiltered = self::intersectByEntityId($tempNoPurchased, $customersFiltered);
592
}
593
}
594
/**
643
$count++;
644
}
645
646
+ $customersFiltered = self::intersectByEntityId($tempProduct, $customersFiltered);
647
}
648
/**
649
* FILTER BOUGHT IN CATEGORY 3: Depending on whether bought at least one product in a given category
675
foreach ($items as $product) {
676
$_prod = Mage::getModel('catalog/product')->load($product->getProductId()); // ned to load full product for cats.
677
$productCategories = Mage::getResourceSingleton('catalog/product')->getCategoryIds($_prod);
678
+ $matchingCategories = self::intersectByEntityId($productCategories, $searchCategories);
679
if(is_array($matchingCategories) && ! empty($matchingCategories)) {
680
$tempCategory[] = $result[$count];
681
break 2;
685
unset($orders);
686
$count++;
687
}
688
+ $customersFiltered = self::intersectByEntityId($tempCategory, $customersFiltered);
689
}
690
691
/**
702
}
703
}
704
705
+ $customersFiltered = self::intersectByEntityId($tempGroup, $customersFiltered);
706
}
707
//FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
708
727
unset($customerItem); //->unsetData();
728
}
729
730
+ $customersFiltered = self::intersectByEntityId($tempCountry, $customersFiltered);
731
}
732
//FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
733
752
unset($customerItem); //->unsetData();
753
}
754
755
+ $customersFiltered = self::intersectByEntityId($tempPostCode, $customersFiltered);
756
}
757
//FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
758
817
}
818
}
819
820
+ $customersFiltered = self::intersectByEntityId($tempDate, $customersFiltered);
821
}
822
//FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
823
867
unset($orders); //->unsetData();
868
}
869
870
+ $customersFiltered = self::intersectByEntityId($tempTotal, $customersFiltered);
871
}
872
//FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
873
963
}
964
965
if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes') {
966
+ $customersFiltered = self::intersectByEntityId($tempOrderedDateYes, $customersFiltered);
967
}
968
else {
969
+ $customersFiltered = self::intersectByEntityId($tempOrderedDateNo, $customersFiltered);
970
}
971
}
972
//FINE FILTRO 9 DATA ACQUISTATO: testato ok
1001
}
1002
}
1003
1004
+ //$customersFiltered = self::intersectByEntityId($tempMod, $customersFiltered);
1005
$customersFiltered = $tempMod;
1006
}
1007
//FINE GESTISCO LE MODIFICHE MANUALI
1036
}
1037
1038
/**
1039
+ * Save Filter Hint
1040
*
1041
* @param type $filter_name
1042
* @param type $post
1138
{
1139
print_r($this->soapClient->__getFunctions());
1140
}
1141
+
1142
+ /**
1143
+ * Recursive intersection of $array1 and $array2 by entity IDs
1144
+ * NOTE that php's self::intersectByEntityId is not recursive, so cannot be used on arrays of arrays
1145
+ *
1146
+ * @param array $array1
1147
+ * @param array $array2
1148
+ * @return array
1149
+ */
1150
+ public static function intersectByEntityId($array1, $array2)
1151
+ {
1152
+ $tempIds = array();
1153
+ foreach ($array1 as $entity1) {
1154
+ $tempIds[$entity1['entity_id']] = true;
1155
+ }
1156
+ $tempArray = array();
1157
+ foreach ($array2 as $entity2) {
1158
+ if (isset($tempIds[$entity2['entity_id']])) {
1159
+ $tempArray[] = $entity2;
1160
+ }
1161
+ }
1162
+
1163
+ return $tempArray;
1164
+ }
1165
}
app/code/local/SevenLike/MailUp/Model/Mysql14/Job.php DELETED
@@ -1,30 +0,0 @@
1
- <?php
2
- /**
3
- * Job.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Job extends Mage_Core_Model_Mysql4_Abstract
6
- {
7
- protected function _construct()
8
- {
9
- $this->_init("mailup/job", "id");
10
- }
11
-
12
- // /**
13
- // * Get product identifier by sku
14
- // *
15
- // * @param string $sku
16
- // * @return int|false
17
- // */
18
- // public function getIdBySku($sku)
19
- // {
20
- // $adapter = $this->_getReadAdapter();
21
- //
22
- // $select = $adapter->select()
23
- // ->from('phpsolut_import')
24
- // ->where('sku = :sku');
25
- //
26
- // $bind = array(':sku' => (string)$sku);
27
- //
28
- // return $adapter->fetchOne($select, $bind);
29
- // }
30
- }
app/code/local/SevenLike/MailUp/Model/Mysql14/Job/Collection.php DELETED
@@ -1,11 +0,0 @@
1
- <?php
2
- /**
3
- * Collection.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Job_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
- {
7
- public function _construct()
8
- {
9
- $this->_init("mailup/job");
10
- }
11
- }
app/code/local/SevenLike/MailUp/Model/Mysql4/Job.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
- /**
3
- * Job.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Job extends Mage_Core_Model_Mysql4_Abstract
6
- {
7
- protected function _construct()
8
- {
9
- $this->_init("mailup/job", "id");
10
- }
11
-
12
- // /**
13
- // * Get product identifier by sku
14
- // *
15
- // * @param string $sku
16
- // * @return int|false
17
- // */
18
- // public function getIdBySku($sku)
19
- // {
20
- // $adapter = $this->_getReadAdapter();
21
- //
22
- // $select = $adapter->select()
23
- // ->from('phpsolut_import')
24
- // ->where('sku = :sku');
25
- //
26
- // $bind = array(':sku' => (string)$sku);
27
- //
28
- // return $adapter->fetchOne($select, $bind);
29
- // }
30
}
1
+ <?php
2
+ /**
3
+ * Job.php
4
+ */
5
+ class SevenLike_MailUp_Model_Mysql4_Job extends Mage_Core_Model_Mysql4_Abstract
6
+ {
7
+ protected function _construct()
8
+ {
9
+ $this->_init("mailup/job", "id");
10
+ }
11
+
12
+ // /**
13
+ // * Get product identifier by sku
14
+ // *
15
+ // * @param string $sku
16
+ // * @return int|false
17
+ // */
18
+ // public function getIdBySku($sku)
19
+ // {
20
+ // $adapter = $this->_getReadAdapter();
21
+ //
22
+ // $select = $adapter->select()
23
+ // ->from('phpsolut_import')
24
+ // ->where('sku = :sku');
25
+ //
26
+ // $bind = array(':sku' => (string)$sku);
27
+ //
28
+ // return $adapter->fetchOne($select, $bind);
29
+ // }
30
}
app/code/local/SevenLike/MailUp/Model/Mysql4/Job/Collection.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- /**
3
- * Collection.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Job_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
- {
7
- public function _construct()
8
- {
9
- $this->_init("mailup/job");
10
- }
11
}
1
+ <?php
2
+ /**
3
+ * Collection.php
4
+ */
5
+ class SevenLike_MailUp_Model_Mysql4_Job_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
+ {
7
+ public function _construct()
8
+ {
9
+ $this->_init("mailup/job");
10
+ }
11
}
app/code/local/SevenLike/MailUp/Model/Mysql4/Log.php CHANGED
@@ -1,25 +1,25 @@
1
- <?php
2
- /**
3
- * Log.php
4
- *
5
- * @method string getType()
6
- * @method void setType(string $type)
7
- * @method string getStatus()
8
- * @method void setStatus(string $type)
9
- * @method int getStoreId()
10
- * @method void setStoreId(int $storeId)
11
- * @method int getJobId()
12
- * @method void setJobId(int $jobId)
13
- */
14
- class SevenLike_MailUp_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
15
- {
16
- const TYPE_ERROR = 'ERROR';
17
- const TYPE_DEBUG = 'DEBUG';
18
- const TYPE_CRON = 'CRON';
19
- const TYPE_WARN = 'WARNING';
20
-
21
- protected function _construct()
22
- {
23
- $this->_init("mailup/log", "id");
24
- }
25
}
1
+ <?php
2
+ /**
3
+ * Log.php
4
+ *
5
+ * @method string getType()
6
+ * @method void setType(string $type)
7
+ * @method string getStatus()
8
+ * @method void setStatus(string $type)
9
+ * @method int getStoreId()
10
+ * @method void setStoreId(int $storeId)
11
+ * @method int getJobId()
12
+ * @method void setJobId(int $jobId)
13
+ */
14
+ class SevenLike_MailUp_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
15
+ {
16
+ const TYPE_ERROR = 'ERROR';
17
+ const TYPE_DEBUG = 'DEBUG';
18
+ const TYPE_CRON = 'CRON';
19
+ const TYPE_WARN = 'WARNING';
20
+
21
+ protected function _construct()
22
+ {
23
+ $this->_init("mailup/log", "id");
24
+ }
25
}
app/code/local/SevenLike/MailUp/Model/Mysql4/Log/Collection.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- /**
3
- * Collection.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
- {
7
- public function _construct()
8
- {
9
- $this->_init("mailup/log");
10
- }
11
}
1
+ <?php
2
+ /**
3
+ * Collection.php
4
+ */
5
+ class SevenLike_MailUp_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
+ {
7
+ public function _construct()
8
+ {
9
+ $this->_init("mailup/log");
10
+ }
11
}
app/code/local/SevenLike/MailUp/Model/Mysql4/Sync.php CHANGED
@@ -1,70 +1,70 @@
1
- <?php
2
- /**
3
- * Job.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Sync extends Mage_Core_Model_Mysql4_Abstract
6
- {
7
- protected function _construct()
8
- {
9
- $this->_init("mailup/sync", "id");
10
- }
11
-
12
- /**
13
- * Get the ID from the unique values
14
- *
15
- * @param int
16
- * @param int
17
- * @param int
18
- */
19
- public function getIdByUniqueKey($customerId, $jobId, $storeId)
20
- {
21
- $adapter = $this->_getReadAdapter();
22
- $select = $adapter->select()
23
- ->from($this->getMainTable())
24
- ->where('customer_id = :customer_id AND job_id = :job_id AND store_id = :store_id')
25
- ;
26
-
27
- $bind = array(
28
- ':customer_id' => $customerId,
29
- ':job_id' => $jobId,
30
- ':store_id' => $storeId
31
- );
32
-
33
- return $adapter->fetchOne($select, $bind);
34
- }
35
-
36
-
37
- /**
38
- * Load by unique Key
39
- */
40
- public function loadByUniqueKey()
41
- {
42
- //(`customer_id`,`entity`,`job_id`, `store_id`)
43
-
44
-
45
- }
46
-
47
- // /**
48
- // * Get product identifier by sku
49
- // *
50
- // * @param string $sku
51
- // * @return int|false
52
- // */
53
- // public function getIdBySku($sku)
54
- // {
55
- // $adapter = $this->_getReadAdapter();
56
- //
57
- // $select = $adapter->select()
58
- // ->from('phpsolut_import')
59
- // ->where('sku = :sku');
60
- //
61
- // $bind = array(':sku' => (string)$sku);
62
- //
63
- // return $adapter->fetchOne($select, $bind);
64
- // }
65
-
66
- //return $this->_getReadAdapter()->fetchOne(
67
- // 'select connect_id from '.$this->getMainTable().' where sku=?',
68
- // $sku
69
- // );
70
}
1
+ <?php
2
+ /**
3
+ * Job.php
4
+ */
5
+ class SevenLike_MailUp_Model_Mysql4_Sync extends Mage_Core_Model_Mysql4_Abstract
6
+ {
7
+ protected function _construct()
8
+ {
9
+ $this->_init("mailup/sync", "id");
10
+ }
11
+
12
+ /**
13
+ * Get the ID from the unique values
14
+ *
15
+ * @param int
16
+ * @param int
17
+ * @param int
18
+ */
19
+ public function getIdByUniqueKey($customerId, $jobId, $storeId)
20
+ {
21
+ $adapter = $this->_getReadAdapter();
22
+ $select = $adapter->select()
23
+ ->from($this->getMainTable())
24
+ ->where('customer_id = :customer_id AND job_id = :job_id AND store_id = :store_id')
25
+ ;
26
+
27
+ $bind = array(
28
+ ':customer_id' => $customerId,
29
+ ':job_id' => $jobId,
30
+ ':store_id' => $storeId
31
+ );
32
+
33
+ return $adapter->fetchOne($select, $bind);
34
+ }
35
+
36
+
37
+ /**
38
+ * Load by unique Key
39
+ */
40
+ public function loadByUniqueKey()
41
+ {
42
+ //(`customer_id`,`entity`,`job_id`, `store_id`)
43
+
44
+
45
+ }
46
+
47
+ // /**
48
+ // * Get product identifier by sku
49
+ // *
50
+ // * @param string $sku
51
+ // * @return int|false
52
+ // */
53
+ // public function getIdBySku($sku)
54
+ // {
55
+ // $adapter = $this->_getReadAdapter();
56
+ //
57
+ // $select = $adapter->select()
58
+ // ->from('phpsolut_import')
59
+ // ->where('sku = :sku');
60
+ //
61
+ // $bind = array(':sku' => (string)$sku);
62
+ //
63
+ // return $adapter->fetchOne($select, $bind);
64
+ // }
65
+
66
+ //return $this->_getReadAdapter()->fetchOne(
67
+ // 'select connect_id from '.$this->getMainTable().' where sku=?',
68
+ // $sku
69
+ // );
70
}
app/code/local/SevenLike/MailUp/Model/Mysql4/Sync/Collection.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- /**
3
- * Collection.php
4
- */
5
- class SevenLike_MailUp_Model_Mysql4_Sync_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
- {
7
- public function _construct()
8
- {
9
- $this->_init("mailup/sync");
10
- }
11
}
1
+ <?php
2
+ /**
3
+ * Collection.php
4
+ */
5
+ class SevenLike_MailUp_Model_Mysql4_Sync_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
6
+ {
7
+ public function _construct()
8
+ {
9
+ $this->_init("mailup/sync");
10
+ }
11
}
app/code/local/SevenLike/MailUp/Model/Observer.php CHANGED
@@ -169,9 +169,10 @@ class SevenLike_MailUp_Model_Observer
169
}
170
}
171
}
172
-
173
$console = Mage::getStoreConfig('mailup_newsletter/mailup/url_console');
174
$listId = Mage::getStoreConfig('mailup_newsletter/mailup/list');
175
176
try {
177
$wsImport = new MailUpWsImport();
@@ -202,6 +203,7 @@ class SevenLike_MailUp_Model_Observer
202
$ws .= "?ListGuid=" . rawurlencode($listGUID);
203
$ws .= "&List=" . rawurlencode($listId);
204
$ws .= "&Email=" . rawurlencode($model->getEmail());
205
206
try {
207
if(Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
@@ -255,13 +257,13 @@ class SevenLike_MailUp_Model_Observer
255
}
256
257
/**
258
- * Subscribw the user, during checkout.
259
*
260
* @return void
261
*/
262
public function subscribeDuringCheckout()
263
{
264
- if (@$_REQUEST["mailup_subscribe2"]) {
265
$order_id = Mage::getSingleton("checkout/session")->getLastRealOrderId();
266
$order = Mage::getModel("sales/order")->loadByIncrementId($order_id);
267
try {
@@ -351,16 +353,16 @@ class SevenLike_MailUp_Model_Observer
351
*/
352
private static function setCustomerForDataSync($customerId, $storeId = NULL)
353
{
354
- if(Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
355
Mage::log("TRIGGERED setCustomerForDataSync [StoreID:{$storeId}]");
356
}
357
358
- if( ! isset($storeId)) {
359
$storeId = Mage::app()->getStore()->getId();
360
}
361
362
- if( ! $customerId) {
363
- return FALSE;
364
}
365
366
$helper = Mage::helper('mailup');
@@ -371,22 +373,30 @@ class SevenLike_MailUp_Model_Observer
371
/* @var $lists SevenLike_MailUp_Model_Lists */
372
$listID = $config->getMailupListId($storeId);
373
$listGuid = $lists->getListGuid($listID, $storeId);
374
$job = Mage::getModel('mailup/job');
375
/* @var $job SevenLike_MailUp_Model_Job */
376
377
/**
378
* Only Sync if they are a subscriber!
379
*/
380
- if( ! $helper->isSubscriber($customerId, $storeId)) {
381
return;
382
}
383
-
384
$job->setData(array(
385
- "mailupgroupid" => '',
386
- "send_optin" => 0,
387
'as_pending' => 0,
388
- "status" => "queued",
389
- "queue_datetime" => gmdate("Y-m-d H:i:s"),
390
'store_id' => $storeId,
391
'list_id' => $listID,
392
'list_guid' => $listGuid,
@@ -407,11 +417,11 @@ class SevenLike_MailUp_Model_Observer
407
/** @var $jobTask SevenLike_MailUp_Model_Sync */
408
$jobTask->setData(array(
409
'store_id' => $storeId,
410
- "customer_id" => $customerId,
411
- "entity" => "customer",
412
- "job_id" => $job->getId(),
413
- "needs_sync" => TRUE,
414
- "last_sync" => NULL,
415
));
416
$jobTask->save();
417
$config->dbLog("Sync [Insert] [customer] [{$customerId}]", $job->getId(), $storeId);
@@ -430,7 +440,7 @@ class SevenLike_MailUp_Model_Observer
430
* OR we use a separate Auto Sync job!!
431
*/
432
433
- return TRUE;
434
}
435
436
/**
169
}
170
}
171
}
172
+
173
$console = Mage::getStoreConfig('mailup_newsletter/mailup/url_console');
174
$listId = Mage::getStoreConfig('mailup_newsletter/mailup/list');
175
+ $confirm = Mage::getStoreConfig('mailup_newsletter/mailup/require_subscription_confirmation');
176
177
try {
178
$wsImport = new MailUpWsImport();
203
$ws .= "?ListGuid=" . rawurlencode($listGUID);
204
$ws .= "&List=" . rawurlencode($listId);
205
$ws .= "&Email=" . rawurlencode($model->getEmail());
206
+ $ws .= "&Confirm=" . rawurlencode($confirm);
207
208
try {
209
if(Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
257
}
258
259
/**
260
+ * Subscribe the user, during checkout.
261
*
262
* @return void
263
*/
264
public function subscribeDuringCheckout()
265
{
266
+ if (isset($_REQUEST["mailup_subscribe2"]) && $_REQUEST["mailup_subscribe2"]) {
267
$order_id = Mage::getSingleton("checkout/session")->getLastRealOrderId();
268
$order = Mage::getModel("sales/order")->loadByIncrementId($order_id);
269
try {
353
*/
354
private static function setCustomerForDataSync($customerId, $storeId = NULL)
355
{
356
+ if (Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
357
Mage::log("TRIGGERED setCustomerForDataSync [StoreID:{$storeId}]");
358
}
359
360
+ if ( ! isset($storeId)) {
361
$storeId = Mage::app()->getStore()->getId();
362
}
363
364
+ if ( ! $customerId) {
365
+ return false;
366
}
367
368
$helper = Mage::helper('mailup');
373
/* @var $lists SevenLike_MailUp_Model_Lists */
374
$listID = $config->getMailupListId($storeId);
375
$listGuid = $lists->getListGuid($listID, $storeId);
376
+ // If list is not available, then cancel sync
377
+ if ($listGuid === false) {
378
+ if (Mage::getStoreConfig('mailup_newsletter/mailup/enable_log')) {
379
+ Mage::log("Could not fetch valid list, so cancelling customer sync");
380
+ }
381
+ return false;
382
+ }
383
$job = Mage::getModel('mailup/job');
384
/* @var $job SevenLike_MailUp_Model_Job */
385
386
/**
387
* Only Sync if they are a subscriber!
388
*/
389
+ if ( ! $helper->isSubscriber($customerId, $storeId)) {
390
return;
391
}
392
+
393
+ // Set options for those already subscribed (not pending and no opt-in)
394
$job->setData(array(
395
+ 'mailupgroupid' => '',
396
+ 'send_optin' => 0,
397
'as_pending' => 0,
398
+ 'status' => 'queued',
399
+ 'queue_datetime' => gmdate('Y-m-d H:i:s'),
400
'store_id' => $storeId,
401
'list_id' => $listID,
402
'list_guid' => $listGuid,
417
/** @var $jobTask SevenLike_MailUp_Model_Sync */
418
$jobTask->setData(array(
419
'store_id' => $storeId,
420
+ 'customer_id' => $customerId,
421
+ 'entity' => 'customer',
422
+ 'job_id' => $job->getId(),
423
+ 'needs_sync' => true,
424
+ 'last_sync' => null,
425
));
426
$jobTask->save();
427
$config->dbLog("Sync [Insert] [customer] [{$customerId}]", $job->getId(), $storeId);
440
* OR we use a separate Auto Sync job!!
441
*/
442
443
+ return true;
444
}
445
446
/**
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php CHANGED
@@ -69,35 +69,30 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
69
}
70
71
/**
72
- * Lets make batches if required. Separate the jobs into max amount of customers.
73
* Create a new job for each batch.
74
*/
75
- foreach($batches as $batchNumber => $batch) {
76
try {
77
$customerCount = 0;
78
/**
79
- * We have split into subscribers and none subscribers
80
*/
81
- foreach($batch as $subscribeStatus => $customerIdArray) {
82
-
83
- if(empty($customerIdArray)) {
84
continue;
85
}
86
-
87
- if( ! $sendOptinEmail) {
88
- $asPending = 0;
89
- $sendOptin = 0;
90
- }
91
- else {
92
- if($subscribeStatus == self::STATUS_SUBSCRIBED) {
93
- $asPending = 0;
94
- $sendOptin = 0;
95
- }
96
- else {
97
- $asPending = 1;
98
- $sendOptin = 1;
99
- }
100
}
101
$job = Mage::getModel('mailup/job');
102
/* @var $job SevenLike_MailUp_Model_Job */
103
$job->setData(array(
69
}
70
71
/**
72
+ * Makes batches if required. Separate the jobs into max amount of customers.
73
* Create a new job for each batch.
74
*/
75
+ foreach ($batches as $batchNumber => $batch) {
76
try {
77
$customerCount = 0;
78
/**
79
+ * We have split into subscribers and non-subscribers
80
*/
81
+ foreach ($batch as $subscribeStatus => $customerIdArray) {
82
+ if (empty($customerIdArray)) {
83
continue;
84
}
85
+
86
+ // Default - set subscriptions as not pending with no confirmation email
87
+ $asPending = 0;
88
+ $sendOptin = 0;
89
+ /* If customer is not subscribed and confirmation email is requested,
90
+ then set as pending with a confirmation email */
91
+ if ($subscribeStatus != self::STATUS_SUBSCRIBED && $sendOptinEmail) {
92
+ $asPending = 1;
93
+ $sendOptin = 1;
94
}
95
+
96
$job = Mage::getModel('mailup/job');
97
/* @var $job SevenLike_MailUp_Model_Job */
98
$job->setData(array(
app/code/local/SevenLike/MailUp/controllers/TestController.php CHANGED
@@ -14,13 +14,13 @@ class SevenLike_MailUp_TestController extends Mage_Core_Controller_Front_Action
14
*/
15
public function preDispatch()
16
{
17
- //$config = Mage::getModel('mailup/config');
18
/* @var $config SevenLike_MailUp_Model_Config */
19
-
20
- //if( ! $config->isTestMode()) {
21
- // die('Access Denied.');
22
- //}
23
-
24
return parent::preDispatch();
25
}
26
@@ -83,24 +83,6 @@ class SevenLike_MailUp_TestController extends Mage_Core_Controller_Front_Action
83
$job = Mage::getModel('mailup/job');
84
/* @var $job SevenLike_MailUp_Model_Job */
85
86
- foreach($job->fetchQueuedJobsCollection() as $job) {
87
- echo "Job [{$job->getId()}] [{$job->getType()}] <br />";
88
- }
89
-
90
- echo '<br />----<br />';
91
-
92
- foreach($job->fetchManualSyncQueuedJobsCollection() as $job) {
93
- echo "Job [{$job->getId()}] [{$job->getType()}] <br />";
94
- }
95
-
96
- echo '<br />----<br />';
97
-
98
- foreach($job->fetchAutoSyncQueuedJobsCollection() as $job) {
99
- echo "Job [{$job->getId()}] [{$job->getType()}] <br />";
100
- }
101
-
102
- return;
103
-
104
$tasks = $jobTask->getSyncItemsCollection();
105
foreach($tasks as $task) {
106
var_dump($task->getData());
@@ -113,54 +95,6 @@ class SevenLike_MailUp_TestController extends Mage_Core_Controller_Front_Action
113
var_dump($jobTask->getJob());
114
}
115
116
- /**
117
- * List jobs
118
- */
119
- public function cronAction()
120
- {
121
- echo "Server Time: " . date('H:i:s') . "<br /><br />";
122
-
123
- $read = Mage::getSingleton('core/resource')->getConnection('core_read');
124
- $stmt = $read->query("
125
- SELECT *
126
- FROM cron_schedule
127
- ORDER BY scheduled_at DESC"
128
- );
129
- while ($row = $stmt->fetch()) {
130
- echo "{$row['job_code']} | {$row['status']} | {$row['scheduled_at']} | {$row['messages']}<br />";
131
- }
132
- }
133
-
134
- /**
135
- * List pending jobs
136
- */
137
- public function cronPendingAction()
138
- {
139
- echo "Server Time: " . date('H:i:s') . "<br /><br />";
140
-
141
- $read = Mage::getSingleton('core/resource')->getConnection('core_read');
142
- $stmt = $read->query("
143
- SELECT *
144
- FROM cron_schedule where status = 'pending'
145
- ORDER BY scheduled_at DESC"
146
- );
147
- while ($row = $stmt->fetch()) {
148
- echo "{$row['job_code']} | {$row['status']} | {$row['scheduled_at']} | {$row['messages']}<br />";
149
- }
150
- }
151
-
152
- /**
153
- * List jobs
154
- */
155
- public function removeRunningAction()
156
- {
157
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
158
- $stmt = $write->query("
159
- DELETE FROM cron_schedule WHERE job_code = 'sevenlike_mailup' AND status = 'running'"
160
- );
161
- die('done');
162
- }
163
-
164
/**
165
* Show Current Processes
166
*/
14
*/
15
public function preDispatch()
16
{
17
+ $config = Mage::getModel('mailup/config');
18
/* @var $config SevenLike_MailUp_Model_Config */
19
+
20
+ if( ! $config->isTestMode()) {
21
+ die('Access Denied.');
22
+ }
23
+
24
return parent::preDispatch();
25
}
26
83
$job = Mage::getModel('mailup/job');
84
/* @var $job SevenLike_MailUp_Model_Job */
85
86
$tasks = $jobTask->getSyncItemsCollection();
87
foreach($tasks as $task) {
88
var_dump($task->getData());
95
var_dump($jobTask->getJob());
96
}
97
98
/**
99
* Show Current Processes
100
*/
app/code/local/SevenLike/MailUp/etc/config.xml CHANGED
@@ -179,6 +179,8 @@
179
<mailup>
180
<model>mailup/ws</model>
181
<disablenewslettersuccesses>1</disablenewslettersuccesses>
182
</mailup>
183
</mailup_newsletter>
184
</default>
179
<mailup>
180
<model>mailup/ws</model>
181
<disablenewslettersuccesses>1</disablenewslettersuccesses>
182
+ <require_subscription_confirmation>1</require_subscription_confirmation>
183
+ <enable_testmode>0</enable_testmode>
184
</mailup>
185
</mailup_newsletter>
186
</default>
app/code/local/SevenLike/MailUp/etc/system.xml CHANGED
@@ -78,6 +78,16 @@
78
<show_in_website>1</show_in_website>
79
<show_in_store>1</show_in_store>
80
</enable_subscribe_in_checkout>
81
<enable_cron_export tranlate="label comment">
82
<label>Enable Automatic Data Export to MailUp</label>
83
<frontend_type>select</frontend_type>
78
<show_in_website>1</show_in_website>
79
<show_in_store>1</show_in_store>
80
</enable_subscribe_in_checkout>
81
+ <require_subscription_confirmation tranlate="label comment">
82
+ <label>Require Subscription Confirmation</label>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>75</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <comment>Double opt-in required</comment>
90
+ </require_subscription_confirmation>
91
<enable_cron_export tranlate="label comment">
92
<label>Enable Automatic Data Export to MailUp</label>
93
<frontend_type>select</frontend_type>
app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml CHANGED
@@ -181,7 +181,7 @@ $xml = simplexml_load_string($xmlLists);
181
</tr>
182
<tr>
183
<td>
184
- <input type="checkbox" name="send_optin_email_to_new_subscribers" value="1" checked="checked" /> <?php echo $this->__('Send opt-in email to new subscribers') ?>
185
</td>
186
</tr>
187
</table>
181
</tr>
182
<tr>
183
<td>
184
+ <input type="checkbox" name="send_optin_email_to_new_subscribers" value="1"<?php if($listId == Mage::getStoreConfig('mailup_newsletter/mailup/require_subscription_confirmation', $storeId)): ?> checked="checked" <?php endif ?> /> <?php echo $this->__('Send opt-in email to new subscribers') ?>
185
</td>
186
</tr>
187
</table>
app/design/adminhtml/default/default/template/sevenlike/mailup/filter_.phtml DELETED
@@ -1,526 +0,0 @@
1
- <?php
2
- /**
3
- * filter.phtml
4
- */
5
- $wsSend = new MailUpWsSend(); /** @todo add in storeID, use session.. **/
6
- $accessKey = $wsSend->loginFromId();
7
-
8
- if ($accessKey === false || strlen(Mage::getStoreConfig('mailup_newsletter/mailup/list')) < 1) {
9
- echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
10
- } else {
11
- //controllo se la lista e' stata selezionata correttamente
12
- $wsImport = new MailUpWsImport();
13
- $mailupLists = $wsImport->GetNlList();
14
-
15
- //carico i filtri salvati
16
- $filterHints = $wsImport->getFilterHints();
17
-
18
- //TODO: sembra inutilizzata
19
- //chiamata attivazione web services su MailUp
20
- //$urlWSActivation = 'http://'.Mage::getStoreConfig('newsletter/mailup/url_console').'/frontend/WSActivation.aspx?usr='.Mage::getStoreConfig('newsletter/mailup/user').'&pwd='.Mage::getStoreConfig('newsletter/mailup/password').'&nl_url='.Mage::getStoreConfig('newsletter/mailup/url_console').'&ws_name=WSMailUpImport';
21
- //fopen($urlWSActivation, 'r');
22
-
23
- //salvo i parametri in variabili
24
- $mailupCustomers = $this->getRequest()->getParam('mailupCustomers');
25
- $mailupProductSku = $this->getRequest()->getParam('mailupProductSku');
26
- $mailupCategoryId = $this->getRequest()->getParam('mailupCategoryId');
27
- $mailupCustomerGroupId = $this->getRequest()->getParam('mailupCustomerGroupId');
28
- $mailupCountry = $this->getRequest()->getParam('mailupCountry');
29
- $mailupPostCode = $this->getRequest()->getParam('mailupPostCode');
30
- $mailupCustomerStartDate = $this->getRequest()->getParam('mailupCustomerStartDate');
31
- $mailupCustomerEndDate = $this->getRequest()->getParam('mailupCustomerEndDate');
32
- $mailupTotalAmountCond = $this->getRequest()->getParam('mailupTotalAmountCond');
33
- $mailupTotalAmountValue = $this->getRequest()->getParam('mailupTotalAmountValue');
34
- $mailupOrderStartDate = $this->getRequest()->getParam('mailupOrderStartDate');
35
- $mailupOrderEndDate = $this->getRequest()->getParam('mailupOrderEndDate');
36
- $mailupOrderYesNo = $this->getRequest()->getParam('mailupOrderYesNo');
37
- $mailupSubscribed = $this->getRequest()->getParam('mailupSubscribed');
38
-
39
-
40
- function print_category($category)
41
- {
42
- if (is_numeric($category)) {
43
- $category = Mage::getModel("catalog/category")->load($category);
44
- }
45
-
46
- echo '<option value="'.$category->getData('entity_id').'">'.str_repeat("-", $category->getData("level")-2) . htmlspecialchars($category->getData('name')).'</option>';
47
- $children = $category->getChildren();
48
- if (!$children) return;
49
-
50
- $children = explode(",", $children);
51
- foreach($children as $child) {
52
- print_category($child);
53
- }
54
- }
55
- ?>
56
-
57
- <div class="content-header">
58
- <table cellspacing="0" class="grid-header">
59
- <tr>
60
- <td>
61
- <h3><?php echo $this->__('Filters')?></h3>
62
- </td>
63
- <td class="a-right">
64
- <div id="mailuploading" class="mailuploading"><?php echo $this->__("Please wait for the next step to load") ?></div>
65
- <button onclick="$('.content-header-floating').invoke('setStyle', {visibility:'hidden'});document.getElementById('mailupsend').style.display='none';document.getElementById('mailuploading').style.display='block';editForm.submit();" class="scalable save" type="button" id="mailupsend">
66
- <div class="mailuploading"></div><span><?php echo $this->__('Apply filter')?></span>
67
- </button>
68
- </td>
69
- </tr>
70
- </table>
71
- </div>
72
-
73
- <div class="entry-edit">
74
- <form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/confirm')?>">
75
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
76
-
77
- <input name="filter_name" id="filter_name" type="hidden" value="" />
78
-
79
- <p id="spansugger"><a href="#ottsugg"><?php echo $this->__('Get hints')?> &rArr;</a></p>
80
- <fieldset id="my-fieldset">
81
- <table cellspacing="0" class="form-list</td>
82
- <td colspan="2">
83
- <input type="radio" name="mailupSubscribed" id="mailupSubscribedAllCustomers"
84
- value="0" <?php if (isset($mailupCustomers) && $mailupCustomers == 0) { echo 'checked="checked"'; } ?> />&nbsp;<label for="mailupSubscribedAllCustomers"><?php echo $this->__("All customers")?></label>
85
- </td>
86
- </tr>
87
- </table>
88
-
89
- <br /><br />
90
-
91
- <table cellspacing="0" class="form-list">
92
- <tr>
93
- <td colspan="2">
94
- <strong><?php echo $this->__('Groups')?></strong>
95
- </td>
96
- </tr>
97
- <tr>
98
- <td class="labelpg1"><?php echo $this->__('Select customer group')?></td>
99
- <td class="input-ele">
100
- <select name="mailupCustomerGroupId" class="slctpg1">
101
- <?php
102
- $customerGroups = Mage::helper('customer')->getGroups()->toOptionArray();
103
-
104
- ">
105
- <tr>
106
- <td colspan="3"><?php echo $this->__('By this plugin you can import contacts registered in your eCommerce in the MailUp platform.')?></td>
107
- </tr>
108
- </tr>
109
- <tr>
110
- <td colspan="3">&nbsp;</td>
111
- </tr>
112
- <tr>
113
- <td>
114
- <strong><?php echo $this->__('Store')?></strong>
115
- </td>
116
- <td colspan="2">
117
- <select name="store_id">
118
- <?php foreach($this->_getStoresArray() as $store): ?>
119
- <option value="<?php echo $store['id'] ?>">
120
- <?php echo $store['name'] ?>
121
- </option>
122
- <?php endforeach ?>
123
- </select>
124
- </td>
125
- </tr>
126
- <tr>
127
- <td colspan="3">&nbsp;</td>
128
- </tr>
129
- <tr>
130
- <td colspan="3">
131
- <strong><?php echo $this->__('Sold products')?></strong>
132
- </td>
133
- </tr>
134
- <?php //imposto il filtro per clienti: 0 = tutti, 1 = che hanno acquistato, 2 = che non hanno mai acquistato ?>
135
- <tr>
136
- <td class="input-ele spdnpg1">
137
- <input type="radio" name="mailupCustomers" id="mailupCustomersAll" value="0" <?php if (isset($mailupCustomers) && $mailupCustomers == 0) { echo 'checked="checked"'; } ?>
138
- onclick="customerDependentFilters(false);" />&nbsp;<label for="mailupCustomersAll"><?php echo $this->__('All customers')?></label>
139
- </td>
140
-
141
- <td class="input-ele spdnpg1">
142
- <input type="radio" name="mailupCustomers" id="mailupCustomersWhoHaveBought" value="1" <?php if (isset($mailupCustomers) && $mailupCustomers == 1) { echo 'checked="checked"'; } ?>
143
- onclick="customerDependentFilters(false);" />&nbsp;<label for="mailupCustomersWhoHaveBought"><?php echo $this->__('Customers who have purchased')?></label>
144
- </td>
145
-
146
- <td class="input-ele spdnpg1">
147
- <input type="radio" name="mailupCustomers" id="mailupCustomersWhoHaventBought" value="2" <?php if (isset($mailupCustomers) && $mailupCustomers == 2) { echo 'checked="checked"'; } ?>
148
- onclick="customerDependentFilters(true);" />&nbsp;<label for="mailupCustomersWhoHaventBought"><?php echo $this->__("Customers who have not purchased")?></label>
149
- </td>
150
- </tr>
151
- <tr>
152
- <td colspan="3">
153
- <strong><?php echo $this->__('Opt-in Status')?></strong>
154
- </td>
155
- </tr>
156
- <tr>
157
- <td>
158
- <input type="radio" name="mailupSubscribed" id="mailupSubscribedOptIn"
159
- value="1" <?php if (isset($mailupSubscribed) && $mailupSubscribed == 1) { echo 'checked="checked"'; } ?> />&nbsp;<label for="mailupSubscribedOptIn"><?php echo $this->__("Opted-in Only"); ?></label>
160
- if ($mailupCustomerGroupId) {
161
- foreach ($customerGroups as $customerGroup) {
162
- if ($mailupCustomerGroupId == $customerGroup['value']) {
163
- echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
164
- }
165
- }
166
- }
167
- ?>
168
-
169
- <option value="0">-- <?php echo $this->__('Any')?> --</option>
170
-
171
- <?php
172
- foreach ($customerGroups as $customerGroup) {
173
- echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
174
- }
175
- ?>
176
- </select>
177
- </td>
178
- </tr>
179
-
180
- <tr>
181
- <td colspan="2">
182
- <br /><br /><strong><?php echo $this->__('Location')?></strong>
183
- </td>
184
- </tr>
185
- <tr>
186
- <td class="labelpg1"><?php echo $this->__('Select country')?></td>
187
- <td class="input-ele">
188
- <select name="mailupCountry" class="slctpg1">
189
- <?php
190
- $countries = Mage::getResourceModel('directory/country_collection')
191
- ->loadData()
192
- ->toOptionArray(false);
193
-
194
- if ($mailupCountry) {
195
- foreach ($countries as $country){
196
- if ($country['value'] == $mailupCountry)
197
- echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
198
- }
199
- }
200
- ?>
201
-
202
- <option value="0">-- <?php echo $this->__('Any')?> --</option>
203
-
204
- <?php
205
- foreach ($countries as $country) {
206
- echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
207
- }
208
- ?>
209
- </select>
210
- </td>
211
- </tr>
212
- <tr>
213
- <td class="labelpg1"><?php echo $this->__('Zip code')?></td>
214
- <td class="input-ele">
215
- <input type="text" class="inptptx1" name="mailupPostCode" size="10" value="<?php echo $mailupPostCode; ?>" /> <span class="tip">(<?php echo $this->__('e.g.')?> 12345)</span>
216
- </td>
217
- </tr>
218
- </table>
219
-
220
- <table cellspacing="0" class="form-list" id="customerDependentContainer">
221
- <tr>
222
- <td colspan="2">
223
- <br /><br /><strong><?php echo $this->__('Products and categories')?></strong>
224
- </td>
225
- </tr>
226
-
227
- <?php //select con tutti i prodotti ?>
228
- <tr>
229
- <td class="labelpg1"><?php echo $this->__('Insert product SKU')?></td>
230
- <td class="input-ele">
231
- <input type="text" class="inptptx1 customerDependent" name="mailupProductSku" size="20" value="<?php echo $mailupProductSku; ?>" /> <span class="tip">(<?php echo $this->__('e.g.')?> MYSKU123)</span>
232
- </td>
233
- </tr>
234
- <?php //select con tutte le categorie ?>
235
- <tr>
236
- <td class="labelpg1"><?php echo $this->__('Select category')?></td>
237
- <td class="input-ele">
238
- <?php
239
- $categoriesCollection = Mage::getModel('catalog/category')->getCollection();
240
- $categoriesCollection->addAttributeToSelect('name');
241
- $categoriesCollection->addAttributeToSelect('entity_id');
242
- ?>
243
- <select id="mailupCategoryId" name="mailupCategoryId" class="slctpg1 customerDependent">
244
- <?php
245
- if ($mailupCategoryId) {
246
- $category = Mage::getModel('catalog/category')->load($mailupCategoryId);
247
- echo '<option value="'.$mailupCategoryId.'">'.$category->getData('name').'</option>';
248
- }
249
- ?>
250
-
251
- <option value="0">-- <?php echo $this->__('Any')?> --</option>
252
-
253
- <?php
254
- foreach ($categoriesCollection as $category) {
255
- if ($category->getLevel() == 2) {
256
- print_category($category);
257
- }
258
- }
259
- ?>
260
- </select>
261
- </td>
262
- </tr>
263
-
264
- <tr>
265
- <td colspan="2">
266
- <br /><br /><strong><?php echo $this->__('Subscription date')?></strong>
267
- </td>
268
- </tr>
269
- <tr>
270
- <td class="labelpg1"><?php echo $this->__('From')?></td>
271
- <td class="input-ele">
272
- <input type="text" class="inptptx1 customerDependent" name="mailupCustomerStartDate" id="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" />
273
- <img id="mailupCustomerStartDateTrig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>/adminhtml/default/default/images/grid-cal.gif"> <span class="tip">(<?php echo Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>)</span>
274
- <script type="text/javascript">
275
- Calendar.setup({
276
- inputField: "mailupCustomerStartDate",
277
- ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>",
278
- showsTime: false,
279
- button: "mailupCustomerStartDateTrig",
280
- align: "Bl",
281
- singleClick : true
282
- });
283
- </script>
284
- </td>
285
- </tr>
286
- <tr>
287
- <td class="labelpg1"><?php echo $this->__('To')?></td>
288
- <td class="input-ele">
289
- <input type="text" class="inptptx1 customerDependent" name="mailupCustomerEndDate" id="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" />
290
- <img id="mailupCustomerEndDateTrig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>/adminhtml/default/default/images/grid-cal.gif"> <span class="tip">(<?php echo Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>)</span>
291
- <script type="text/javascript">
292
- Calendar.setup({
293
- inputField: "mailupCustomerEndDate",
294
- ifFormat: "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>",
295
- showsTime: false,
296
- button: "mailupCustomerEndDateTrig",
297
- align: "Bl",
298
- singleClick : true
299
- });
300
- </script>
301
- </td>
302
- </tr>
303
- <tr>
304
- <td colspan="2">
305
- <br /><br /><strong><?php echo $this->__('Total purchased amount')?></strong>
306
- </td>
307
- </tr>
308
- <tr>
309
- <td class="labelpg1"><?php echo $this->__('Order total')?></td>
310
- <td class="input-ele">
311
- <select id="mailupTotalAmountCond" name="mailupTotalAmountCond" class="slctpg2 customerDependent">
312
- <?php
313
- if ($mailupTotalAmountCond && $mailupTotalAmountCond != 'gt') {
314
- if ($mailupTotalAmountCond == 'lt') {
315
- echo '<option value="lt"> '.$this->__('less than').' </option>';
316
- } elseif ($mailupTotalAmountCond == 'eq') {
317
- echo '<option value="eq"> '.$this->__('same as').' </option>';
318
- }
319
- }
320
- ?>
321
- <option value="gt"> <?php echo $this->__('more than')?> </option>
322
- <option value="lt"> <?php echo $this->__('less than')?> </option>
323
- <option value="eq"> <?php echo $this->__('same as')?> </option>
324
- </select>
325
-
326
- <!--label for="mailupTotalAmountValue" class="lbl1"><?php echo $this->__('Specify amount')?></label-->&nbsp;
327
- <input type="text" class="inptptx1 customerDependent" id="mailupTotalAmountValue" name="mailupTotalAmountValue" size="20" value="<?php echo $mailupTotalAmountValue; ?>" /> <span class="tip">(<?php echo $this->__('e.g.')?> 50)</span>
328
- </td>
329
-