MailUp - Version 2.2.0

Version Notes

Changelog:


  • you can now show the subscription checkbox during checkout

  • MailUp webhooks are now supported to manage realtime subscribe/unsubscribe

  • incremental sync was implemented, so that now only modified users are transferred to mailup during scheduled transmissions

  • logs can now be disabled

  • small interface tweeks

Download this release

Release Info

Developer Sevenlike
Extension MailUp
Version 2.2.0
Comparing to
See all releases


Code changes from version 2.1.3 to 2.2.0

Files changed (43) hide show
  1. app/code/local/SevenLike/MailUp/Block/.DS_Store +0 -0
  2. app/code/local/SevenLike/MailUp/Block/Checkout/Subscribe.php +9 -0
  3. app/code/local/SevenLike/MailUp/Helper/.DS_Store +0 -0
  4. app/code/local/SevenLike/MailUp/Helper/Data.php +148 -77
  5. app/code/local/SevenLike/MailUp/Model/Adminhtml/System/Source/Cron/Frequency.php +0 -0
  6. app/code/local/SevenLike/MailUp/Model/Adminhtml/System/Source/Cron/Hours.php +0 -0
  7. app/code/local/SevenLike/MailUp/Model/Consoleurlvalidator.php +0 -0
  8. app/code/local/SevenLike/MailUp/Model/Cron.php +74 -17
  9. app/code/local/SevenLike/MailUp/Model/Lists.php +4 -7
  10. app/code/local/SevenLike/MailUp/Model/MailUp.php +1 -0
  11. app/code/local/SevenLike/MailUp/Model/MailUpWsImport.php +659 -0
  12. app/code/local/SevenLike/MailUp/Model/Mysql14/MailUp.php +0 -0
  13. app/code/local/SevenLike/MailUp/Model/Mysql14/MailUp/Collection.php +0 -0
  14. app/code/local/SevenLike/MailUp/Model/Observer.php +135 -80
  15. app/code/local/SevenLike/MailUp/Model/Webserviceusernamevalidator.php +0 -0
  16. app/code/local/SevenLike/MailUp/Model/Ws.php +1 -646
  17. app/code/local/SevenLike/MailUp/Model/Wssend.php +3 -5
  18. app/code/local/SevenLike/MailUp/controllers/.DS_Store +0 -0
  19. app/code/local/SevenLike/MailUp/controllers/Adminhtml/.DS_Store +0 -0
  20. app/code/local/SevenLike/MailUp/controllers/Adminhtml/ConfigurationController.php +4 -2
  21. app/code/local/SevenLike/MailUp/controllers/Adminhtml/FieldsmappingController.php +3 -1
  22. app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php +72 -6
  23. app/code/local/SevenLike/MailUp/controllers/Adminhtml/ViewdatatransferlogController.php +14 -0
  24. app/code/local/SevenLike/MailUp/controllers/WebhookController.php +147 -0
  25. app/code/local/SevenLike/MailUp/etc/.DS_Store +0 -0
  26. app/code/local/SevenLike/MailUp/etc/config.xml +59 -10
  27. app/code/local/SevenLike/MailUp/etc/system.xml +38 -3
  28. app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-install-0.1.0.php +0 -0
  29. app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.1.0-1.0.0.php +0 -0
  30. app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.3.0-1.0.0.php +0 -0
  31. app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-1.0.0-1.5.2.php +0 -0
  32. app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-2.1.3-2.2.0.php +25 -0
  33. app/design/adminhtml/default/default/layout/mailup.xml +18 -1
  34. app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml +14 -38
  35. app/design/adminhtml/default/default/template/sevenlike/mailup/fieldsmapping.phtml +0 -2
  36. app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml +4 -23
  37. app/design/adminhtml/default/default/template/sevenlike/mailup/viewdatatransferlog.phtml +72 -0
  38. app/etc/modules/SevenLike_MailUp.xml +0 -0
  39. app/locale/en_US/SevenLike_MailUp.csv +5 -2
  40. app/locale/it_IT/SevenLike_MailUp.csv +11 -3
  41. package.xml +9 -13
  42. skin/adminhtml/default/default/sevenlike/mailup/images/titoli.png +0 -0
  43. skin/adminhtml/default/default/sevenlike/mailup/mailup.css +3 -1
app/code/local/SevenLike/MailUp/Block/.DS_Store CHANGED
File without changes
app/code/local/SevenLike/MailUp/Block/Checkout/Subscribe.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SevenLike_MailUp_Block_Checkout_Subscribe extends Mage_Core_Block_Template
4
+ {
5
+ public function _toHtml()
6
+ {
7
+ return parent::_toHtml();
8
+ }
9
+ }
app/code/local/SevenLike/MailUp/Helper/.DS_Store CHANGED
File without changes
app/code/local/SevenLike/MailUp/Helper/Data.php CHANGED
@@ -2,22 +2,28 @@
2
 
3
  class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
- public static function getCustomersData() {
6
- Mage::log('Getting customers data', 0);
 
7
  $dateFormat = 'm/d/y h:i:s';
8
  $lastDateTime = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-7*3600*24);
9
  $thirtyDaysAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-30*3600*24);
10
  $twelveMonthsAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-365*3600*24);
11
 
 
12
  $toSend = array();
 
 
 
 
 
 
 
 
13
 
14
- //ottengo la collection con tutti i clienti
15
- $customerCollection = Mage::getModel('customer/customer')->getCollection();
16
- foreach ($customerCollection as $customer) {
17
- $currentCustomerId = $customer->getId();
18
- $i = $customer->getEmail();
19
- Mage::log('Customer with id '.$currentCustomerId, 0);
20
  $customer = Mage::getModel('customer/customer')->load($currentCustomerId);
 
21
 
22
  //recupero gli ordini del cliente corrente
23
  $allOrdersTotalAmount = 0;
@@ -30,12 +36,12 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
30
  $lastShipmentOrderId = null;
31
  $lastShipmentOrderDate = null;
32
 
33
- Mage::log('Parsing orders of customer with id '.$currentCustomerId, 0);
34
  $orders = Mage::getModel('sales/order')
35
  ->getCollection()
36
  ->addAttributeToFilter('customer_id', $currentCustomerId);
37
  foreach ($orders as $order) {
38
- Mage::log("ORDINE IN STATUS: " . $order->getStatus());
39
  if (!in_array($order->getStatus(), array("closed", "complete", "processing"))) continue;
40
  $currentOrderTotal = floatval($order->getGrandTotal());
41
  $allOrdersTotalAmount += $currentOrderTotal;
@@ -76,7 +82,7 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
76
  ksort($allOrdersIds);
77
 
78
  //recupero i carrelli abbandonati del cliente
79
- Mage::log('Parsing abandoned carts of customer with id '.$currentCustomerId, 0);
80
  $cartCollection = Mage::getResourceModel('reports/quote_collection');
81
  $cartCollection->prepareForAbandonedReport(array(1));
82
  $cartCollection->addFieldToFilter('customer_id', $currentCustomerId);
@@ -91,7 +97,7 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
91
  $toSend[$i]['IDCarrelloAbbandonato'] = '';
92
 
93
  if (! empty($lastCart)) {
94
- Mage::log('Customer with id '.$currentCustomerId .' has abandoned cart', 0);
95
  $datetimeCart = $lastCart->getUpdatedAt();
96
  $toSend[$i]['TotaleCarrelloAbbandonato'] = self::_formatPrice($lastCart->getGrandTotal());
97
  $toSend[$i]['DataCarrelloAbbandonato'] = self::_retriveDateFromDatetime($datetimeCart);
@@ -108,7 +114,7 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
108
  || $lastOrderDateTime > $lastDateTime
109
  || ($datetimeCart && $datetimeCart > $lastDateTime))
110
  {
111
- Mage::log('Adding customer with id '.$currentCustomerId, 0);
112
 
113
  $toSend[$i]['nome'] = $customer->getFirstname();
114
  $toSend[$i]['cognome'] = $customer->getLastname();
@@ -163,39 +169,45 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
163
  }
164
 
165
  $toSend[$i]['IDProdottiUltimoOrdine'] = implode(',', $productIds);
 
166
  $toSend[$i]['IDCategorieUltimoOrdine'] = implode(',', $categoryIds);
 
167
  }
168
 
169
  //unsetto la variabile
170
  unset($customer);
171
  }
172
 
173
- Mage::log('Parsing subscribers', 0);
174
- $subscriberCollection = Mage::getModel('newsletter/subscriber')
175
- ->getCollection()
176
- ->useOnlySubscribed()
177
- ->addFieldToFilter('customer_id', 0);
178
-
179
- foreach ($subscriberCollection as $subscriber) {
180
- $subscriber = Mage::getModel('newsletter/subscriber')->load($subscriber->getId());
181
- $i = $subscriber->getEmail();
182
- if (isset($toSend[$i])) continue;
183
- $toSend[$i]['nome'] = '';
184
- $toSend[$i]['cognome'] = '';
185
- $toSend[$i]['email'] = $i;
186
- $toSend[$i]['subscribed'] = 'yes';
 
 
 
 
 
187
  }
 
188
 
189
- Mage::log('End getting customers data', 0);
190
-
191
  return $toSend;
192
  }
193
 
194
- public function generateAndSendCustomers($mailupCustomerIds, $post = null)
195
  {
196
- $MailUpWsSend = Mage::getModel('mailup/wssend');
197
  $wsSend = new MailUpWsSend();
198
- $MailUpWsSend = Mage::getModel('mailup/ws');
199
  $wsImport = new MailUpWsImport();
200
  $accessKey = $wsSend->loginFromId();
201
 
@@ -236,19 +248,72 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
236
  }
237
  }
238
 
239
- $customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
240
-
241
  if ($accessKey === false) {
242
  Mage::throwException('no access key returned');
243
  }
244
  $fields = $wsSend->GetFields($accessKey);
245
  $fields_mapping = $wsImport->getFieldsMapping();
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  //preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
248
- $xmlData = '<subscribers>';
 
 
249
  foreach ($mailupCustomerIds as $customerId) {
250
  $tmp = array();
251
- $subscriber = $customersData[$customerId['email']];
 
 
 
 
252
  $subscriber["DataCarrelloAbbandonato"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["DataCarrelloAbbandonato"]);
253
  $subscriber["DataUltimoOrdineSpedito"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["DataUltimoOrdineSpedito"]);
254
  $subscriber["registeredDate"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["registeredDate"]);
@@ -260,7 +325,11 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
260
  if (@$fields_mapping["Last"]) $tmp[$fields_mapping["Last"]] = '<campo'.$fields_mapping["Last"].'>'. ((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'</campo'.$fields_mapping["Last"].'>';
261
 
262
  foreach ($subscriber as $k=>$v) {
263
- if (!strlen($subscriber[$k])) $subscriber[$k] = "-";
 
 
 
 
264
  }
265
 
266
  if (@$fields_mapping["Company"]) $tmp[$fields_mapping["Company"]] = '<campo'.$fields_mapping["Company"].'>'. $subscriber['azienda'] .'</campo'.$fields_mapping["Company"].'>';
@@ -296,52 +365,54 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
296
  $tmp = implode("", $tmp);
297
  $xmlData .= $tmp;
298
  $xmlData .= "</subscriber>\n";
299
- }
300
- $xmlData .= '</subscribers>';
301
-
302
- Mage::log($xmlData, 0);
303
-
304
- //definisco il gruppo a cui aggiungere gli iscritti
305
- $groupId = $post['mailupGroupId'];
306
- $listGUID = $post['mailupListGUID'];
307
- $idList = $post['mailupIdList'];
308
 
309
- if ($post['mailupNewGroup'] == 1) {
310
- $newGroup = array(
311
- "idList" => $idList,
312
- "listGUID" => $listGUID,
313
- "newGroupName" => $post['mailupNewGroupName']
314
- );
 
 
 
 
315
 
316
- $groupId = $wsImport->CreaGruppo($newGroup);
 
 
 
 
 
 
 
317
  }
318
 
319
- $importProcessData = array(
320
- "idList" => $idList,
321
- "listGUID" => $listGUID,
322
- "idGroup" => $groupId,
323
- "xmlDoc" => $xmlData,
324
- "idGroups" => $groupId,
325
- "importType" => "3",
326
- "mobileInputType" => "2",
327
- "asPending" => "0",
328
- "ConfirmEmail" => "0",
329
- "asOptOut" => "0",
330
- "forceOptIn" => "0",
331
- "replaceGroups" => "0",
332
- "idConfirmNL" => "0"
333
- );
334
 
335
  //avvio l'importazione su mailup
336
- $processID = $wsImport->newImportProcess($importProcessData);
337
-
338
- $process = array(
339
- "idList" => $post['mailupIdList'],
340
- "listGUID" => $post['mailupListGUID'],
341
- "idProcess" => $processID
342
- );
343
-
344
- $wsImport->startProcess($process);
345
  }
346
 
347
  private static function _formatPrice($price) {
2
 
3
  class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
+ public static function getCustomersData($customerCollection = null)
6
+ {
7
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Getting customers data', 0);
8
  $dateFormat = 'm/d/y h:i:s';
9
  $lastDateTime = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-7*3600*24);
10
  $thirtyDaysAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-30*3600*24);
11
  $twelveMonthsAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-365*3600*24);
12
 
13
+ $parseSubscribers = false;
14
  $toSend = array();
15
+ if ($customerCollection === null) {
16
+ $customerCollection = Mage::getModel('customer/customer')->getCollection();
17
+ $parseSubscribers = true;
18
+ }
19
+ foreach ($customerCollection as $currentCustomerId) {
20
+ if (is_object($currentCustomerId)) {
21
+ $currentCustomerId = $currentCustomerId->getId();
22
+ }
23
 
24
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Customer with id '.$currentCustomerId, 0);
 
 
 
 
 
25
  $customer = Mage::getModel('customer/customer')->load($currentCustomerId);
26
+ $i = $customer->getEmail();
27
 
28
  //recupero gli ordini del cliente corrente
29
  $allOrdersTotalAmount = 0;
36
  $lastShipmentOrderId = null;
37
  $lastShipmentOrderDate = null;
38
 
39
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Parsing orders of customer with id '.$currentCustomerId, 0);
40
  $orders = Mage::getModel('sales/order')
41
  ->getCollection()
42
  ->addAttributeToFilter('customer_id', $currentCustomerId);
43
  foreach ($orders as $order) {
44
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("ORDINE IN STATUS: " . $order->getStatus());
45
  if (!in_array($order->getStatus(), array("closed", "complete", "processing"))) continue;
46
  $currentOrderTotal = floatval($order->getGrandTotal());
47
  $allOrdersTotalAmount += $currentOrderTotal;
82
  ksort($allOrdersIds);
83
 
84
  //recupero i carrelli abbandonati del cliente
85
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Parsing abandoned carts of customer with id '.$currentCustomerId, 0);
86
  $cartCollection = Mage::getResourceModel('reports/quote_collection');
87
  $cartCollection->prepareForAbandonedReport(array(1));
88
  $cartCollection->addFieldToFilter('customer_id', $currentCustomerId);
97
  $toSend[$i]['IDCarrelloAbbandonato'] = '';
98
 
99
  if (! empty($lastCart)) {
100
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Customer with id '.$currentCustomerId .' has abandoned cart', 0);
101
  $datetimeCart = $lastCart->getUpdatedAt();
102
  $toSend[$i]['TotaleCarrelloAbbandonato'] = self::_formatPrice($lastCart->getGrandTotal());
103
  $toSend[$i]['DataCarrelloAbbandonato'] = self::_retriveDateFromDatetime($datetimeCart);
114
  || $lastOrderDateTime > $lastDateTime
115
  || ($datetimeCart && $datetimeCart > $lastDateTime))
116
  {
117
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Adding customer with id '.$currentCustomerId, 0);
118
 
119
  $toSend[$i]['nome'] = $customer->getFirstname();
120
  $toSend[$i]['cognome'] = $customer->getLastname();
169
  }
170
 
171
  $toSend[$i]['IDProdottiUltimoOrdine'] = implode(',', $productIds);
172
+ if ($toSend[$i]['IDProdottiUltimoOrdine']) $toSend[$i]['IDProdottiUltimoOrdine'] = ",{$toSend[$i]['IDProdottiUltimoOrdine']},";
173
  $toSend[$i]['IDCategorieUltimoOrdine'] = implode(',', $categoryIds);
174
+ if ($toSend[$i]['IDCategorieUltimoOrdine']) $toSend[$i]['IDCategorieUltimoOrdine'] = ",{$toSend[$i]['IDCategorieUltimoOrdine']},";
175
  }
176
 
177
  //unsetto la variabile
178
  unset($customer);
179
  }
180
 
181
+ /*
182
+ * disabled cause useless in segmentation
183
+ if ($parseSubscribers) {
184
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Parsing subscribers', 0);
185
+ $subscriberCollection = Mage::getModel('newsletter/subscriber')
186
+ ->getCollection()
187
+ ->useOnlySubscribed()
188
+ ->addFieldToFilter('customer_id', 0);
189
+
190
+ foreach ($subscriberCollection as $subscriber) {
191
+ $subscriber = Mage::getModel('newsletter/subscriber')->load($subscriber->getId());
192
+ $i = $subscriber->getEmail();
193
+ if (strlen($i)) continue;
194
+ if (isset($toSend[$i])) continue;
195
+ $toSend[$i]['nome'] = '';
196
+ $toSend[$i]['cognome'] = '';
197
+ $toSend[$i]['email'] = $i;
198
+ $toSend[$i]['subscribed'] = 'yes';
199
+ }
200
  }
201
+ */
202
 
203
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('End getting customers data', 0);
 
204
  return $toSend;
205
  }
206
 
207
+ public static function generateAndSendCustomers($mailupCustomerIds, $post = null, $newsletter_subscribers = null)
208
  {
 
209
  $wsSend = new MailUpWsSend();
210
+ require_once dirname(__FILE__) . "/../Model/MailUpWsImport.php";
211
  $wsImport = new MailUpWsImport();
212
  $accessKey = $wsSend->loginFromId();
213
 
248
  }
249
  }
250
 
 
 
251
  if ($accessKey === false) {
252
  Mage::throwException('no access key returned');
253
  }
254
  $fields = $wsSend->GetFields($accessKey);
255
  $fields_mapping = $wsImport->getFieldsMapping();
256
 
257
+ //definisco il gruppo a cui aggiungere gli iscritti
258
+ $groupId = $post['mailupGroupId'];
259
+ $listGUID = $post['mailupListGUID'];
260
+ $idList = $post['mailupIdList'];
261
+
262
+ if ($post['mailupNewGroup'] == 1) {
263
+ $newGroup = array(
264
+ "idList" => $idList,
265
+ "listGUID" => $listGUID,
266
+ "newGroupName" => $post['mailupNewGroupName']
267
+ );
268
+
269
+ $groupId = $wsImport->CreaGruppo($newGroup);
270
+ }
271
+
272
+ if (isset($post["send_optin_email_to_new_subscribers"]) and $post["send_optin_email_to_new_subscribers"]) {
273
+ $importProcessData = array(
274
+ "idList" => $idList,
275
+ "listGUID" => $listGUID,
276
+ "idGroup" => $groupId,
277
+ "xmlDoc" => "",
278
+ "idGroups" => $groupId,
279
+ "importType" => 1,
280
+ "mobileInputType" => 2,
281
+ "asPending" => false,
282
+ "ConfirmEmail" => true,
283
+ "asOptOut" => false,
284
+ "forceOptIn" => false,
285
+ "replaceGroups" => false,
286
+ "idConfirmNL" => 0
287
+ );
288
+ } else {
289
+ $importProcessData = array(
290
+ "idList" => $idList,
291
+ "listGUID" => $listGUID,
292
+ "idGroup" => $groupId,
293
+ "xmlDoc" => "",
294
+ "idGroups" => $groupId,
295
+ "importType" => 1,
296
+ "mobileInputType" => 2,
297
+ "asPending" => false,
298
+ "ConfirmEmail" => false,
299
+ "asOptOut" => false,
300
+ "forceOptIn" => false,
301
+ "replaceGroups" => false,
302
+ "idConfirmNL" => 0
303
+ );
304
+ }
305
+
306
  //preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
307
+ $xmlData = '';
308
+ $subscribers_counter = 0;
309
+ $total_subscribers_to_send = sizeof($mailupCustomerIds);
310
  foreach ($mailupCustomerIds as $customerId) {
311
  $tmp = array();
312
+ $subscribers_counter++;
313
+ $subscriber = self::getCustomersData(array($customerId));
314
+ $subscriber = array_values($subscriber);
315
+ $subscriber = $subscriber[0];
316
+
317
  $subscriber["DataCarrelloAbbandonato"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["DataCarrelloAbbandonato"]);
318
  $subscriber["DataUltimoOrdineSpedito"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["DataUltimoOrdineSpedito"]);
319
  $subscriber["registeredDate"] = self::_convertUTCToStoreTimezoneAndFormatForMailup($subscriber["registeredDate"]);
325
  if (@$fields_mapping["Last"]) $tmp[$fields_mapping["Last"]] = '<campo'.$fields_mapping["Last"].'>'. ((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'</campo'.$fields_mapping["Last"].'>';
326
 
327
  foreach ($subscriber as $k=>$v) {
328
+ if (!strlen($subscriber[$k])) {
329
+ $subscriber[$k] = "-";
330
+ } else {
331
+ $subscriber[$k] = str_replace(array("\r\n", "\r", "\n"), " ", $v);
332
+ }
333
  }
334
 
335
  if (@$fields_mapping["Company"]) $tmp[$fields_mapping["Company"]] = '<campo'.$fields_mapping["Company"].'>'. $subscriber['azienda'] .'</campo'.$fields_mapping["Company"].'>';
365
  $tmp = implode("", $tmp);
366
  $xmlData .= $tmp;
367
  $xmlData .= "</subscriber>\n";
 
 
 
 
 
 
 
 
 
368
 
369
+ // ogni 5000 utenti invio i dati
370
+ if ($subscribers_counter == 5000) {
371
+ $importProcessData["xmlDoc"] = "<subscribers>$xmlData</subscribers>";
372
+ $xmlData = "";
373
+ $subscribers_counter = 0;
374
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($importProcessData, 0);
375
+ $processID = $wsImport->newImportProcess($importProcessData);
376
+ if ($processID === false) return false;
377
+ }
378
+ }
379
 
380
+ //invio gli ultimi utenti
381
+ if (strlen($xmlData)) {
382
+ $importProcessData["xmlDoc"] = "<subscribers>$xmlData</subscribers>";
383
+ $xmlData = "";
384
+ $subscribers_counter = 0;
385
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($importProcessData, 0);
386
+ $processID = $wsImport->newImportProcess($importProcessData);
387
+ if ($processID === false) return false;
388
  }
389
 
390
+ if (isset($newsletter_subscribers) and is_array($newsletter_subscribers) and !empty($newsletter_subscribers)) {
391
+ $subscribers_counter = 0;
392
+ foreach ($newsletter_subscribers as $newsletter_subscriber) {
393
+ $subscribers_counter++;
394
+ $xmlData .= '<subscriber email="' . $newsletter_subscriber . '" Number="" Name=""></subscriber>';
395
+ if ($subscribers_counter == 5000 or $subscribers_counter == $total_subscribers_to_send) {
396
+ $importProcessData["xmlDoc"] = "<subscribers>$xmlData</subscribers>";
397
+ $xmlData = "";
398
+ $subscribers_counter = 0;
399
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($importProcessData, 0);
400
+ $processID = $wsImport->newImportProcess($importProcessData);
401
+ if ($processID === false) return false;
402
+ }
403
+ }
404
+ }
405
 
406
  //avvio l'importazione su mailup
407
+ unset($importProcessData["xmlDoc"]);
408
+ $importProcessData["listsIDs"] = $post['mailupIdList'];
409
+ $importProcessData["listsGUIDs"] = $post['mailupListGUID'];
410
+ $importProcessData["groupsIDs"] = $groupId;
411
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup: StartImportProcesses", 0);
412
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($importProcessData, 0);
413
+ $check = $wsImport->StartImportProcesses($importProcessData);
414
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($check, 0);
415
+ return $check;
416
  }
417
 
418
  private static function _formatPrice($price) {
app/code/local/SevenLike/MailUp/Model/Adminhtml/System/Source/Cron/Frequency.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Adminhtml/System/Source/Cron/Hours.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Consoleurlvalidator.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Cron.php CHANGED
@@ -1,30 +1,87 @@
1
  <?php
2
 
 
 
3
  class SevenLike_MailUp_Model_Cron
4
  {
5
- public function run() {
6
- Mage::log('Cron mailup', 0);
 
7
 
8
  if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1) {
9
- Mage::log('Cron export enabled', 0);
10
- require_once(dirname(__FILE__) . '/../Helper/Data.php');
11
-
12
- $mailupCustomerIds = array();
13
- $customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
14
- foreach ($customersData as $tmp) {
15
- $status = Mage::getModel('newsletter/subscriber')->loadByEmail($tmp["email"])->getStatus();
16
- if ($status != Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED) continue;
17
- $mailupCustomerIds[] = array(
18
- "entity_id" => $tmp["IDCliente"],
19
- "email" => $tmp["email"]
20
- );
21
  }
 
22
 
23
- SevenLike_MailUp_Helper_Data::generateAndSendCustomers($mailupCustomerIds);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  } else {
25
- Mage::log('Cron export not enabled', 0);
26
  }
27
 
28
- Mage::log('Cron mailup finished', 0);
 
 
 
 
29
  }
30
  }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/Wssend.php";
5
  class SevenLike_MailUp_Model_Cron
6
  {
7
+ public function run()
8
+ {
9
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Cron mailup', 0);
10
 
11
  if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1) {
12
+ $indexProcess = new Mage_Index_Model_Process();
13
+ $indexProcess->setId("mailupcronrun");
14
+ if ($indexProcess->isLocked()) {
15
+ Mage::log("MAILUP: cron already running or locked");
16
+ return false;
 
 
 
 
 
 
 
17
  }
18
+ $indexProcess->lockAndBlock();
19
 
20
+ require_once dirname(__FILE__) . '/../Helper/Data.php';
21
+ $db_read = Mage::getSingleton('core/resource')->getConnection('core_read');
22
+ $db_write = Mage::getSingleton('core/resource')->getConnection('core_write');
23
+ $lastsync = gmdate("Y-m-d H:i:s");
24
+
25
+ // reading newsletter subscribers
26
+ //$newsletter_subscriber_table_name = Mage::getSingleton('core/resource')->getTableName('newsletter_subscriber');
27
+ //$newsletter_subscribers = $db_read->fetchAll("SELECT ms.*, ns.subscriber_email FROM mailup_sync ms JOIN $newsletter_subscriber_table_name ns ON (ms.customer_id = ns.subscriber_id) WHERE ms.needs_sync=1 AND ms.entity='subscriber'");
28
+
29
+ // reading customers (jobid == 0, their updates)
30
+ $customers = array();
31
+ $customer_entity_table_name = Mage::getSingleton('core/resource')->getTableName('customer_entity');
32
+ $stmt = $db_read->query("SELECT ms.*, ce.email FROM mailup_sync ms JOIN $customer_entity_table_name ce ON (ms.customer_id = ce.entity_id) WHERE ms.needs_sync=1 AND ms.entity='customer' AND job_id=0");
33
+ while ($row = $stmt->fetch()) {
34
+ $customers[] = $row["customer_id"];
35
+ }
36
+
37
+ // generating and sending data to mailup
38
+ //SevenLike_MailUp_Helper_Data::generateAndSendCustomers($customers, null, $newsletter_subscribers);
39
+ $check = SevenLike_MailUp_Helper_Data::generateAndSendCustomers($customers);
40
+
41
+ // reading and processing jobs
42
+ $jobs = $db_read->fetchAll("SELECT * FROM mailup_sync_jobs WHERE status='queued'");
43
+ foreach ($jobs as $job) {
44
+ $stmt = $db_write->query("UPDATE mailup_sync_jobs SET status='started', start_datetime='" . gmdate("Y-m-d H:i:s") . "' WHERE id={$job["id"]}");
45
+ $customers = array();
46
+ $job['mailupNewGroup'] = 0;
47
+ $job['mailupIdList'] = Mage::getStoreConfig('newsletter/mailup/list');
48
+ $job["mailupGroupId"] = $job["mailupgroupid"];
49
+ $job["send_optin_email_to_new_subscribers"] = $job["send_optin"];
50
+ $tmp = new SevenLike_MailUp_Model_Lists;
51
+ $tmp = $tmp->toOptionArray();
52
+ foreach ($tmp as $t) {
53
+ if ($t["value"] == $job['mailupIdList']) {
54
+ $job['mailupListGUID'] = $t["guid"];
55
+ $job["groups"] = $t["groups"];
56
+ break;
57
+ }
58
+ }
59
+ unset($tmp); unset($t);
60
+ $stmt = $db_read->query("SELECT ms.*, ce.email FROM mailup_sync ms JOIN $customer_entity_table_name ce ON (ms.customer_id = ce.entity_id) WHERE ms.needs_sync=1 AND ms.entity='customer' AND job_id={$job["id"]}");
61
+ while ($row = $stmt->fetch()) {
62
+ $customers[] = $row["customer_id"];
63
+ }
64
+ $check = SevenLike_MailUp_Helper_Data::generateAndSendCustomers($customers, $job);
65
+ if ($check) {
66
+ // saving sync state for customers
67
+ foreach ($customers as $row) {
68
+ $db_write->query("UPDATE mailup_sync SET needs_sync=0, last_sync='$lastsync' WHERE customer_id={$row} AND entity='customer'");
69
+ }
70
+
71
+ // finishing the job also
72
+ $db_write->query("UPDATE mailup_sync_jobs SET status='finished', finish_datetime='" . gmdate("Y-m-d H:i:s") . "' WHERE id={$job["id"]}");
73
+ }
74
+ }
75
+
76
+ $indexProcess->unlock();
77
  } else {
78
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Cron export not enabled', 0);
79
  }
80
 
81
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Cron mailup finished', 0);
82
+ }
83
+
84
+ public static function resendConnectionErrors()
85
+ {
86
  }
87
  }
app/code/local/SevenLike/MailUp/Model/Lists.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  class SevenLike_MailUp_Model_Lists
4
  {
5
  public function toOptionArray() {
@@ -7,16 +9,11 @@ class SevenLike_MailUp_Model_Lists
7
  $selectLists = array();
8
 
9
  if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/username_ws') && Mage::getStoreConfig('newsletter/mailup/password_ws')) {
10
- if (!class_exists("MailUpWsSend")) {
11
- $MailUpWsSend = Mage::getModel('mailup/wssend');
12
- }
13
  $wsSend = new MailUpWsSend();
14
  $accessKey = $wsSend->loginFromId();
15
 
16
  if ($accessKey !== false) {
17
- if (!class_exists("MailUpWsImport")) {
18
- $MailUpWsImport = Mage::getModel('mailup/ws');
19
- }
20
  $wsImport = new MailUpWsImport();
21
 
22
  $xmlString = $wsImport->GetNlList();
@@ -47,7 +44,7 @@ class SevenLike_MailUp_Model_Lists
47
  }
48
  }
49
  } else {
50
- Mage::log('LoginFromId failed', 0);
51
  $selectLists[0] = array('value' => 0, 'label'=>$GLOBALS["__sl_mailup_login_error"]);
52
  }
53
  }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/Wssend.php";
5
  class SevenLike_MailUp_Model_Lists
6
  {
7
  public function toOptionArray() {
9
  $selectLists = array();
10
 
11
  if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/username_ws') && Mage::getStoreConfig('newsletter/mailup/password_ws')) {
 
 
 
12
  $wsSend = new MailUpWsSend();
13
  $accessKey = $wsSend->loginFromId();
14
 
15
  if ($accessKey !== false) {
16
+ require_once dirname(__FILE__) . "/MailUpWsImport.php";
 
 
17
  $wsImport = new MailUpWsImport();
18
 
19
  $xmlString = $wsImport->GetNlList();
44
  }
45
  }
46
  } else {
47
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('LoginFromId failed', 0);
48
  $selectLists[0] = array('value' => 0, 'label'=>$GLOBALS["__sl_mailup_login_error"]);
49
  }
50
  }
app/code/local/SevenLike/MailUp/Model/MailUp.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class SevenLike_MailUp_Model_MailUp extends Mage_Core_Model_Abstract
3
  {
4
  public function _construct()
1
  <?php
2
+
3
  class SevenLike_MailUp_Model_MailUp extends Mage_Core_Model_Abstract
4
  {
5
  public function _construct()
app/code/local/SevenLike/MailUp/Model/MailUpWsImport.php ADDED
@@ -0,0 +1,659 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class MailUpWsImport
4
+ {
5
+ protected $ns = "http://ws.mailupnet.it/";
6
+
7
+ //protected $WSDLUrl = "http://g4a0.s03.it/services/WSMailUpImport.asmx?WSDL";
8
+ //protected $headers = array("User" => "a7410", "Password" => "GA6VAN0W");
9
+ protected $rCode;
10
+ private $soapClient;
11
+ private $xmlResponse;
12
+ protected $domResult;
13
+
14
+ function __construct() {
15
+ $urlConsole = Mage::getStoreConfig('newsletter/mailup/url_console');
16
+ $WSDLUrl = 'http://'. $urlConsole .'/services/WSMailUpImport.asmx?WSDL';
17
+ $user = Mage::getStoreConfig('newsletter/mailup/username_ws');
18
+ $password = Mage::getStoreConfig('newsletter/mailup/password_ws');
19
+ $headers = array('User' => $user, 'Password' => $password);
20
+ $this->header = new SOAPHeader($this->ns, 'Authentication', $headers);
21
+
22
+ try {
23
+ $this->soapClient = new SoapClient($WSDLUrl, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 10));
24
+ $this->soapClient->__setSoapHeaders($this->header);
25
+ } catch (Exception $e) {
26
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper("mailup")->__("Unable to connect to MailUp console"));
27
+ }
28
+ }
29
+
30
+ function __destruct() {
31
+ unset($this->soapClient);
32
+ }
33
+
34
+ public function getFunctions() {
35
+ print_r($this->soapClient->__getFunctions());
36
+ }
37
+
38
+ public function creaGruppo($newGroup) {
39
+ if (!is_object($this->soapClient)) return false;
40
+ try {
41
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("Mailup: creazione nuovo gruppo");
42
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($newGroup);
43
+ $this->soapClient->CreateGroup($newGroup);
44
+ $this->printLastRequest();
45
+ $this->printLastResponse();
46
+ return $this->readReturnCode('CreateGroup', 'ReturnCode');
47
+ } catch (SoapFault $soapFault) {
48
+ Mage::log('SOAP error', 0);
49
+ Mage::log($soapFault, 0);
50
+ }
51
+ }
52
+
53
+ public function GetNlList() {
54
+ if (!is_object($this->soapClient)) return false;
55
+ try {
56
+ $this->soapClient->GetNlLists();
57
+ $this->printLastRequest();
58
+ $this->printLastResponse();
59
+ $result = $this->soapClient->__getLastResponse();
60
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($result, 0);
61
+ return $result;
62
+ } catch (SoapFault $soapFault) {
63
+ Mage::log('SOAP error', 0);
64
+ Mage::log($soapFault, 0);
65
+ }
66
+ }
67
+
68
+ public function newImportProcess($importProcessData) {
69
+ if (!is_object($this->soapClient)) return false;
70
+ try {
71
+ $this->soapClient->NewImportProcess($importProcessData);
72
+ $returncode = $this->readReturnCode('NewImportProcess', 'ReturnCode');
73
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup: newImportProcess result: $returncode", 0);
74
+ return $returncode;
75
+ } catch (SoapFault $soapFault) {
76
+ Mage::log('SOAP error', 0);
77
+ Mage::log($soapFault, 0);
78
+ return false;
79
+ }
80
+ }
81
+
82
+ public function startProcess($processData) {
83
+ if (!is_object($this->soapClient)) return false;
84
+ try {
85
+ $this->soapClient->StartProcess($processData);
86
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup: ws: startimportprocess", 0);
87
+ return true;
88
+ } catch (SoapFault $soapFault) {
89
+ Mage::log('SOAP error', 0);
90
+ Mage::log($soapFault, 0);
91
+ return false;
92
+ }
93
+ }
94
+
95
+ public function getProcessDetail($processData) {
96
+ if (!is_object($this->soapClient)) return false;
97
+ try {
98
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($this->soapClient->GetProcessDetails($processData), 0);
99
+ } catch (SoapFault $soapFault) {
100
+ Mage::log('SOAP error', 0);
101
+ Mage::log($soapFault, 0);
102
+ }
103
+ }
104
+
105
+ public function startImportProcesses($processData) {
106
+ if (!is_object($this->soapClient)) return false;
107
+ try {
108
+ $this->soapClient->StartImportProcesses($processData);
109
+ $this->printLastRequest();
110
+ $this->printLastResponse();
111
+ return true;
112
+ } catch (SoapFault $soapFault) {
113
+ Mage::log('SOAP error', 0);
114
+ Mage::log($soapFault, 0);
115
+ return false;
116
+ }
117
+ }
118
+
119
+ private function readReturnCode($func, $param) {
120
+ if (!is_object($this->soapClient)) return false;
121
+
122
+ static $func_in = ''; //static variable to test xmlResponse update
123
+ if ($func_in != $func) {//(!isset($this->xmlResponse))
124
+ $func_in = $func;
125
+ //prendi l'XML di ritorno se non l'ho già preso
126
+ $this->xmlResponse = $this->soapClient->__getLastResponse();
127
+
128
+ $dom = new DomDocument();
129
+ $dom->loadXML($this->xmlResponse) or die('File XML non valido!');
130
+ $xmlResult = $dom->getElementsByTagName($func.'Result');
131
+
132
+ $this->domResult = new DomDocument();
133
+ $this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die('File XML non valido!');
134
+ }
135
+ $rCode = $this->domResult->getElementsByTagName($param);
136
+ return $rCode->item(0)->nodeValue;
137
+ }
138
+
139
+ private function printLastRequest()
140
+ {
141
+ return "";
142
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) $this->soapClient->__getLastRequest();
143
+ }
144
+
145
+ private function printLastResponse()
146
+ {
147
+ return "";
148
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) $this->soapClient->__getLastResponse();
149
+ }
150
+
151
+ public function getCustomersFiltered($request)
152
+ {
153
+ $TIMEZONE_STORE = new DateTimeZone(Mage::getStoreConfig("general/locale/timezone"));
154
+ $TIMEZONE_UTC = new DateTimeZone("UTC");
155
+
156
+ //inizializzo l'array dei clienti
157
+ $customersFiltered = array();
158
+
159
+ if (!$request->getRequest()->getParam('mailupCustomerFilteredMod')) {
160
+ //ottengo la collection con tutti i clienti
161
+ $customerCollection = Mage::getModel('customer/customer')
162
+ ->getCollection()
163
+ ->addAttributeToSelect('entity_id')
164
+ ->addAttributeToSelect('group_id')
165
+ ->addAttributeToSelect('created_at')
166
+ ->getSelect()
167
+ ->query();
168
+
169
+ while ($row = $customerCollection->fetch()) {
170
+ $customersFiltered[] = $row;
171
+ }
172
+
173
+ //se richiesto, seleziono solo quelli iscritti alla newsletter di Magento
174
+ if ($request->getRequest()->getParam('mailupSubscribed') > 0) {
175
+ $tempSubscribed = array();
176
+ foreach ($customersFiltered as $customer) {
177
+ $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
178
+ if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customerItem)->isSubscribed()) {
179
+ $tempSubscribed[] = $customer;
180
+ }
181
+ }
182
+ $customersFiltered = array_intersect($tempSubscribed, $customersFiltered);
183
+ }
184
+
185
+ //FILTRO 1 ACQUISTATO: in base al fatto se ha effettuato o meno acquisti: 0 = tutti, 1 = chi ha acquistato, 2 = chi non ha mai acquistato
186
+ $count = 0;
187
+ $result = array();
188
+ $tempPurchased = array();
189
+ $tempNoPurchased = array();
190
+
191
+ if ($request->getRequest()->getParam('mailupCustomers') > 0) {
192
+ foreach ($customersFiltered as $customer) {
193
+ $result[] = $customer;
194
+
195
+ //filtro gli ordini in base al customer id
196
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
197
+
198
+ //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
199
+ if ($orders->getData()) {
200
+ $tempPurchased[] = $result[$count];
201
+ } else {
202
+ $tempNoPurchased[] = $result[$count];
203
+ }
204
+
205
+ //unsetto la variabile
206
+ unset($orders); //->unsetData();
207
+
208
+ $count++;
209
+ }
210
+
211
+ if ($request->getRequest()->getParam('mailupCustomers') == 1) {
212
+ $customersFiltered = array_intersect($tempPurchased, $customersFiltered);
213
+ } elseif ($request->getRequest()->getParam('mailupCustomers') == 2) {
214
+ $customersFiltered = array_intersect($tempNoPurchased, $customersFiltered);
215
+ }
216
+ }
217
+ //FINE FILTRO 1 ACQUISTATO: testato OK
218
+
219
+ //FILTRO 2 PRODOTTO ACQUISTATO: in base al fatto se ha acquistato un determinato prodotto
220
+ $count = 0;
221
+ $result = array();
222
+ $tempProduct = array();
223
+
224
+ if ($request->getRequest()->getParam('mailupProductSku')) {
225
+ foreach ($customersFiltered as $customer) {
226
+ $result[] = $customer;
227
+
228
+ //filtro gli ordini in base al customer id
229
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
230
+ $purchasedProduct = 0;
231
+
232
+ $mailupProductId = Mage::getModel('catalog/product')->getIdBySku($request->getRequest()->getParam('mailupProductSku'));
233
+
234
+ foreach ($orders->getData() as $order) {
235
+ if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
236
+ $orderIncrementId = $order['increment_id'];
237
+
238
+ //carico i dati di ogni ordine
239
+ $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
240
+ $items = $orderData->getAllItems();
241
+ $ids = array();
242
+ foreach ($items as $itemId => $item) {
243
+ $ids[] = $item->getProductId();
244
+ }
245
+
246
+ if (in_array($mailupProductId, $ids)) {
247
+ $purchasedProduct = 1;
248
+ }
249
+ }
250
+
251
+ //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
252
+ if ($purchasedProduct == 1) {
253
+ $tempProduct[] = $result[$count];
254
+ }
255
+
256
+ //unsetto la variabile
257
+ unset($orders); //->unsetData();
258
+
259
+ $count++;
260
+ }
261
+
262
+ $customersFiltered = array_intersect($tempProduct, $customersFiltered);
263
+ }
264
+ //FINE FILTRO 2 PRODOTTO ACQUISTATO: testato OK
265
+
266
+
267
+ //FILTRO 3 ACQUISTATO IN CATEGORIA: in base al fatto se ha acquistato almeno un prodotto in una determinata categoria
268
+ $count = 0;
269
+ $result = array();
270
+ $tempCategory = array();
271
+
272
+ if ($request->getRequest()->getParam('mailupCategoryId') > 0) {
273
+ foreach ($customersFiltered as $customer) {
274
+ $result[] = $customer;
275
+
276
+ //filtro gli ordini in base al customer id
277
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
278
+ $purchasedCategory = 0;
279
+
280
+ foreach ($orders->getData() as $order) {
281
+ if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
282
+ $orderIncrementId = $order['increment_id'];
283
+
284
+ //carico i dati di ogni ordine
285
+ $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
286
+ $items = $orderData->getAllItems();
287
+ $cat_ids = array();
288
+ foreach ($items as $product) {
289
+ if (in_array($request->getRequest()->getParam('mailupCategoryId'), Mage::getResourceSingleton('catalog/product')->getCategoryIds($product))) {
290
+ $tempCategory[] = $result[$count];
291
+ break 2;
292
+ }
293
+ }
294
+ }
295
+
296
+ unset($orders);
297
+ $count++;
298
+ }
299
+
300
+ $customersFiltered = array_intersect($tempCategory, $customersFiltered);
301
+ }
302
+ //FINE FILTRO 3 ACQUISTATO IN CATEGORIA: testato ok
303
+
304
+
305
+ //FILTRO 4 GRUPPO DI CLIENTI
306
+ $count = 0;
307
+ $result = array();
308
+ $tempGroup = array();
309
+
310
+ if ($request->getRequest()->getParam('mailupCustomerGroupId') > 0) {
311
+ foreach ($customersFiltered as $customer) {
312
+ if ($customer['group_id'] == $request->getRequest()->getParam('mailupCustomerGroupId')) {
313
+ $tempGroup[] = $customer;
314
+ }
315
+ }
316
+
317
+ $customersFiltered = array_intersect($tempGroup, $customersFiltered);
318
+ }
319
+ //FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
320
+
321
+
322
+ //FILTRO 5 PAESE DI PROVENIENZA
323
+ $count = 0;
324
+ $result = array();
325
+ $tempCountry = array();
326
+
327
+ if ($request->getRequest()->getParam('mailupCountry') != '0') {
328
+ foreach ($customersFiltered as $customer) {
329
+ //ottengo la nazione del primary billing address
330
+ $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
331
+ $customerAddress = $customerItem->getPrimaryBillingAddress();
332
+ $countryId = $customerAddress['country_id'];
333
+
334
+ if ($countryId == $request->getRequest()->getParam('mailupCountry')) {
335
+ $tempCountry[] = $customer;
336
+ }
337
+
338
+ //unsetto la variabile
339
+ unset($customerItem); //->unsetData();
340
+ }
341
+
342
+ $customersFiltered = array_intersect($tempCountry, $customersFiltered);
343
+ }
344
+ //FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
345
+
346
+
347
+ //FILTRO 6 CAP DI PROVENIENZA
348
+ $count = 0;
349
+ $result = array();
350
+ $tempPostCode = array();
351
+
352
+ if ($request->getRequest()->getParam('mailupPostCode')) {
353
+ foreach ($customersFiltered as $customer) {
354
+ //ottengo la nazione del primary billing address
355
+ $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
356
+ $customerAddress = $customerItem->getPrimaryBillingAddress();
357
+ $postCode = $customerAddress['postcode'];
358
+
359
+ if ($postCode == $request->getRequest()->getParam('mailupPostCode')) {
360
+ $tempPostCode[] = $customer;
361
+ }
362
+
363
+ //unsetto la variabile
364
+ unset($customerItem); //->unsetData();
365
+ }
366
+
367
+ $customersFiltered = array_intersect($tempPostCode, $customersFiltered);
368
+ }
369
+ //FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
370
+
371
+
372
+ //FILTRO 7 DATA CREAZIONE CLIENTE
373
+ $count = 0;
374
+ $result = array();
375
+ $tempDate = array();
376
+
377
+ if ($request->getRequest()->getParam('mailupCustomerStartDate') || $request->getRequest()->getParam('mailupCustomerEndDate') ) {
378
+ foreach ($customersFiltered as $customer) {
379
+ $createdAt = $customer['created_at'];
380
+ $createdAt = new DateTime($createdAt, $TIMEZONE_UTC);
381
+ $createdAt->setTimezone($TIMEZONE_STORE);
382
+ $createdAt = (string)$createdAt->format("Y-m-d H:i:s");
383
+ $filterStart = '';
384
+ $filterEnd = '';
385
+
386
+ if ($request->getRequest()->getParam('mailupCustomerStartDate')) {
387
+ $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupCustomerStartDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
388
+ $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
389
+ $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
390
+ $filterStart = "{$date['year']}-{$date['month']}-{$date['day']} 00:00:00";
391
+ }
392
+ if ($request->getRequest()->getParam('mailupCustomerEndDate')) {
393
+ $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupCustomerEndDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
394
+ $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
395
+ $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
396
+ $filterEnd = "{$date['year']}-{$date['month']}-{$date['day']} 23:59:59";
397
+ }
398
+ if ($filterStart && $filterEnd) {
399
+ //compreso tra start e end date
400
+ if ($createdAt >= $filterStart and $createdAt <= $filterEnd) {
401
+ $tempDate[] = $customer;
402
+ }
403
+ } elseif ($filterStart) {
404
+ // >= di start date
405
+ if ($createdAt >= $filterStart) {
406
+ $tempDate[] = $customer;
407
+ }
408
+ } else {
409
+ // <= di end date
410
+ if ($createdAt <= $filterEnd) {
411
+ $tempDate[] = $customer;
412
+ }
413
+ }
414
+ }
415
+
416
+ $customersFiltered = array_intersect($tempDate, $customersFiltered);
417
+ }
418
+ //FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
419
+
420
+
421
+ //FILTRO 8 TOTALE ACQUISTATO
422
+ $count = 0;
423
+ $result = array();
424
+ $tempTotal = array();
425
+
426
+ if ($request->getRequest()->getParam('mailupTotalAmountValue') > 0) {
427
+ foreach ($customersFiltered as $customer) {
428
+ $result[] = $customer;
429
+
430
+ //filtro gli ordini in base al customer id
431
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
432
+
433
+ $totalOrdered = 0;
434
+
435
+ foreach ($orders->getData() as $order) {
436
+ if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
437
+ $totalOrdered += $order['subtotal'];
438
+ }
439
+
440
+ if ($totalOrdered == $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "eq") {
441
+ $tempTotal[] = $result[$count];
442
+ }
443
+
444
+ if ($totalOrdered > $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "gt") {
445
+ $tempTotal[] = $result[$count];
446
+ }
447
+
448
+ if ($totalOrdered < $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "lt" ) {
449
+ $tempTotal[] = $result[$count];
450
+ }
451
+
452
+ $count++;
453
+
454
+ //unsetto la variabile
455
+ unset($orders); //->unsetData();
456
+ }
457
+
458
+ $customersFiltered = array_intersect($tempTotal, $customersFiltered);
459
+ }
460
+ //FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
461
+
462
+
463
+ //FILTRO 9 DATA ACQUISTATO
464
+ $count = 0;
465
+ $result = array();
466
+ $tempOrderedDateYes = array();
467
+ $tempOrderedDateNo = array();
468
+
469
+ if ($request->getRequest()->getParam('mailupOrderStartDate') || $request->getRequest()->getParam('mailupOrderEndDate') ) {
470
+ foreach ($customersFiltered as $customer) {
471
+ $result[] = $customer;
472
+
473
+ //filtro gli ordini in base al customer id
474
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
475
+
476
+ $orderedDate = 0;
477
+
478
+ foreach ($orders->getData() as $order) {
479
+ if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
480
+ $createdAt = $order['created_at'];
481
+ $createdAt = new DateTime($createdAt, $TIMEZONE_UTC);
482
+ $createdAt->setTimezone($TIMEZONE_STORE);
483
+ $createdAt = (string)$createdAt->format("Y-m-d H:i:s");
484
+ $filterStart = '';
485
+ $filterEnd = '';
486
+
487
+ if ($request->getRequest()->getParam('mailupOrderStartDate')) {
488
+ $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupOrderStartDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
489
+ $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
490
+ $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
491
+ $filterStart = "{$date['year']}-{$date['month']}-{$date['day']} 00:00:00";
492
+ }
493
+ if ($request->getRequest()->getParam('mailupOrderEndDate')) {
494
+ $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupOrderEndDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
495
+ $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
496
+ $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
497
+ $filterEnd = "{$date['year']}-{$date['month']}-{$date['day']} 23:59:59";
498
+ }
499
+
500
+ if ($filterStart and $filterEnd) {
501
+ //compreso tra start e end date
502
+ if ($createdAt >= $filterStart and $createdAt <= $filterEnd) {
503
+ $orderedDate = 1;
504
+ }
505
+ } elseif ($filterStart) {
506
+ // >= di start date
507
+ if ($createdAt >= $filterStart) {
508
+ $orderedDate = 1;
509
+ }
510
+ } else {
511
+ // <= di end date
512
+ if ($createdAt <= $filterEnd) {
513
+ $orderedDate = 1;
514
+ }
515
+ }
516
+
517
+ //unsetto la variabile
518
+ unset($orders); //->unsetData();
519
+ }
520
+
521
+ if ($orderedDate == 1) {
522
+ $tempOrderedDateYes[] = $result[$count];
523
+ } else {
524
+ $tempOrderedDateNo[] = $result[$count];
525
+ }
526
+
527
+ $count++;
528
+ }
529
+
530
+ if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes') {
531
+ $customersFiltered = array_intersect($tempOrderedDateYes, $customersFiltered);
532
+ } else {
533
+ $customersFiltered = array_intersect($tempOrderedDateNo, $customersFiltered);
534
+ }
535
+ }
536
+ //FINE FILTRO 9 DATA ACQUISTATO: testato ok
537
+
538
+ } else {
539
+ //GESTISCO LE MODIFICHE MANUALI
540
+ $count = 0;
541
+ $result = array();
542
+ $tempMod = array();
543
+
544
+ $emails = explode("\n", $request->getRequest()->getParam('mailupCustomerFilteredMod'));
545
+
546
+ foreach ($emails as $email) {
547
+ $email = trim($email);
548
+
549
+ if (strstr($email, '@') !== false) {
550
+ $customerModCollection = Mage::getModel('customer/customer')
551
+ ->getCollection()
552
+ ->addAttributeToSelect('email')
553
+ ->addAttributeToFilter('email', $email);
554
+
555
+ $added = 0;
556
+
557
+ foreach ($customerModCollection as $customerMod) {
558
+ $tempMod[] = $customerMod->toArray();
559
+ $added = 1;
560
+ }
561
+
562
+ if ($added == 0) {
563
+ $tempMod[] = array('entity_id'=>0, 'firstname'=>'', 'lastname'=>'', 'email'=>$email);
564
+ }
565
+ }
566
+ }
567
+
568
+ //$customersFiltered = array_intersect($tempMod, $customersFiltered);
569
+ $customersFiltered = $tempMod;
570
+ }
571
+ //FINE GESTISCO LE MODIFICHE MANUALI
572
+
573
+ return $customersFiltered;
574
+ }
575
+
576
+
577
+ public function getFilterHints() {
578
+ $filter_hints = array();
579
+ try {
580
+ // fetch write database connection that is used in Mage_Core module
581
+ $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
582
+
583
+ // now $write is an instance of Zend_Db_Adapter_Abstract
584
+ $result = $connectionRead->query("select * from mailup_filter_hints");
585
+
586
+ while ($row = $result->fetch()) {
587
+ array_push($filter_hints, array('filter_name' => $row['filter_name'], 'hints' => $row['hints']));
588
+ }
589
+ } catch (Exception $e) {
590
+ Mage::log('Exception: '.$e->getMessage(), 0);
591
+ die($e);
592
+ }
593
+
594
+ return $filter_hints;
595
+ }
596
+
597
+ public function saveFilterHint($filter_name, $post) {
598
+ try {
599
+ $hints = '';
600
+ foreach ($post as $k => $v) {
601
+ if ($v!='' && $k!='form_key') {
602
+ if ($hints!='') {
603
+ $hints .= '|';
604
+ }
605
+ $hints .= $k.'='.$v;
606
+ }
607
+ }
608
+ //(e.g. $hints = 'mailupCustomers=2|mailupSubscribed=1';)
609
+
610
+ $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
611
+
612
+ $connectionWrite->query("INSERT INTO mailup_filter_hints (filter_name, hints) VALUES ('".$filter_name."', '".$hints."')");
613
+ } catch (Exception $e) {
614
+ Mage::log('Exception: '.$e->getMessage(), 0);
615
+ die($e);
616
+ }
617
+ }
618
+
619
+ public function deleteFilterHint($filter_name) {
620
+ try {
621
+ $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
622
+
623
+ $connectionWrite->query("DELETE FROM mailup_filter_hints WHERE filter_name LIKE '".$filter_name."'");
624
+ } catch (Exception $e) {
625
+ Mage::log('Exception: '.$e->getMessage(), 0);
626
+ die($e);
627
+ }
628
+ }
629
+
630
+ public function getFieldsMapping() {
631
+ $fieldsMappings = array();
632
+ try {
633
+ $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
634
+ return $connectionRead->fetchPairs("select magento_field_name, mailup_field_id from mailup_fields_mapping");
635
+ } catch (Exception $e) {
636
+ Mage::log('Exception: '.$e->getMessage(), 0);
637
+ die($e);
638
+ }
639
+
640
+ return $fieldsMappings;
641
+ }
642
+
643
+ public function saveFieldMapping($post) {
644
+ try {
645
+ $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
646
+ $connectionWrite->query("DELETE FROM mailup_fields_mapping");
647
+ foreach ($post as $k => $v) {
648
+ if (strlen($v) == 0) continue;
649
+ $connectionWrite->insert("mailup_fields_mapping", array(
650
+ "magento_field_name" => $k,
651
+ "mailup_field_id" => $v
652
+ ));
653
+ }
654
+ } catch (Exception $e) {
655
+ Mage::log('Exception: '.$e->getMessage(), 0);
656
+ die($e);
657
+ }
658
+ }
659
+ }
app/code/local/SevenLike/MailUp/Model/Mysql14/MailUp.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Mysql14/MailUp/Collection.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Observer.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  class SevenLike_MailUp_Model_Observer
4
  {
5
  const CRON_STRING_PATH = 'crontab/jobs/sevenlike_mailup/schedule/cron_expr';
@@ -58,49 +60,53 @@ class SevenLike_MailUp_Model_Observer
58
  if (isset($GLOBALS["__sl_mailup_leggi_utente"])) return $this;
59
  $GLOBALS["__sl_mailup_leggi_utente"] = true;
60
 
61
- $WSDLUrl = 'http://services.mailupnet.it/MailupReport.asmx?WSDL';
62
- $user = Mage::getStoreConfig('newsletter/mailup/username_ws');
63
- $password = Mage::getStoreConfig('newsletter/mailup/password_ws');
64
- $headers = array('User' => $user, 'Password' => $password);
65
- $header = new SOAPHeader("http://ws.mailupnet.it/", 'Authentication', $headers);
66
- $soapclient = new SoapClient($WSDLUrl, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 10));
67
- $soapclient->__setSoapHeaders($header);
68
-
69
- $loginData = array ('user' => Mage::getStoreConfig('newsletter/mailup/username_ws'),
70
- 'pwd' => Mage::getStoreConfig('newsletter/mailup/password_ws'),
71
- 'consoleId' => substr(Mage::getStoreConfig('newsletter/mailup/username_ws'), 1));
72
- $result = get_object_vars($soapclient->LoginFromId($loginData));
73
- $xml = simplexml_load_string($result['LoginFromIdResult']);
74
- $errorCode = (string)$xml->errorCode;
75
- $errorDescription = (string)$xml->errorDescription;
76
- $accessKey = (string)$xml->accessKey;
77
-
78
- $result = $soapclient->ReportByUser(array(
79
- "accessKey" => $accessKey,
80
- "email" => $model->getEmail(),
81
- "listID" => Mage::getStoreConfig('newsletter/mailup/list'),
82
- "messageID" => 0
83
- ));
84
- $result = get_object_vars($result);
85
- $xml = simplexml_load_string($result['ReportByUserResult']);
86
-
87
- $stato_registrazione = (string)$xml->Canali->Email;
88
- Mage::log("stato registrazione: " . $stato_registrazione);
89
- if ($stato_registrazione) {
90
- switch (strtolower($stato_registrazione)) {
91
- case "iscritto":
92
- Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
93
- $model->setIsSubscribed(1);
94
- $model->save();
95
- break;
96
- case "in attesa":
97
- Mage::getSingleton('core/session')->addNotice(Mage::helper("mailup")->__("Your subscription is waiting for confirmation"));
98
- break;
99
- default:
100
- Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)->save();
101
- $model->setIsSubscribed(0);
102
- $model->save();
 
 
103
  }
 
 
104
  }
105
 
106
  return $this;
@@ -112,17 +118,17 @@ class SevenLike_MailUp_Model_Observer
112
  $GLOBALS["__sl_mailup_invia_utente"] = true;
113
 
114
  $model = $observer->getEvent()->getDataObject();
115
- Mage::log($model->getData());
116
  $status = Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->getStatus();
117
 
118
  $module = Mage::app()->getRequest()->getModuleName();
119
  $controller = Mage::app()->getRequest()->getControllerName();
120
  $action = Mage::app()->getRequest()->getActionName();
121
-
122
- Mage::log("mailup: invia utente");
123
 
124
  if (($module == "customer" and $controller == "account" and $action == "createpost") or ($module == "checkout" and $controller == "onepage" and $action == "saveOrder")) {
125
- Mage::log("SONO in registrazione, LEGGO PRIMA mailup!");
126
  //sono in registrazione, controllo lo stato di subscribe magento, se non risulto iscritto leggo lo status da mailup e se sono iscritto lo salvo su magento prima di continuare
127
  if (!$status) {
128
  //leggo l'utente da mailup
@@ -137,41 +143,44 @@ class SevenLike_MailUp_Model_Observer
137
  $console = Mage::getStoreConfig('newsletter/mailup/url_console');
138
  $listId = Mage::getStoreConfig('newsletter/mailup/list');
139
 
140
- if(!class_exists("MailUpWsImport")) $MailUpWsImport = Mage::getModel('mailup/ws');
141
- $wsImport = new MailUpWsImport();
142
- $xmlString = $wsImport->GetNlList();
143
- if (!$xmlString) return $this;
144
-
145
- $xmlString = html_entity_decode($xmlString);
146
- $startLists = strpos($xmlString, '<Lists>');
147
- $endPos = strpos($xmlString, '</Lists>');
148
- $endLists = $endPos + strlen('</Lists>') - $startLists;
149
- $xmlLists = substr($xmlString, $startLists, $endLists);
150
- $xmlLists = str_replace("&", "&amp;", $xmlLists);
151
- $xml = simplexml_load_string($xmlLists);
152
-
153
- foreach ($xml->List as $list) {
154
- if ($list['idList'] == $listId) {
155
- $listGUID = $list["listGUID"];
156
- break;
 
157
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
- Mage::log("STATO ISCRIZIONE: $status");
160
- if ($status == 1) {
161
- $ws = "http://{$console}/frontend/Xmlsubscribe.aspx";
162
- } else {
163
- $ws = "http://{$console}/frontend/Xmlunsubscribe.aspx";
164
- }
165
-
166
- $ws .= "?ListGuid=" . rawurlencode($listGUID);
167
- $ws .= "&List=" . rawurlencode($listId);
168
- $ws .= "&Email=" . rawurlencode($model->getEmail());
169
-
170
- try {
171
- Mage::log("mailup invio utente $ws");
172
- $result = @file_get_contents($ws);
173
- Mage::log("mailup risultato invio $result");
174
- } catch (Exception $e) {}
175
 
176
  return $this;
177
  }
@@ -194,7 +203,6 @@ class SevenLike_MailUp_Model_Observer
194
  return;
195
  }
196
 
197
- require_once dirname(__FILE__) . "/Ws.php";
198
  $wsimport = new MailUpWsImport();
199
  $mapping = $wsimport->getFieldsMapping();
200
  if (empty($mapping)) {
@@ -206,4 +214,51 @@ class SevenLike_MailUp_Model_Observer
206
  return;
207
  }
208
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/Wssend.php";
5
  class SevenLike_MailUp_Model_Observer
6
  {
7
  const CRON_STRING_PATH = 'crontab/jobs/sevenlike_mailup/schedule/cron_expr';
60
  if (isset($GLOBALS["__sl_mailup_leggi_utente"])) return $this;
61
  $GLOBALS["__sl_mailup_leggi_utente"] = true;
62
 
63
+ try {
64
+ $WSDLUrl = 'http://services.mailupnet.it/MailupReport.asmx?WSDL';
65
+ $user = Mage::getStoreConfig('newsletter/mailup/username_ws');
66
+ $password = Mage::getStoreConfig('newsletter/mailup/password_ws');
67
+ $headers = array('User' => $user, 'Password' => $password);
68
+ $header = new SOAPHeader("http://ws.mailupnet.it/", 'Authentication', $headers);
69
+ $soapclient = new SoapClient($WSDLUrl, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 10));
70
+ $soapclient->__setSoapHeaders($header);
71
+
72
+ $loginData = array ('user' => Mage::getStoreConfig('newsletter/mailup/username_ws'),
73
+ 'pwd' => Mage::getStoreConfig('newsletter/mailup/password_ws'),
74
+ 'consoleId' => substr(Mage::getStoreConfig('newsletter/mailup/username_ws'), 1));
75
+ $result = get_object_vars($soapclient->LoginFromId($loginData));
76
+ $xml = simplexml_load_string($result['LoginFromIdResult']);
77
+ $errorCode = (string)$xml->errorCode;
78
+ $errorDescription = (string)$xml->errorDescription;
79
+ $accessKey = (string)$xml->accessKey;
80
+
81
+ $result = $soapclient->ReportByUser(array(
82
+ "accessKey" => $accessKey,
83
+ "email" => $model->getEmail(),
84
+ "listID" => Mage::getStoreConfig('newsletter/mailup/list'),
85
+ "messageID" => 0
86
+ ));
87
+ $result = get_object_vars($result);
88
+ $xml = simplexml_load_string($result['ReportByUserResult']);
89
+
90
+ $stato_registrazione = (string)$xml->Canali->Email;
91
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("stato registrazione: " . $stato_registrazione);
92
+ if ($stato_registrazione) {
93
+ switch (strtolower($stato_registrazione)) {
94
+ case "iscritto":
95
+ Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
96
+ $model->setIsSubscribed(1);
97
+ $model->save();
98
+ break;
99
+ case "in attesa":
100
+ Mage::getSingleton('core/session')->addNotice(Mage::helper("mailup")->__("Your subscription is waiting for confirmation"));
101
+ break;
102
+ default:
103
+ Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)->save();
104
+ $model->setIsSubscribed(0);
105
+ $model->save();
106
+ }
107
  }
108
+ } catch (Exception $e) {
109
+ Mage::logException($e);
110
  }
111
 
112
  return $this;
118
  $GLOBALS["__sl_mailup_invia_utente"] = true;
119
 
120
  $model = $observer->getEvent()->getDataObject();
121
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($model->getData());
122
  $status = Mage::getModel('newsletter/subscriber')->loadByEmail($model->getEmail())->getStatus();
123
 
124
  $module = Mage::app()->getRequest()->getModuleName();
125
  $controller = Mage::app()->getRequest()->getControllerName();
126
  $action = Mage::app()->getRequest()->getActionName();
127
+
128
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup: invia utente");
129
 
130
  if (($module == "customer" and $controller == "account" and $action == "createpost") or ($module == "checkout" and $controller == "onepage" and $action == "saveOrder")) {
131
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("SONO in registrazione, LEGGO PRIMA mailup!");
132
  //sono in registrazione, controllo lo stato di subscribe magento, se non risulto iscritto leggo lo status da mailup e se sono iscritto lo salvo su magento prima di continuare
133
  if (!$status) {
134
  //leggo l'utente da mailup
143
  $console = Mage::getStoreConfig('newsletter/mailup/url_console');
144
  $listId = Mage::getStoreConfig('newsletter/mailup/list');
145
 
146
+ try {
147
+ $wsImport = new MailUpWsImport();
148
+ $xmlString = $wsImport->GetNlList();
149
+ if (!$xmlString) return $this;
150
+
151
+ $xmlString = html_entity_decode($xmlString);
152
+ $startLists = strpos($xmlString, '<Lists>');
153
+ $endPos = strpos($xmlString, '</Lists>');
154
+ $endLists = $endPos + strlen('</Lists>') - $startLists;
155
+ $xmlLists = substr($xmlString, $startLists, $endLists);
156
+ $xmlLists = str_replace("&", "&amp;", $xmlLists);
157
+ $xml = simplexml_load_string($xmlLists);
158
+
159
+ foreach ($xml->List as $list) {
160
+ if ($list['idList'] == $listId) {
161
+ $listGUID = $list["listGUID"];
162
+ break;
163
+ }
164
  }
165
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("STATO ISCRIZIONE: $status");
166
+ if ($status == 1) {
167
+ $ws = "http://{$console}/frontend/Xmlsubscribe.aspx";
168
+ } else {
169
+ $ws = "http://{$console}/frontend/Xmlunsubscribe.aspx";
170
+ }
171
+
172
+ $ws .= "?ListGuid=" . rawurlencode($listGUID);
173
+ $ws .= "&List=" . rawurlencode($listId);
174
+ $ws .= "&Email=" . rawurlencode($model->getEmail());
175
+
176
+ try {
177
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup invio utente $ws");
178
+ $result = @file_get_contents($ws);
179
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log("mailup risultato invio $result");
180
+ } catch (Exception $e) {}
181
+ } catch (Exception $e) {
182
+ Mage::logException($e);
183
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
  return $this;
186
  }
203
  return;
204
  }
205
 
 
206
  $wsimport = new MailUpWsImport();
207
  $mapping = $wsimport->getFieldsMapping();
208
  if (empty($mapping)) {
214
  return;
215
  }
216
  }
217
+
218
+ public function subscribeDuringCheckout()
219
+ {
220
+ if (@$_REQUEST["mailup_subscribe2"]) {
221
+ $order_id = Mage::getSingleton("checkout/session")->getLastRealOrderId();
222
+ $order = Mage::getModel("sales/order")->loadByIncrementId($order_id);
223
+ try {
224
+ Mage::getModel("newsletter/subscriber")->subscribe($order->getCustomerEmail());
225
+ } catch (Exception $e) {}
226
+ }
227
+ }
228
+
229
+ public function prepareOrderForDataSync($observer)
230
+ {
231
+ $order = $observer->getEvent()->getOrder();
232
+ $customer_id = $order->getCustomerId();
233
+ if ($customer_id) self::setCustomerForDataSync($customer_id);
234
+ }
235
+
236
+ public function prepareCustomerForDataSync($observer)
237
+ {
238
+ $customer = $observer->getEvent()->getCustomer();
239
+ $customer_id = $customer->getId();
240
+ if ($customer_id) self::setCustomerForDataSync($customer_id);
241
+ }
242
+
243
+ private static function setCustomerForDataSync($customer_id)
244
+ {
245
+ if (!$customer_id) return false;
246
+
247
+ $db_write = Mage::getSingleton('core/resource')->getConnection('core_write');
248
+ try {
249
+ $db_write->insert("mailup_sync", array(
250
+ "customer_id" => $customer_id,
251
+ "entity" => "customer",
252
+ "job_id" => 0,
253
+ "needs_sync" => true,
254
+ "last_sync" => null
255
+ ));
256
+ } catch (Exception $e) {
257
+ $db_write->update("mailup_sync", array(
258
+ "needs_sync" => true
259
+ ), "customer_id=$customer_id AND entity='customer' AND job_id=0");
260
+ }
261
+
262
+ return true;
263
+ }
264
  }
app/code/local/SevenLike/MailUp/Model/Webserviceusernamevalidator.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/Model/Ws.php CHANGED
@@ -1,648 +1,3 @@
1
  <?php
2
 
3
- class MailUpWsImport
4
- {
5
- protected $ns = "http://ws.mailupnet.it/";
6
-
7
- //protected $WSDLUrl = "http://g4a0.s03.it/services/WSMailUpImport.asmx?WSDL";
8
- //protected $headers = array("User" => "a7410", "Password" => "GA6VAN0W");
9
- protected $rCode;
10
- private $soapClient;
11
- private $xmlResponse;
12
- protected $domResult;
13
-
14
- function __construct() {
15
- $urlConsole = Mage::getStoreConfig('newsletter/mailup/url_console');
16
- $WSDLUrl = 'http://'. $urlConsole .'/services/WSMailUpImport.asmx?WSDL';
17
- $user = Mage::getStoreConfig('newsletter/mailup/username_ws');
18
- $password = Mage::getStoreConfig('newsletter/mailup/password_ws');
19
- $headers = array('User' => $user, 'Password' => $password);
20
- $this->header = new SOAPHeader($this->ns, 'Authentication', $headers);
21
-
22
- try {
23
- $this->soapClient = new SoapClient($WSDLUrl, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 10));
24
- $this->soapClient->__setSoapHeaders($this->header);
25
- } catch (Exception $e) {
26
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper("mailup")->__("Unable to connect to MailUp console"));
27
- }
28
- }
29
-
30
- function __destruct() {
31
- unset($this->soapClient);
32
- }
33
-
34
- public function getFunctions() {
35
- print_r($this->soapClient->__getFunctions());
36
- }
37
-
38
- public function creaGruppo($newGroup) {
39
- if (!is_object($this->soapClient)) return false;
40
- try {
41
- $this->soapClient->CreateGroup($newGroup);
42
- $this-> printLastRequest();
43
- $this->printLastResponse();
44
- return $this->readReturnCode('CreateGroup', 'ReturnCode');
45
- } catch (SoapFault $soapFault) {
46
- Mage::log('SOAP error', 0);
47
- Mage::log($soapFault, 0);
48
- }
49
- }
50
-
51
- public function GetNlList() {
52
- if (!is_object($this->soapClient)) return false;
53
- try {
54
- $this->soapClient->GetNlLists();
55
- $this->printLastRequest();
56
- $this->printLastResponse();
57
- $result = $this->soapClient->__getLastResponse();
58
- Mage::log($result, 0);
59
- return $result;
60
- } catch (SoapFault $soapFault) {
61
- Mage::log('SOAP error', 0);
62
- Mage::log($soapFault, 0);
63
- }
64
- }
65
-
66
- public function newImportProcess($importProcessData) {
67
- if (!is_object($this->soapClient)) return false;
68
- try {
69
- $this->soapClient->NewImportProcess($importProcessData);
70
- return $this->readReturnCode('NewImportProcess', 'ReturnCode');
71
- } catch (SoapFault $soapFault) {
72
- Mage::log('SOAP error', 0);
73
- Mage::log($soapFault, 0);
74
- }
75
- }
76
-
77
- public function startProcess($processData) {
78
- if (!is_object($this->soapClient)) return false;
79
- try {
80
- $this->soapClient->StartProcess($processData);
81
- //echo "<br />ReturnCode: ". $this->readReturnCode("StartProcess","ReturnCode")."<br />";
82
- } catch (SoapFault $soapFault) {
83
- Mage::log('SOAP error', 0);
84
- Mage::log($soapFault, 0);
85
- }
86
- }
87
-
88
- public function getProcessDetail($processData) {
89
- if (!is_object($this->soapClient)) return false;
90
- try {
91
- Mage::log($this->soapClient->GetProcessDetails($processData), 0);
92
- //echo "<br />ReturnCode: ". $this->readReturnCode("GetProcessDetails","ReturnCode")."<br />";
93
- //echo "<br />IsRunning: ". $this->readReturnCode("GetProcessDetails","IsRunning")."<br />";
94
- //echo "<br />StartDate: ". $this->readReturnCode("GetProcessDetails","StartDate")."<br />";
95
- } catch (SoapFault $soapFault) {
96
- Mage::log('SOAP error', 0);
97
- Mage::log($soapFault, 0);
98
- }
99
- }
100
-
101
- public function startImportProcesses($processData) {
102
- if (!is_object($this->soapClient)) return false;
103
- try {
104
- $this->soapClient->StartImportProcesses($processData);
105
- $this-> printLastRequest();
106
- $this->printLastResponse();
107
- //echo "<br />ReturnCode: ". $this->readReturnCode("StartImportProcesses","ReturnCode")."<br />";
108
- } catch (SoapFault $soapFault) {
109
- Mage::log('SOAP error', 0);
110
- Mage::log($soapFault, 0);
111
- }
112
- }
113
-
114
- private function readReturnCode($func, $param) {
115
- if (!is_object($this->soapClient)) return false;
116
-
117
- static $func_in = ''; //static variable to test xmlResponse update
118
- if ($func_in != $func) {//(!isset($this->xmlResponse))
119
- $func_in = $func;
120
- //prendi l'XML di ritorno se non l'ho già preso
121
- $this->xmlResponse = $this->soapClient->__getLastResponse();
122
-
123
- $dom = new DomDocument();
124
- $dom->loadXML($this->xmlResponse) or die('File XML non valido!');
125
- $xmlResult = $dom->getElementsByTagName($func.'Result');
126
-
127
- $this->domResult = new DomDocument();
128
- $this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die('File XML non valido!');
129
- }
130
- $rCode = $this->domResult->getElementsByTagName($param);
131
- return $rCode->item(0)->nodeValue;
132
- }
133
-
134
- private function printLastRequest() {
135
- //echo "<br>Request :<br>". htmlentities($this->soapClient->__getLastRequest()). "<br>";
136
- }
137
-
138
- private function printLastResponse() {
139
- //echo "<br />XMLResponse: " . $this->soapClient->__getLastResponse() . "<br />";
140
- }
141
-
142
- public function getCustomersFiltered($request) {
143
- $TIMEZONE_STORE = new DateTimeZone(Mage::getStoreConfig("general/locale/timezone"));
144
- $TIMEZONE_UTC = new DateTimeZone("UTC");
145
-
146
- //inizializzo l'array dei clienti
147
- $customersFiltered = array();
148
-
149
- if (!$request->getRequest()->getParam('mailupCustomerFilteredMod')) {
150
- //ottengo la collection con tutti i clienti
151
- $customerCollection = Mage::getModel('customer/customer')
152
- ->getCollection()
153
- ->addAttributeToSelect('entity_id')
154
- ->addAttributeToSelect('group_id')
155
- ->addAttributeToSelect('created_at');
156
-
157
- //inizializzo l'array dei clienti filtrati con tutti i clienti
158
- foreach ($customerCollection as $customer) {
159
- $customersFiltered[] = $customer->toArray();
160
- }
161
-
162
- //se richiesto, seleziono solo quelli iscritti alla newsletter di Magento
163
- if ($request->getRequest()->getParam('mailupSubscribed') > 0) {
164
- $tempSubscribed = array();
165
- foreach ($customersFiltered as $customer) {
166
- $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
167
- if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customerItem)->isSubscribed()) {
168
- $tempSubscribed[] = $customer;
169
- }
170
- }
171
- $customersFiltered = array_intersect($tempSubscribed, $customersFiltered);
172
- }
173
-
174
- //FILTRO 1 ACQUISTATO: in base al fatto se ha effettuato o meno acquisti: 0 = tutti, 1 = chi ha acquistato, 2 = chi non ha mai acquistato
175
- $count = 0;
176
- $result = array();
177
- $tempPurchased = array();
178
- $tempNoPurchased = array();
179
-
180
- if ($request->getRequest()->getParam('mailupCustomers') > 0) {
181
- foreach ($customersFiltered as $customer) {
182
- $result[] = $customer;
183
-
184
- //filtro gli ordini in base al customer id
185
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
186
-
187
- //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
188
- if ($orders->getData()) {
189
- $tempPurchased[] = $result[$count];
190
- } else {
191
- $tempNoPurchased[] = $result[$count];
192
- }
193
-
194
- //unsetto la variabile
195
- unset($orders); //->unsetData();
196
-
197
- $count++;
198
- }
199
-
200
- if ($request->getRequest()->getParam('mailupCustomers') == 1) {
201
- $customersFiltered = array_intersect($tempPurchased, $customersFiltered);
202
- } elseif ($request->getRequest()->getParam('mailupCustomers') == 2) {
203
- $customersFiltered = array_intersect($tempNoPurchased, $customersFiltered);
204
- }
205
- }
206
- //FINE FILTRO 1 ACQUISTATO: testato OK
207
-
208
- //FILTRO 2 PRODOTTO ACQUISTATO: in base al fatto se ha acquistato un determinato prodotto
209
- $count = 0;
210
- $result = array();
211
- $tempProduct = array();
212
-
213
- if ($request->getRequest()->getParam('mailupProductSku')) {
214
- foreach ($customersFiltered as $customer) {
215
- $result[] = $customer;
216
-
217
- //filtro gli ordini in base al customer id
218
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
219
- $purchasedProduct = 0;
220
-
221
- $mailupProductId = Mage::getModel('catalog/product')->getIdBySku($request->getRequest()->getParam('mailupProductSku'));
222
-
223
- foreach ($orders->getData() as $order) {
224
- if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
225
- $orderIncrementId = $order['increment_id'];
226
-
227
- //carico i dati di ogni ordine
228
- $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
229
- $items = $orderData->getAllItems();
230
- $ids = array();
231
- foreach ($items as $itemId => $item) {
232
- $ids[] = $item->getProductId();
233
- }
234
-
235
- if (in_array($mailupProductId, $ids)) {
236
- $purchasedProduct = 1;
237
- }
238
- }
239
-
240
- //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
241
- if ($purchasedProduct == 1) {
242
- $tempProduct[] = $result[$count];
243
- }
244
-
245
- //unsetto la variabile
246
- unset($orders); //->unsetData();
247
-
248
- $count++;
249
- }
250
-
251
- $customersFiltered = array_intersect($tempProduct, $customersFiltered);
252
- }
253
- //FINE FILTRO 2 PRODOTTO ACQUISTATO: testato OK
254
-
255
-
256
- //FILTRO 3 ACQUISTATO IN CATEGORIA: in base al fatto se ha acquistato almeno un prodotto in una determinata categoria
257
- $count = 0;
258
- $result = array();
259
- $tempCategory = array();
260
-
261
- if ($request->getRequest()->getParam('mailupCategoryId') > 0) {
262
- foreach ($customersFiltered as $customer) {
263
- $result[] = $customer;
264
-
265
- //filtro gli ordini in base al customer id
266
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
267
- $purchasedCategory = 0;
268
-
269
- foreach ($orders->getData() as $order) {
270
- if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
271
- $orderIncrementId = $order['increment_id'];
272
-
273
- //carico i dati di ogni ordine
274
- $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
275
- $items = $orderData->getAllItems();
276
- $cat_ids = array();
277
- foreach ($items as $product) {
278
- if (in_array($request->getRequest()->getParam('mailupCategoryId'), Mage::getResourceSingleton('catalog/product')->getCategoryIds($product))) {
279
- $tempCategory[] = $result[$count];
280
- break 2;
281
- }
282
- }
283
- }
284
-
285
- unset($orders);
286
- $count++;
287
- }
288
-
289
- $customersFiltered = array_intersect($tempCategory, $customersFiltered);
290
- }
291
- //FINE FILTRO 3 ACQUISTATO IN CATEGORIA: testato ok
292
-
293
-
294
- //FILTRO 4 GRUPPO DI CLIENTI
295
- $count = 0;
296
- $result = array();
297
- $tempGroup = array();
298
-
299
- if ($request->getRequest()->getParam('mailupCustomerGroupId') > 0) {
300
- foreach ($customersFiltered as $customer) {
301
- if ($customer['group_id'] == $request->getRequest()->getParam('mailupCustomerGroupId')) {
302
- $tempGroup[] = $customer;
303
- }
304
- }
305
-
306
- $customersFiltered = array_intersect($tempGroup, $customersFiltered);
307
- }
308
- //FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
309
-
310
-
311
- //FILTRO 5 PAESE DI PROVENIENZA
312
- $count = 0;
313
- $result = array();
314
- $tempCountry = array();
315
-
316
- if ($request->getRequest()->getParam('mailupCountry') != '0') {
317
- foreach ($customersFiltered as $customer) {
318
- //ottengo la nazione del primary billing address
319
- $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
320
- $customerAddress = $customerItem->getPrimaryBillingAddress();
321
- $countryId = $customerAddress['country_id'];
322
-
323
- if ($countryId == $request->getRequest()->getParam('mailupCountry')) {
324
- $tempCountry[] = $customer;
325
- }
326
-
327
- //unsetto la variabile
328
- unset($customerItem); //->unsetData();
329
- }
330
-
331
- $customersFiltered = array_intersect($tempCountry, $customersFiltered);
332
- }
333
- //FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
334
-
335
-
336
- //FILTRO 6 CAP DI PROVENIENZA
337
- $count = 0;
338
- $result = array();
339
- $tempPostCode = array();
340
-
341
- if ($request->getRequest()->getParam('mailupPostCode')) {
342
- foreach ($customersFiltered as $customer) {
343
- //ottengo la nazione del primary billing address
344
- $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
345
- $customerAddress = $customerItem->getPrimaryBillingAddress();
346
- $postCode = $customerAddress['postcode'];
347
-
348
- if ($postCode == $request->getRequest()->getParam('mailupPostCode')) {
349
- $tempPostCode[] = $customer;
350
- }
351
-
352
- //unsetto la variabile
353
- unset($customerItem); //->unsetData();
354
- }
355
-
356
- $customersFiltered = array_intersect($tempPostCode, $customersFiltered);
357
- }
358
- //FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
359
-
360
-
361
- //FILTRO 7 DATA CREAZIONE CLIENTE
362
- $count = 0;
363
- $result = array();
364
- $tempDate = array();
365
-
366
- if ($request->getRequest()->getParam('mailupCustomerStartDate') || $request->getRequest()->getParam('mailupCustomerEndDate') ) {
367
- foreach ($customersFiltered as $customer) {
368
- $createdAt = $customer['created_at'];
369
- $createdAt = new DateTime($createdAt, $TIMEZONE_UTC);
370
- $createdAt->setTimezone($TIMEZONE_STORE);
371
- $createdAt = (string)$createdAt->format("Y-m-d H:i:s");
372
- $filterStart = '';
373
- $filterEnd = '';
374
-
375
- if ($request->getRequest()->getParam('mailupCustomerStartDate')) {
376
- $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupCustomerStartDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
377
- $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
378
- $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
379
- $filterStart = "{$date['year']}-{$date['month']}-{$date['day']} 00:00:00";
380
- }
381
- if ($request->getRequest()->getParam('mailupCustomerEndDate')) {
382
- $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupCustomerEndDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
383
- $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
384
- $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
385
- $filterEnd = "{$date['year']}-{$date['month']}-{$date['day']} 23:59:59";
386
- }
387
- if ($filterStart && $filterEnd) {
388
- //compreso tra start e end date
389
- if ($createdAt >= $filterStart and $createdAt <= $filterEnd) {
390
- $tempDate[] = $customer;
391
- }
392
- } elseif ($filterStart) {
393
- // >= di start date
394
- if ($createdAt >= $filterStart) {
395
- $tempDate[] = $customer;
396
- }
397
- } else {
398
- // <= di end date
399
- if ($createdAt <= $filterEnd) {
400
- $tempDate[] = $customer;
401
- }
402
- }
403
- }
404
-
405
- $customersFiltered = array_intersect($tempDate, $customersFiltered);
406
- }
407
- //FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
408
-
409
-
410
- //FILTRO 8 TOTALE ACQUISTATO
411
- $count = 0;
412
- $result = array();
413
- $tempTotal = array();
414
-
415
- if ($request->getRequest()->getParam('mailupTotalAmountValue') > 0) {
416
- foreach ($customersFiltered as $customer) {
417
- $result[] = $customer;
418
-
419
- //filtro gli ordini in base al customer id
420
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
421
-
422
- $totalOrdered = 0;
423
-
424
- foreach ($orders->getData() as $order) {
425
- if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
426
- $totalOrdered += $order['subtotal'];
427
- }
428
-
429
- if ($totalOrdered == $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "eq") {
430
- $tempTotal[] = $result[$count];
431
- }
432
-
433
- if ($totalOrdered > $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "gt") {
434
- $tempTotal[] = $result[$count];
435
- }
436
-
437
- if ($totalOrdered < $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "lt" ) {
438
- $tempTotal[] = $result[$count];
439
- }
440
-
441
- $count++;
442
-
443
- //unsetto la variabile
444
- unset($orders); //->unsetData();
445
- }
446
-
447
- $customersFiltered = array_intersect($tempTotal, $customersFiltered);
448
- }
449
- //FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
450
-
451
-
452
- //FILTRO 9 DATA ACQUISTATO
453
- $count = 0;
454
- $result = array();
455
- $tempOrderedDateYes = array();
456
- $tempOrderedDateNo = array();
457
-
458
- if ($request->getRequest()->getParam('mailupOrderStartDate') || $request->getRequest()->getParam('mailupOrderEndDate') ) {
459
- foreach ($customersFiltered as $customer) {
460
- $result[] = $customer;
461
-
462
- //filtro gli ordini in base al customer id
463
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
464
-
465
- $orderedDate = 0;
466
-
467
- foreach ($orders->getData() as $order) {
468
- if (!in_array($order["status"], array("closed", "complete", "processing"))) continue;
469
- $createdAt = $order['created_at'];
470
- $createdAt = new DateTime($createdAt, $TIMEZONE_UTC);
471
- $createdAt->setTimezone($TIMEZONE_STORE);
472
- $createdAt = (string)$createdAt->format("Y-m-d H:i:s");
473
- $filterStart = '';
474
- $filterEnd = '';
475
-
476
- if ($request->getRequest()->getParam('mailupOrderStartDate')) {
477
- $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupOrderStartDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
478
- $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
479
- $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
480
- $filterStart = "{$date['year']}-{$date['month']}-{$date['day']} 00:00:00";
481
- }
482
- if ($request->getRequest()->getParam('mailupOrderEndDate')) {
483
- $date = Zend_Locale_Format::getDate($request->getRequest()->getParam('mailupOrderEndDate'), array('locale'=>Mage::app()->getLocale()->getLocale(), 'date_format'=>Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'fix_date'=>true));
484
- $date['month'] = str_pad($date['month'], 2, 0, STR_PAD_LEFT);
485
- $date['day'] = str_pad($date['day'], 2, 0, STR_PAD_LEFT);
486
- $filterEnd = "{$date['year']}-{$date['month']}-{$date['day']} 23:59:59";
487
- }
488
-
489
- if ($filterStart and $filterEnd) {
490
- //compreso tra start e end date
491
- if ($createdAt >= $filterStart and $createdAt <= $filterEnd) {
492
- $orderedDate = 1;
493
- }
494
- } elseif ($filterStart) {
495
- // >= di start date
496
- if ($createdAt >= $filterStart) {
497
- $orderedDate = 1;
498
- }
499
- } else {
500
- // <= di end date
501
- if ($createdAt <= $filterEnd) {
502
- $orderedDate = 1;
503
- }
504
- }
505
-
506
- //unsetto la variabile
507
- unset($orders); //->unsetData();
508
- }
509
-
510
- if ($orderedDate == 1) {
511
- $tempOrderedDateYes[] = $result[$count];
512
- } else {
513
- $tempOrderedDateNo[] = $result[$count];
514
- }
515
-
516
- $count++;
517
- }
518
-
519
- if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes') {
520
- $customersFiltered = array_intersect($tempOrderedDateYes, $customersFiltered);
521
- } else {
522
- $customersFiltered = array_intersect($tempOrderedDateNo, $customersFiltered);
523
- }
524
- }
525
- //FINE FILTRO 9 DATA ACQUISTATO: testato ok
526
-
527
- } else {
528
- //GESTISCO LE MODIFICHE MANUALI
529
- $count = 0;
530
- $result = array();
531
- $tempMod = array();
532
-
533
- $emails = explode("\n", $request->getRequest()->getParam('mailupCustomerFilteredMod'));
534
-
535
- foreach ($emails as $email) {
536
- $email = trim($email);
537
-
538
- if (strstr($email, '@') !== false) {
539
- $customerModCollection = Mage::getModel('customer/customer')
540
- ->getCollection()
541
- ->addAttributeToSelect('email')
542
- ->addAttributeToFilter('email', $email);
543
-
544
- $added = 0;
545
-
546
- foreach ($customerModCollection as $customerMod) {
547
- $tempMod[] = $customerMod->toArray();
548
- $added = 1;
549
- }
550
-
551
- if ($added == 0) {
552
- $tempMod[] = array('entity_id'=>0, 'firstname'=>'', 'lastname'=>'', 'email'=>$email);
553
- }
554
- }
555
- }
556
-
557
- //$customersFiltered = array_intersect($tempMod, $customersFiltered);
558
- $customersFiltered = $tempMod;
559
- }
560
- //FINE GESTISCO LE MODIFICHE MANUALI
561
-
562
- return $customersFiltered;
563
- }
564
-
565
-
566
- public function getFilterHints() {
567
- $filter_hints = array();
568
- try {
569
- // fetch write database connection that is used in Mage_Core module
570
- $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
571
-
572
- // now $write is an instance of Zend_Db_Adapter_Abstract
573
- $result = $connectionRead->query("select * from mailup_filter_hints");
574
-
575
- while ($row = $result->fetch()) {
576
- array_push($filter_hints, array('filter_name' => $row['filter_name'], 'hints' => $row['hints']));
577
- }
578
- } catch (Exception $e) {
579
- Mage::log('Exception: '.$e->getMessage(), 0);
580
- die($e);
581
- }
582
-
583
- return $filter_hints;
584
- }
585
-
586
- public function saveFilterHint($filter_name, $post) {
587
- try {
588
- $hints = '';
589
- foreach ($post as $k => $v) {
590
- if ($v!='' && $k!='form_key') {
591
- if ($hints!='') {
592
- $hints .= '|';
593
- }
594
- $hints .= $k.'='.$v;
595
- }
596
- }
597
- //(e.g. $hints = 'mailupCustomers=2|mailupSubscribed=1';)
598
-
599
- $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
600
-
601
- $connectionWrite->query("INSERT INTO mailup_filter_hints (filter_name, hints) VALUES ('".$filter_name."', '".$hints."')");
602
- } catch (Exception $e) {
603
- Mage::log('Exception: '.$e->getMessage(), 0);
604
- die($e);
605
- }
606
- }
607
-
608
- public function deleteFilterHint($filter_name) {
609
- try {
610
- $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
611
-
612
- $connectionWrite->query("DELETE FROM mailup_filter_hints WHERE filter_name LIKE '".$filter_name."'");
613
- } catch (Exception $e) {
614
- Mage::log('Exception: '.$e->getMessage(), 0);
615
- die($e);
616
- }
617
- }
618
-
619
- public function getFieldsMapping() {
620
- $fieldsMappings = array();
621
- try {
622
- $connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
623
- return $connectionRead->fetchPairs("select magento_field_name, mailup_field_id from mailup_fields_mapping");
624
- } catch (Exception $e) {
625
- Mage::log('Exception: '.$e->getMessage(), 0);
626
- die($e);
627
- }
628
-
629
- return $fieldsMappings;
630
- }
631
-
632
- public function saveFieldMapping($post) {
633
- try {
634
- $connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
635
- $connectionWrite->query("DELETE FROM mailup_fields_mapping");
636
- foreach ($post as $k => $v) {
637
- if (strlen($v) == 0) continue;
638
- $connectionWrite->insert("mailup_fields_mapping", array(
639
- "magento_field_name" => $k,
640
- "mailup_field_id" => $v
641
- ));
642
- }
643
- } catch (Exception $e) {
644
- Mage::log('Exception: '.$e->getMessage(), 0);
645
- die($e);
646
- }
647
- }
648
- }
1
  <?php
2
 
3
+ // this file is needed for backward compatibility
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/SevenLike/MailUp/Model/Wssend.php CHANGED
@@ -45,7 +45,7 @@ class MailUpWsSend
45
 
46
  $result = get_object_vars($this->soapClient->LoginFromId($loginData));
47
  $xml = simplexml_load_string($result['LoginFromIdResult']);
48
- Mage::log($xml);
49
 
50
  $errorCode = (string)$xml->errorCode;
51
  $errorDescription = (string)$xml->errorDescription;
@@ -99,12 +99,12 @@ class MailUpWsSend
99
 
100
  if ($xmlSimpleElement->Fields && sizeof($xmlSimpleElement->Fields->Field) > 0) {
101
  $fields = array();
102
- Mage::log('Fields returned, overwriting default configuration', 0);
103
  foreach ($xmlSimpleElement->Fields->Field as $fieldSimpleElement) {
104
  $fields[(string)$fieldSimpleElement['Name']] = (string)$fieldSimpleElement['Id'];
105
  }
106
  }
107
- Mage::log($fields);
108
  return $fields;
109
  }
110
 
@@ -219,7 +219,6 @@ class MailUpWsSend
219
  try {
220
  $params = array_merge((array)$params, array('accessKey' => $this->accessKey));
221
  $this->soapClient->SendNewsletter($params);
222
- var_dump($params);
223
  $this->printLastRequest();
224
  if ($this->readReturnCode('SendNewsletter', 'errorCode') != 0) {
225
  echo '<br /><br />Errore SendNewsletter: '. $this->readReturnCode('SendNewsletter', 'errorCode') .' - '. $this->readReturnCode('SendNewsletter', 'errorDescription');
@@ -236,7 +235,6 @@ class MailUpWsSend
236
  try {
237
  $params = array_merge((array)$params, array('accessKey' => $this->accessKey));
238
  $this->soapClient->SendNewsletterFast($params);
239
-
240
  $this->printLastRequest();
241
  if ($this->readReturnCode('SendNewsletterFast', 'errorCode') != 0) {
242
  echo '<br /><br />Errore SendNewsletterFast: '. $this->readReturnCode('SendNewsletterFast', 'errorCode') .' - '. $this->readReturnCode('SendNewsletterFast', 'errorDescription');
45
 
46
  $result = get_object_vars($this->soapClient->LoginFromId($loginData));
47
  $xml = simplexml_load_string($result['LoginFromIdResult']);
48
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($xml);
49
 
50
  $errorCode = (string)$xml->errorCode;
51
  $errorDescription = (string)$xml->errorDescription;
99
 
100
  if ($xmlSimpleElement->Fields && sizeof($xmlSimpleElement->Fields->Field) > 0) {
101
  $fields = array();
102
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log('Fields returned, overwriting default configuration', 0);
103
  foreach ($xmlSimpleElement->Fields->Field as $fieldSimpleElement) {
104
  $fields[(string)$fieldSimpleElement['Name']] = (string)$fieldSimpleElement['Id'];
105
  }
106
  }
107
+ if (Mage::getStoreConfig('newsletter/mailup/enable_log')) Mage::log($fields);
108
  return $fields;
109
  }
110
 
219
  try {
220
  $params = array_merge((array)$params, array('accessKey' => $this->accessKey));
221
  $this->soapClient->SendNewsletter($params);
 
222
  $this->printLastRequest();
223
  if ($this->readReturnCode('SendNewsletter', 'errorCode') != 0) {
224
  echo '<br /><br />Errore SendNewsletter: '. $this->readReturnCode('SendNewsletter', 'errorCode') .' - '. $this->readReturnCode('SendNewsletter', 'errorDescription');
235
  try {
236
  $params = array_merge((array)$params, array('accessKey' => $this->accessKey));
237
  $this->soapClient->SendNewsletterFast($params);
 
238
  $this->printLastRequest();
239
  if ($this->readReturnCode('SendNewsletterFast', 'errorCode') != 0) {
240
  echo '<br /><br />Errore SendNewsletterFast: '. $this->readReturnCode('SendNewsletterFast', 'errorCode') .' - '. $this->readReturnCode('SendNewsletterFast', 'errorDescription');
app/code/local/SevenLike/MailUp/controllers/.DS_Store CHANGED
File without changes
app/code/local/SevenLike/MailUp/controllers/Adminhtml/.DS_Store CHANGED
File without changes
app/code/local/SevenLike/MailUp/controllers/Adminhtml/ConfigurationController.php CHANGED
@@ -1,9 +1,11 @@
1
  <?php
2
 
 
 
3
  class SevenLike_MailUp_Adminhtml_ConfigurationController extends Mage_Adminhtml_Controller_Action
4
  {
5
- public function indexAction() {
6
-
7
  $url = Mage::getModel('adminhtml/url');
8
  $url = $url->getUrl("adminhtml/system_config/edit", array(
9
  "section" => "newsletter"
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/../../Model/Wssend.php";
5
  class SevenLike_MailUp_Adminhtml_ConfigurationController extends Mage_Adminhtml_Controller_Action
6
  {
7
+ public function indexAction()
8
+ {
9
  $url = Mage::getModel('adminhtml/url');
10
  $url = $url->getUrl("adminhtml/system_config/edit", array(
11
  "section" => "newsletter"
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FieldsmappingController.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
 
 
 
3
  class SevenLike_MailUp_Adminhtml_FieldsMappingController extends Mage_Adminhtml_Controller_Action
4
  {
5
  public function indexAction() {
@@ -10,7 +12,7 @@ class SevenLike_MailUp_Adminhtml_FieldsMappingController extends Mage_Adminhtml_
10
  try {
11
  $post = $this->getRequest()->getPost();
12
  unset($post["form_key"]);
13
- $MailUpWsImport = Mage::getModel('mailup/ws');
14
  $wsImport = new MailUpWsImport();
15
  $wsImport->saveFieldMapping($post);
16
  } catch (Exception $e) {
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/../../Model/Wssend.php";
5
  class SevenLike_MailUp_Adminhtml_FieldsMappingController extends Mage_Adminhtml_Controller_Action
6
  {
7
  public function indexAction() {
12
  try {
13
  $post = $this->getRequest()->getPost();
14
  unset($post["form_key"]);
15
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
16
  $wsImport = new MailUpWsImport();
17
  $wsImport->saveFieldMapping($post);
18
  } catch (Exception $e) {
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php CHANGED
@@ -1,12 +1,16 @@
1
  <?php
2
 
3
- class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Controller_Action {
4
-
 
 
5
  public function indexAction() {
 
6
  $this->loadLayout()->renderLayout();
7
  }
8
 
9
  public function confirmAction() {
 
10
  $this->loadLayout()->renderLayout();
11
  }
12
 
@@ -89,13 +93,57 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
89
  Mage::throwException($this->__('Invalid form data.'));
90
  }
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  $mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
93
- require_once(dirname(__FILE__) . '/../../Helper/Data.php');
94
- SevenLike_MailUp_Helper_Data::generateAndSendCustomers($mailupCustomerIds, $post);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
  $message = $this->__('Members have been sent correctly');
97
  Mage::getSingleton('adminhtml/session')->addSuccess($message);
98
  } catch (Exception $e) {
 
99
  $errorMessage = $this->__('Warning: no member has been selected');
100
  Mage::getSingleton('adminhtml/session')->addError($errorMessage);
101
  }
@@ -104,6 +152,7 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
104
  }
105
 
106
  public function saveFilterHintAction() {
 
107
  try {
108
  $post = $this->getRequest()->getPost();
109
  $filter_name = $post['filter_name'];
@@ -121,6 +170,7 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
121
  }
122
 
123
  public function deleteFilterHintAction() {
 
124
  try {
125
  $post = $this->getRequest()->getPost();
126
 
@@ -141,17 +191,33 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
141
  }
142
 
143
  public function testFieldsAction() {
144
- $MailUpWsSend = Mage::getModel('mailup/wssend');
145
  $wsSend = new MailUpWsSend();
146
  $accessKey = $wsSend->loginFromId();
147
 
148
  if ($accessKey !== false) {
149
  $fields = $wsSend->GetFields($accessKey);
150
-
151
  print_r($fields);
152
  die('success');
153
  } else {
154
  die('no access key returned');
155
  }
156
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/../../Model/Wssend.php";
5
+ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Controller_Action
6
+ {
7
  public function indexAction() {
8
+ $this->checkRunningImport();
9
  $this->loadLayout()->renderLayout();
10
  }
11
 
12
  public function confirmAction() {
13
+ $this->checkRunningImport();
14
  $this->loadLayout()->renderLayout();
15
  }
16
 
93
  Mage::throwException($this->__('Invalid form data.'));
94
  }
95
 
96
+ // creo il gruppo se necessario
97
+ $post["mailupNewGroupName"] = trim($post["mailupNewGroupName"]);
98
+ if ($post["mailupNewGroup"] and strlen($post["mailupNewGroupName"])) {
99
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
100
+ $wsImport = new MailUpWsImport();
101
+ $post['mailupGroupId'] = $wsImport->CreaGruppo(array(
102
+ "idList" => $post['mailupIdList'],
103
+ "listGUID" => $post['mailupListGUID'],
104
+ "newGroupName" => $post["mailupNewGroupName"]
105
+ ));
106
+ }
107
+
108
+ // inserisco il job
109
+ $db_write = Mage::getSingleton('core/resource')->getConnection('core_write');
110
+ $db_write->insert("mailup_sync_jobs", array(
111
+ "mailupgroupid" => $post['mailupGroupId'],
112
+ "send_optin" => $post['send_optin_email_to_new_subscribers'] ? 1 : 0,
113
+ "status" => "queued",
114
+ "queue_datetime" => gmdate("Y-m-d H:i:s")
115
+ ));
116
+ $job_id = $db_write->lastInsertId("mailup_sync_jobs");
117
+
118
+ // inserisco
119
  $mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
120
+ foreach ($mailupCustomerIds as $customer_id) {
121
+ try {
122
+ $db_write->insert("mailup_sync", array(
123
+ "customer_id" => $customer_id,
124
+ "entity" => "customer",
125
+ "job_id" => $job_id,
126
+ "needs_sync" => true,
127
+ "last_sync" => null
128
+ ));
129
+ } catch (Exception $e) {
130
+ $db_write->update("mailup_sync", array(
131
+ "needs_sync" => true
132
+ ), "customer_id=$customer_id AND entity='customer' AND job_id=$job_id");
133
+ }
134
+ }
135
+
136
+ $db_write->insert(Mage::getSingleton('core/resource')->getTableName('cron_schedule'), array(
137
+ "job_code" => "sevenlike_mailup",
138
+ "status" => "pending",
139
+ "created_at" => gmdate("Y-m-d H:i:s"),
140
+ "scheduled_at" => gmdate("Y-m-d H:i:s", strtotime("+1minute"))
141
+ ));
142
 
143
  $message = $this->__('Members have been sent correctly');
144
  Mage::getSingleton('adminhtml/session')->addSuccess($message);
145
  } catch (Exception $e) {
146
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
147
  $errorMessage = $this->__('Warning: no member has been selected');
148
  Mage::getSingleton('adminhtml/session')->addError($errorMessage);
149
  }
152
  }
153
 
154
  public function saveFilterHintAction() {
155
+ $this->checkRunningImport();
156
  try {
157
  $post = $this->getRequest()->getPost();
158
  $filter_name = $post['filter_name'];
170
  }
171
 
172
  public function deleteFilterHintAction() {
173
+ $this->checkRunningImport();
174
  try {
175
  $post = $this->getRequest()->getPost();
176
 
191
  }
192
 
193
  public function testFieldsAction() {
 
194
  $wsSend = new MailUpWsSend();
195
  $accessKey = $wsSend->loginFromId();
196
 
197
  if ($accessKey !== false) {
198
  $fields = $wsSend->GetFields($accessKey);
 
199
  print_r($fields);
200
  die('success');
201
  } else {
202
  die('no access key returned');
203
  }
204
  }
205
+
206
+ public function checkRunningImport()
207
+ {
208
+ $db = Mage::getSingleton("core/resource")->getConnection("core_read");
209
+ $cron_schedule_table = Mage::getSingleton("core/resource")->getTableName("cron_schedule");
210
+
211
+ $running_processes = $db->fetchOne("SELECT count(*) FROM $cron_schedule_table WHERE job_code='sevenlike_mailup' AND status='running'");
212
+ if ($running_processes) {
213
+ Mage::getSingleton("adminhtml/session")->addNotice($this->__("A MailUp import process is running."));
214
+ return;
215
+ }
216
+
217
+ $scheduled_processes = $db->fetchOne("SELECT count(*) FROM $cron_schedule_table WHERE job_code='sevenlike_mailup' AND status='pending'");
218
+ if ($scheduled_processes) {
219
+ Mage::getSingleton("adminhtml/session")->addNotice($this->__("A MailUp import process is schedules and will be executed soon."));
220
+ return;
221
+ }
222
+ }
223
  }
app/code/local/SevenLike/MailUp/controllers/Adminhtml/ViewdatatransferlogController.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname(__FILE__) . "/../../Model/MailUpWsImport.php";
4
+ require_once dirname(__FILE__) . "/../../Model/Wssend.php";
5
+ class SevenLike_MailUp_Adminhtml_ViewdatatransferlogController extends Mage_Adminhtml_Controller_Action
6
+ {
7
+ public function indexAction() {
8
+ $this->loadLayout()->renderLayout();
9
+ }
10
+
11
+ public function searchAction() {
12
+ $this->loadLayout()->renderLayout();
13
+ }
14
+ }
app/code/local/SevenLike/MailUp/controllers/WebhookController.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SevenLike_MailUp_WebhookController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction()
6
+ {
7
+ }
8
+
9
+ public function subscribeAction()
10
+ {
11
+ $email = @$_REQUEST["customerEmail"];
12
+ if (!$email) {
13
+ $cryptkey = Mage::getStoreConfig('newsletter/mailup/webhook_crypt_key');
14
+ foreach ($_REQUEST as $k=>$v) {
15
+ $k = self::rc4($cryptkey, base64_decode($k));
16
+ $parsed_vars = array();
17
+ parse_str($k, $parsed_vars);
18
+ if ($parsed_vars and isset($parsed_vars["customerEmail"])) {
19
+ $email = $parsed_vars["customerEmail"];
20
+ break;
21
+ }
22
+ }
23
+ }
24
+
25
+ if (!$email) {
26
+ echo 0;
27
+ die();
28
+ }
29
+
30
+ $model = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
31
+ if (!$model->getSubscriberId()) {
32
+ echo 0;
33
+ die();
34
+ }
35
+
36
+ $GLOBALS["__sl_mailup_invia_utente"] = 1; //avoids observer
37
+ $model
38
+ ->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
39
+ ->save();
40
+
41
+ echo 1;
42
+ die();
43
+ }
44
+
45
+ public function unsubscribeAction()
46
+ {
47
+ $email = @$_REQUEST["customerEmail"];
48
+ if (!$email) {
49
+ $cryptkey = Mage::getStoreConfig('newsletter/mailup/webhook_crypt_key');
50
+ foreach ($_REQUEST as $k=>$v) {
51
+ $k = self::rc4($cryptkey, base64_decode($k));
52
+ $parsed_vars = array();
53
+ parse_str($k, $parsed_vars);
54
+ if ($parsed_vars and isset($parsed_vars["customerEmail"])) {
55
+ $email = $parsed_vars["customerEmail"];
56
+ break;
57
+ }
58
+ }
59
+ }
60
+
61
+ if (!$email) {
62
+ echo 0;
63
+ die();
64
+ }
65
+
66
+ $model = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
67
+ if (!$model->getSubscriberId()) {
68
+ echo 0;
69
+ die();
70
+ }
71
+
72
+ $GLOBALS["__sl_mailup_invia_utente"] = 1; //avoids observer
73
+ $model
74
+ ->setStatus(Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED)
75
+ ->save();
76
+
77
+ echo 1;
78
+ die();
79
+ }
80
+
81
+ /**
82
+ * A PHP implementation of RC4 based on the original C code from
83
+ * the 1994 usenet post:
84
+ *
85
+ * http://groups.google.com/groups?selm=sternCvKL4B.Hyy@netcom.com
86
+ *
87
+ * @param key_str the key as a binary string
88
+ * @param data_str the data to decrypt/encrypt as a binary string
89
+ * @return the result of the RC4 as a binary string
90
+ * @author Michael Cutler <m@cotdp.com>
91
+ * @licenses http://www.apache.org/licenses/LICENSE-2.0
92
+ */
93
+ public static function rc4( $key_str, $data_str ) {
94
+ // convert input string(s) to array(s)
95
+ $key = array();
96
+ $data = array();
97
+ for ( $i = 0; $i < strlen($key_str); $i++ ) {
98
+ $key[] = ord($key_str{$i});
99
+ }
100
+ for ( $i = 0; $i < strlen($data_str); $i++ ) {
101
+ $data[] = ord($data_str{$i});
102
+ }
103
+ // prepare key
104
+ $state = array( 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
105
+ 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
106
+ 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
107
+ 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
108
+ 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
109
+ 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
110
+ 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
111
+ 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
112
+ 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
113
+ 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
114
+ 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
115
+ 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
116
+ 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
117
+ 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
118
+ 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
119
+ 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 );
120
+ $len = count($key);
121
+ $index1 = $index2 = 0;
122
+ for( $counter = 0; $counter < 256; $counter++ ){
123
+ $index2 = ( $key[$index1] + $state[$counter] + $index2 ) % 256;
124
+ $tmp = $state[$counter];
125
+ $state[$counter] = $state[$index2];
126
+ $state[$index2] = $tmp;
127
+ $index1 = ($index1 + 1) % $len;
128
+ }
129
+ // rc4
130
+ $len = count($data);
131
+ $x = $y = 0;
132
+ for ($counter = 0; $counter < $len; $counter++) {
133
+ $x = ($x + 1) % 256;
134
+ $y = ($state[$x] + $y) % 256;
135
+ $tmp = $state[$x];
136
+ $state[$x] = $state[$y];
137
+ $state[$y] = $tmp;
138
+ $data[$counter] ^= $state[($state[$x] + $state[$y]) % 256];
139
+ }
140
+ // convert output back to a string
141
+ $data_str = "";
142
+ for ( $i = 0; $i < $len; $i++ ) {
143
+ $data_str .= chr($data[$i]);
144
+ }
145
+ return $data_str;
146
+ }
147
+ }
app/code/local/SevenLike/MailUp/etc/.DS_Store CHANGED
File without changes
app/code/local/SevenLike/MailUp/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <SevenLike_MailUp>
6
- <version>2.1.3</version>
7
  </SevenLike_MailUp>
8
  </modules>
9
 
@@ -80,6 +80,33 @@
80
  </mailupconfigtest_observer>
81
  </observers>
82
  </admin_session_user_login_success>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  </events>
84
  </global>
85
 
@@ -125,6 +152,13 @@
125
  <action>mailup/adminhtml_fieldsmapping</action>
126
  <sort_order>300</sort_order>
127
  </mailup_fieldsmapping>
 
 
 
 
 
 
 
128
  </children>
129
  </mailup>
130
  </children>
@@ -142,12 +176,18 @@
142
  <mailup>
143
  <title>Mailup</title>
144
  <children>
145
- <mailup_filters>
146
- <title>Mailup Filters</title>
147
- </mailup_filters>
148
- <mailup_fieldsmapping>
149
- <title>Mailup Fields Mapping</title>
150
- </mailup_fieldsmapping>
 
 
 
 
 
 
151
  </children>
152
  </mailup>
153
  </children>
@@ -183,15 +223,24 @@
183
  </mailup>
184
  </modules>
185
  </translate>
 
 
 
 
 
 
 
186
  </frontend>
187
 
188
  <crontab>
189
  <jobs>
190
  <sevenlike_mailup>
191
- <run>
192
- <model>mailup/Cron::run</model>
193
- </run>
194
  </sevenlike_mailup>
 
 
 
 
195
  </jobs>
196
  </crontab>
197
  </config>
3
  <config>
4
  <modules>
5
  <SevenLike_MailUp>
6
+ <version>2.2.0</version>
7
  </SevenLike_MailUp>
8
  </modules>
9
 
80
  </mailupconfigtest_observer>
81
  </observers>
82
  </admin_session_user_login_success>
83
+ <controller_action_postdispatch_checkout_onepage_saveOrder>
84
+ <observers>
85
+ <mailup_subscribe_during_checkout>
86
+ <type>singleton</type>
87
+ <class>SevenLike_MailUp_Model_Observer</class>
88
+ <method>subscribeDuringCheckout</method>
89
+ </mailup_subscribe_during_checkout>
90
+ </observers>
91
+ </controller_action_postdispatch_checkout_onepage_saveOrder>
92
+ <customer_save_after>
93
+ <observers>
94
+ <mailup_customer_save_after>
95
+ <type>singleton</type>
96
+ <class>SevenLike_MailUp_Model_Observer</class>
97
+ <method>prepareCustomerForDataSync</method>
98
+ </mailup_customer_save_after>
99
+ </observers>
100
+ </customer_save_after>
101
+ <sales_order_save_after>
102
+ <observers>
103
+ <mailup_sales_order_save_after>
104
+ <type>singleton</type>
105
+ <class>SevenLike_MailUp_Model_Observer</class>
106
+ <method>prepareOrderForDataSync</method>
107
+ </mailup_sales_order_save_after>
108
+ </observers>
109
+ </sales_order_save_after>
110
  </events>
111
  </global>
112
 
152
  <action>mailup/adminhtml_fieldsmapping</action>
153
  <sort_order>300</sort_order>
154
  </mailup_fieldsmapping>
155
+ <!--
156
+ <mailup_viewdatatransferlog translate="title">
157
+ <title>View data transfer log</title>
158
+ <action>mailup/adminhtml_viewdatatransferlog</action>
159
+ <sort_order>400</sort_order>
160
+ </mailup_viewdatatransferlog>
161
+ -->
162
  </children>
163
  </mailup>
164
  </children>
176
  <mailup>
177
  <title>Mailup</title>
178
  <children>
179
+ <mailup_configuration>
180
+ <title>Mailup Configuration</title>
181
+ </mailup_configuration>
182
+ <mailup_filters>
183
+ <title>Mailup Filters</title>
184
+ </mailup_filters>
185
+ <mailup_fieldsmapping>
186
+ <title>Mailup Fields Mapping</title>
187
+ </mailup_fieldsmapping>
188
+ <mailup_viewdatatransferlog>
189
+ <title>View data transfer log</title>
190
+ </mailup_viewdatatransferlog>
191
  </children>
192
  </mailup>
193
  </children>
223
  </mailup>
224
  </modules>
225
  </translate>
226
+ <layout>
227
+ <updates>
228
+ <mailup>
229
+ <file>mailup.xml</file>
230
+ </mailup>
231
+ </updates>
232
+ </layout>
233
  </frontend>
234
 
235
  <crontab>
236
  <jobs>
237
  <sevenlike_mailup>
238
+ <run><model>mailup/Cron::run</model></run>
 
 
239
  </sevenlike_mailup>
240
+ <mailup_connectionproblemsredo>
241
+ <schedule><cron_expr>*/5 * * * *</cron_expr></schedule>
242
+ <run><model>mailup/Cron::resendConnectionErrors</model></run>
243
+ </mailup_connectionproblemsredo>
244
  </jobs>
245
  </crontab>
246
  </config>
app/code/local/SevenLike/MailUp/etc/system.xml CHANGED
@@ -15,6 +15,8 @@
15
  <frontend_type>text</frontend_type>
16
  <sort_order>10</sort_order>
17
  <show_in_default>1</show_in_default>
 
 
18
  <comment>It's the domain portion of the browser address field when you using the MailUp Admin console (e.g. g4a0.s03.it)</comment>
19
  <backend_model>mailup/consoleurlvalidator</backend_model>
20
  </url_console>
@@ -23,6 +25,8 @@
23
  <frontend_type>text</frontend_type>
24
  <sort_order>20</sort_order>
25
  <show_in_default>1</show_in_default>
 
 
26
  <backend_model>mailup/webserviceusernamevalidator</backend_model>
27
  </username_ws>
28
  <password_ws translate="comment">
@@ -30,6 +34,8 @@
30
  <frontend_type>password</frontend_type>
31
  <sort_order>40</sort_order>
32
  <show_in_default>1</show_in_default>
 
 
33
  <comment>For assistance visit help.mailup.com and search for "API credentials"</comment>
34
  </password_ws>
35
  <list translate="label comment">
@@ -38,24 +44,53 @@
38
  <source_model>mailup/lists</source_model>
39
  <sort_order>60</sort_order>
40
  <show_in_default>1</show_in_default>
41
- <!--comment>If you haven't yet, we suggest you to create a DEM list directly from your mailup console</comment-->
 
42
  </list>
 
 
 
 
 
 
 
 
 
43
  <enable_cron_export tranlate="label comment">
44
  <label>Enable Automatic Data Export to MailUp</label>
45
  <frontend_type>select</frontend_type>
46
  <source_model>adminhtml/system_config_source_yesno</source_model>
47
- <sort_order>70</sort_order>
48
  <show_in_default>1</show_in_default>
 
 
49
  </enable_cron_export>
50
  <mailup_cron_frequency translate="label comment">
51
  <label>Export Frequency</label>
52
  <frontend_type>select</frontend_type>
53
  <source_model>mailup/adminhtml_system_source_cron_frequency</source_model>
54
- <sort_order>80</sort_order>
55
  <show_in_default>1</show_in_default>
56
  <show_in_website>1</show_in_website>
57
  <show_in_store>1</show_in_store>
58
  </mailup_cron_frequency>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </fields>
60
  </mailup>
61
  </groups>
15
  <frontend_type>text</frontend_type>
16
  <sort_order>10</sort_order>
17
  <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
  <comment>It's the domain portion of the browser address field when you using the MailUp Admin console (e.g. g4a0.s03.it)</comment>
21
  <backend_model>mailup/consoleurlvalidator</backend_model>
22
  </url_console>
25
  <frontend_type>text</frontend_type>
26
  <sort_order>20</sort_order>
27
  <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
  <backend_model>mailup/webserviceusernamevalidator</backend_model>
31
  </username_ws>
32
  <password_ws translate="comment">
34
  <frontend_type>password</frontend_type>
35
  <sort_order>40</sort_order>
36
  <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
  <comment>For assistance visit help.mailup.com and search for "API credentials"</comment>
40
  </password_ws>
41
  <list translate="label comment">
44
  <source_model>mailup/lists</source_model>
45
  <sort_order>60</sort_order>
46
  <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
  </list>
50
+ <enable_subscribe_in_checkout tranlate="label comment">
51
+ <label>Enable subscription checkbox during checkout</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>adminhtml/system_config_source_yesno</source_model>
54
+ <sort_order>70</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>1</show_in_store>
58
+ </enable_subscribe_in_checkout>
59
  <enable_cron_export tranlate="label comment">
60
  <label>Enable Automatic Data Export to MailUp</label>
61
  <frontend_type>select</frontend_type>
62
  <source_model>adminhtml/system_config_source_yesno</source_model>
63
+ <sort_order>80</sort_order>
64
  <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
  </enable_cron_export>
68
  <mailup_cron_frequency translate="label comment">
69
  <label>Export Frequency</label>
70
  <frontend_type>select</frontend_type>
71
  <source_model>mailup/adminhtml_system_source_cron_frequency</source_model>
72
+ <sort_order>90</sort_order>
73
  <show_in_default>1</show_in_default>
74
  <show_in_website>1</show_in_website>
75
  <show_in_store>1</show_in_store>
76
  </mailup_cron_frequency>
77
+ <webhook_crypt_key>
78
+ <label>Webhook crypt key</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>100</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </webhook_crypt_key>
85
+ <enable_log>
86
+ <label>Enable module debugging log</label>
87
+ <frontend_type>select</frontend_type>
88
+ <source_model>adminhtml/system_config_source_yesno</source_model>
89
+ <sort_order>110</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </enable_log>
94
  </fields>
95
  </mailup>
96
  </groups>
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-install-0.1.0.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.1.0-1.0.0.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.3.0-1.0.0.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-1.0.0-1.5.2.php CHANGED
File without changes
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-2.1.3-2.2.0.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ $this->run("CREATE TABLE IF NOT EXISTS `mailup_sync` (
6
+ `customer_id` int(11) NOT NULL,
7
+ `entity` varchar(100) NOT NULL,
8
+ `job_id` int(11) NOT NULL,
9
+ `needs_sync` tinyint(1) NOT NULL,
10
+ `last_sync` datetime NULL,
11
+ PRIMARY KEY (`customer_id`,`entity`,`job_id`)
12
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
13
+
14
+ $this->run("CREATE TABLE IF NOT EXISTS `mailup_sync_jobs` (
15
+ `id` int(11) NOT NULL AUTO_INCREMENT,
16
+ `mailupgroupid` int(11) NOT NULL,
17
+ `send_optin` tinyint(1) NOT NULL,
18
+ `status` varchar(20) NOT NULL,
19
+ `queue_datetime` datetime NOT NULL,
20
+ `start_datetime` datetime,
21
+ `finish_datetime` datetime,
22
+ PRIMARY KEY (`id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;");
24
+
25
+ $this->endSetup();
app/design/adminhtml/default/default/layout/mailup.xml CHANGED
@@ -18,7 +18,6 @@
18
  <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
19
  </reference>
20
  </mailup_adminhtml_filter_confirm>
21
-
22
  <mailup_adminhtml_fieldsmapping_index>
23
  <update handle="mailup_adminhtml_index" />
24
  <reference name="content">
@@ -28,4 +27,22 @@
28
  <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
29
  </reference>
30
  </mailup_adminhtml_fieldsmapping_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </layout>
18
  <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
19
  </reference>
20
  </mailup_adminhtml_filter_confirm>
 
21
  <mailup_adminhtml_fieldsmapping_index>
22
  <update handle="mailup_adminhtml_index" />
23
  <reference name="content">
27
  <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
28
  </reference>
29
  </mailup_adminhtml_fieldsmapping_index>
30
+ <mailup_adminhtml_viewdatatransferlog_index>
31
+ <update handle="mailup_adminhtml_index" />
32
+ <reference name="content">
33
+ <block type="adminhtml/template" name="viewdatatransferlog" template="sevenlike/mailup/viewdatatransferlog.phtml" />
34
+ </reference>
35
+ <reference name="head">
36
+ <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
37
+ </reference>
38
+ </mailup_adminhtml_viewdatatransferlog_index>
39
+ <mailup_adminhtml_viewdatatransferlog_search>
40
+ <update handle="mailup_adminhtml_index" />
41
+ <reference name="content">
42
+ <block type="adminhtml/template" name="viewdatatransferlog" template="sevenlike/mailup/viewdatatransferlog.phtml" />
43
+ </reference>
44
+ <reference name="head">
45
+ <action method="addCss"><stylesheet>sevenlike/mailup/mailup.css</stylesheet></action>
46
+ </reference>
47
+ </mailup_adminhtml_viewdatatransferlog_search>
48
  </layout>
app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml CHANGED
@@ -1,11 +1,5 @@
1
  <?php
2
- /**
3
- Author: Sevenlike www.sevenlike.com
4
- */
5
- ?>
6
- <?php
7
  //ottengo l'elenco delle liste e dei gruppi da mailup
8
- $MailUpWsImport = Mage::getModel('mailup/ws');
9
  $wsImport = new MailUpWsImport();
10
 
11
  $customersFiltered = $wsImport->getCustomersFiltered($this);
@@ -49,13 +43,9 @@ $xml = simplexml_load_string($xmlLists);
49
  $formParams = '';
50
  $mailupCustomerIds = array();
51
  //mi passo gli id di tutti i clienti filtrati
52
- foreach ($customersFiltered as $customer) {
53
- //echo '<input name="mailupCustomerIds['.$countPost.'][entity_id]" type="hidden" value="'.$customer['entity_id'].'" />';
54
- //echo '<input name="mailupCustomerIds['.$countPost.'][email]" type="hidden" value="'.$customer['email'].'" />';
55
- $textArea .= $customer['email'].'
56
- ';
57
- $mailupCustomerIds[$countPost]['entity_id'] = $customer['entity_id'];
58
- $mailupCustomerIds[$countPost]['email'] = $customer['email'];
59
  $countPost++;
60
  }
61
  //salvo l'array nella sessione
@@ -70,8 +60,9 @@ $xml = simplexml_load_string($xmlLists);
70
  <tr>
71
  <td><h3><?php echo $this->__('MailUp')?></h3></td>
72
  <td class="a-right">
73
- <button onclick="back_form.submit()" class="scalable back" type="button"><span><?php echo $this->__('Reset filters')?></span></button>
74
- <button onclick="editForm.submit()" class="scalable save" type="button"><span><?php echo $this->__('Send to MailUp')?></span></button>
 
75
  </td>
76
  </tr>
77
  </table>
@@ -99,16 +90,11 @@ $xml = simplexml_load_string($xmlLists);
99
  <td colspan="2"><h4><?php echo $this->__('Were found')?> <strong><?php echo $countPost; ?></strong> <?php echo $this->__('records')?></h4></td>
100
  </tr>
101
  <tr>
102
- <td><?php echo $this->__('Filtered customers')?>:</td>
103
  </tr>
104
  <tr>
105
  <td>
106
- <textarea name="mailupCustomerFilteredView" rows="5" cols="50" disabled="disabled" class="txtar1"><?php
107
- /*foreach ($customersFiltered as $customer) {
108
- echo $customer['email'].'&#10;';
109
- }*/
110
- echo $textArea;
111
- ?></textarea>
112
  </td>
113
  </tr>
114
  <tr>
@@ -122,7 +108,7 @@ $xml = simplexml_load_string($xmlLists);
122
  <table>
123
  <tr>
124
  <td>
125
- <h4><?php echo $this->__('Next Step')?></h4>
126
  </td>
127
  </tr>
128
  <tr>
@@ -173,32 +159,22 @@ $xml = simplexml_load_string($xmlLists);
173
  </td>
174
  </tr>
175
  </table>
176
- </fieldset>
177
- </form>
178
-
179
- <?php //form per la modifica manuale delle email ?>
180
- <form id="manual_form" name="manual_form" method="post" action="<?php echo $this->getUrl('*/*/confirm')?>">
181
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
182
- <h4><span id="spantitle4"><?php echo $this->__('Add a new e-mail address or select adresses to be removed from list')?></span></h4>
183
- <fieldset id="my-fieldset">
184
- <table cellspacing="5" class="form-list">
185
  <tr>
186
  <td>
187
- <?php echo $this->__('Change members list: please add one email adress per row')?>
188
- </td>
189
- <td>
190
- <textarea name="mailupCustomerFilteredMod" rows="20" cols="50" class="txtar1"><?php echo $textArea;?></textarea>
191
  </td>
192
  </tr>
193
  <tr>
194
- <td>&nbsp;</td>
195
  <td>
196
- <button onclick="manual_form.submit()" class="scalable save" type="button"><span><?php echo $this->__('Save changes')?></span></button><!-- <input type="submit" value="Applica modifiche"> -->
197
  </td>
198
  </tr>
199
  </table>
200
  </fieldset>
201
  </form>
 
202
  </div>
203
  <script type="text/javascript">
204
  var editForm = new varienForm('edit_form');
1
  <?php
 
 
 
 
 
2
  //ottengo l'elenco delle liste e dei gruppi da mailup
 
3
  $wsImport = new MailUpWsImport();
4
 
5
  $customersFiltered = $wsImport->getCustomersFiltered($this);
43
  $formParams = '';
44
  $mailupCustomerIds = array();
45
  //mi passo gli id di tutti i clienti filtrati
46
+ foreach ($customersFiltered as $i=>$customer) {
47
+ if ($i++ < 25) $textArea .= $customer['email'] . "\n";
48
+ $mailupCustomerIds[$countPost] = $customer['entity_id'];
 
 
 
 
49
  $countPost++;
50
  }
51
  //salvo l'array nella sessione
60
  <tr>
61
  <td><h3><?php echo $this->__('MailUp')?></h3></td>
62
  <td class="a-right">
63
+ <div id="mailuploading" class="mailuploading"><?php echo $this->__("Please wait for the next step to load") ?></div>
64
+ <button id="mailupback" onclick="back_form.submit()" class="scalable back" type="button"><span><?php echo $this->__('Reset filters')?></span></button>
65
+ <button onclick="$$('.content-header-floating').invoke('setStyle', {visibility:'hidden'});document.getElementById('mailupsend').style.display='none';document.getElementById('mailupback').style.display='none';document.getElementById('mailuploading').style.display='block';editForm.submit()" class="scalable save" type="button" id="mailupsend"><span><?php echo $this->__('Send to MailUp')?></span></button>
66
  </td>
67
  </tr>
68
  </table>
90
  <td colspan="2"><h4><?php echo $this->__('Were found')?> <strong><?php echo $countPost; ?></strong> <?php echo $this->__('records')?></h4></td>
91
  </tr>
92
  <tr>
93
+ <td><?php echo $this->__('Filtered customers preview')?>:</td>
94
  </tr>
95
  <tr>
96
  <td>
97
+ <textarea name="mailupCustomerFilteredView" rows="5" cols="50" disabled="disabled" class="txtar1"><?php echo $textArea ?></textarea>
 
 
 
 
 
98
  </td>
99
  </tr>
100
  <tr>
108
  <table>
109
  <tr>
110
  <td>
111
+ <h4><?php echo $this->__('Next step')?></h4>
112
  </td>
113
  </tr>
114
  <tr>
159
  </td>
160
  </tr>
161
  </table>
162
+
163
+ <table>
 
 
 
 
 
 
 
164
  <tr>
165
  <td>
166
+ <h4><?php echo $this->__('Next step')?></h4>
 
 
 
167
  </td>
168
  </tr>
169
  <tr>
 
170
  <td>
171
+ <input type="checkbox" name="send_optin_email_to_new_subscribers" value="1" checked="checked" /> <?php echo $this->__('Send opt-in email to new subscribers') ?>
172
  </td>
173
  </tr>
174
  </table>
175
  </fieldset>
176
  </form>
177
+
178
  </div>
179
  <script type="text/javascript">
180
  var editForm = new varienForm('edit_form');
app/design/adminhtml/default/default/template/sevenlike/mailup/fieldsmapping.phtml CHANGED
@@ -1,14 +1,12 @@
1
  <?php
2
 
3
  $allmagentofields = array("Name", "Last", "Email", "Company", "Address", "City", "ZIP", "Province", "Region", "Country", "Gender", "DateOfBirth", "CustomerID", "Phone", "Fax", "LatestOrderID", "LatestOrderDate", "LatestOrderAmount", "LatestOrderProductIDs", "LatestOrderCategoryIDs", "LatestShippedOrderDate", "LatestShippedOrderID", "LatestAbandonedCartDate", "LatestAbandonedCartTotal", "LatestAbandonedCartID", "TotalOrdered", "TotalOrderedLast12m", "TotalOrderedLast30d", "AllOrderedProductIDs");
4
- $MailUpWsSend = Mage::getModel('mailup/wssend');
5
  $wsSend = new MailUpWsSend();
6
  $accessKey = $wsSend->loginFromId();
7
 
8
  if ($accessKey === false) {
9
  echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
10
  } else {
11
- $MailUpWsImport = Mage::getModel('mailup/ws');
12
  $wsImport = new MailUpWsImport();
13
 
14
  $wsSend = new MailUpWsSend();
1
  <?php
2
 
3
  $allmagentofields = array("Name", "Last", "Email", "Company", "Address", "City", "ZIP", "Province", "Region", "Country", "Gender", "DateOfBirth", "CustomerID", "Phone", "Fax", "LatestOrderID", "LatestOrderDate", "LatestOrderAmount", "LatestOrderProductIDs", "LatestOrderCategoryIDs", "LatestShippedOrderDate", "LatestShippedOrderID", "LatestAbandonedCartDate", "LatestAbandonedCartTotal", "LatestAbandonedCartID", "TotalOrdered", "TotalOrderedLast12m", "TotalOrderedLast30d", "AllOrderedProductIDs");
 
4
  $wsSend = new MailUpWsSend();
5
  $accessKey = $wsSend->loginFromId();
6
 
7
  if ($accessKey === false) {
8
  echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
9
  } else {
 
10
  $wsImport = new MailUpWsImport();
11
 
12
  $wsSend = new MailUpWsSend();
app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml CHANGED
@@ -1,32 +1,12 @@
1
  <?php
2
- /**
3
- * Author: Sevenlike (www.sevenlike.com)
4
- */
5
 
6
- $MailUpWsSend = Mage::getModel('mailup/wssend');
7
  $wsSend = new MailUpWsSend();
8
  $accessKey = $wsSend->loginFromId();
9
 
10
- /* TEST SOAP AL MOMENTO DISABILITATO
11
-
12
- $loginTest = $wsSend->loginTest();
13
- $soap = $wsSend->testSoap();
14
-
15
- if (!strpos($soap, 'x12qaq')){
16
- echo $this->__('WARNING: your server may not support SOAP communications').'<br /><br />';
17
- }
18
-
19
- if ($loginTest > 0){
20
- echo $this->__('WARNING: your server may not support MailUp SOAP communications').'<br /><br />';
21
- }
22
-
23
- */
24
-
25
  if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 1) {
26
  echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
27
  } else {
28
  //controllo se la lista e' stata selezionata correttamente
29
- $MailUpWsImport = Mage::getModel('mailup/ws');
30
  $wsImport = new MailUpWsImport();
31
  $mailupLists = $wsImport->GetNlList();
32
 
@@ -79,7 +59,8 @@ if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list'
79
  <h3><?php echo $this->__('Filters')?></h3>
80
  </td>
81
  <td class="a-right">
82
- <button onclick="editForm.submit()" class="scalable save" type="button"><span><?php echo $this->__('Apply filter')?></span></button>
 
83
  </td>
84
  </tr>
85
  </table>
@@ -261,7 +242,7 @@ if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list'
261
  <tr>
262
  <td class="labelpg1"><?php echo $this->__('From')?></td>
263
  <td class="input-ele">
264
- <input type="text" class="inptptx1 customerDependent" name="mailupCustomerStartDate" id="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" /><img id="mailupCustomerStartDateTrig" class="v-middle" alt="" src="/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>
265
  <script type="text/javascript">
266
  Calendar.setup({
267
  inputField: "mailupCustomerStartDate",
@@ -277,7 +258,7 @@ if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list'
277
  <tr>
278
  <td class="labelpg1"><?php echo $this->__('To')?></td>
279
  <td class="input-ele">
280
- <input type="text" class="inptptx1 customerDependent" name="mailupCustomerEndDate" id="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" /><img id="mailupCustomerEndDateTrig" class="v-middle" alt="" src="/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>
281
  <script type="text/javascript">
282
  Calendar.setup({
283
  inputField: "mailupCustomerEndDate",
1
  <?php
 
 
 
2
 
 
3
  $wsSend = new MailUpWsSend();
4
  $accessKey = $wsSend->loginFromId();
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 1) {
7
  echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
8
  } else {
9
  //controllo se la lista e' stata selezionata correttamente
 
10
  $wsImport = new MailUpWsImport();
11
  $mailupLists = $wsImport->GetNlList();
12
 
59
  <h3><?php echo $this->__('Filters')?></h3>
60
  </td>
61
  <td class="a-right">
62
+ <div id="mailuploading" class="mailuploading"><?php echo $this->__("Please wait for the next step to load") ?></div>
63
+ <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"><div class="mailuploading"></div><span><?php echo $this->__('Apply filter')?></span></button>
64
  </td>
65
  </tr>
66
  </table>
242
  <tr>
243
  <td class="labelpg1"><?php echo $this->__('From')?></td>
244
  <td class="input-ele">
245
+ <input type="text" class="inptptx1 customerDependent" name="mailupCustomerStartDate" id="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" /><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>
246
  <script type="text/javascript">
247
  Calendar.setup({
248
  inputField: "mailupCustomerStartDate",
258
  <tr>
259
  <td class="labelpg1"><?php echo $this->__('To')?></td>
260
  <td class="input-ele">
261
+ <input type="text" class="inptptx1 customerDependent" name="mailupCustomerEndDate" id="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" /><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>
262
  <script type="text/javascript">
263
  Calendar.setup({
264
  inputField: "mailupCustomerEndDate",
app/design/adminhtml/default/default/template/sevenlike/mailup/viewdatatransferlog.phtml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form name="viewdatatransferlog_form" action="<?php echo $this->getUrl('*/*/search') ?>" method="post">
2
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
3
+ <div class="content-header">
4
+ <table cellspacing="0" class="grid-header">
5
+ <tr>
6
+ <td style="width:50%">
7
+ <h3><?php echo $this->__("View data transfer log") ?></h3>
8
+ </td>
9
+ <td class="form-buttons">
10
+ <button onclick="searchForm.submit()"><?php echo $this->__("Search") ?></button>
11
+ </td>
12
+ </tr>
13
+ </table>
14
+ </div>
15
+ <div class="grid">
16
+ <div class="hor-scroll">
17
+ <table class="data" cellspacing="0">
18
+ <thead>
19
+ <tr class="headings">
20
+ <th><span class="nobr"><?php echo $this->__("Date/time") ?></span></th>
21
+ <th><span class="nobr"><?php echo $this->__("Type") ?></span></th>
22
+ <th><span class="nobr"><?php echo $this->__("Result") ?></span></th>
23
+ <th class="last"><span class="nobr"><?php echo $this->__("N. updated records") ?></span></th>
24
+ </tr>
25
+ <tr class="filter">
26
+ <th><div class="range"><div class="range-line date">
27
+ <span class="label"><?php echo $this->__("From") ?>:</span>
28
+ <input type="text" class="input-text no-changes" value="" id="sales_order_grid_filter_created_at1354009617.6284_from" name="date_from">
29
+ <img title="" id="sales_order_grid_filter_created_at1354009617.6284_from_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>/adminhtml/default/default/images/grid-cal.gif">
30
+ </div><div class="range-line date">
31
+ <span class="label"><?php echo $this->__("To") ?>:</span>
32
+ <input type="text" class="input-text no-changes" value="" id="sales_order_grid_filter_created_at1354009617.6284_to" name="date_to">
33
+ <img title="" id="sales_order_grid_filter_created_at1354009617.6284_to_trig" class="v-middle" alt="" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) ?>/adminhtml/default/default/images/grid-cal.gif">
34
+ </div></div><input type="hidden" value="it_IT" name="created_at[locale]"><script type="text/javascript">
35
+ Calendar.setup({
36
+ inputField : "sales_order_grid_filter_created_at1354009617.6284_from",
37
+ ifFormat : "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>",
38
+ button : "sales_order_grid_filter_created_at1354009617.6284_from_trig",
39
+ showsTime: false,
40
+ align : "Bl",
41
+ singleClick : true
42
+ });
43
+ Calendar.setup({
44
+ inputField : "sales_order_grid_filter_created_at1354009617.6284_to",
45
+ ifFormat : "<?php echo Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ?>",
46
+ button : "sales_order_grid_filter_created_at1354009617.6284_to_trig",
47
+ showsTime: false,
48
+ align : "Bl",
49
+ singleClick : true
50
+ });
51
+ </script></th>
52
+ <th><select name="type">
53
+ <option selected="selected" value=""></option>
54
+ <option value="automatic"><?php echo $this->__("Automatic") ?></option>
55
+ <option value="manual"><?php echo $this->__("Manual") ?></option>
56
+ </select></th>
57
+ <th><select name="result">
58
+ <option selected="selected" value=""></option>
59
+ <option value="completed"><?php echo $this->__("Completed") ?></option>
60
+ <option value="partial"><?php echo $this->__("Partial") ?></option>
61
+ <option value="failed"><?php echo $this->__("Failed") ?></option>
62
+ </select></th>
63
+ <th class="last">&nbsp;</th>
64
+ </tr>
65
+ </thead>
66
+ </table>
67
+ </div>
68
+ </div>
69
+ </form>
70
+ <script type="text/javascript">
71
+ var searchForm = new varienForm('viewdatatransferlog_form');
72
+ </script>
app/etc/modules/SevenLike_MailUp.xml CHANGED
File without changes
app/locale/en_US/SevenLike_MailUp.csv CHANGED
@@ -73,7 +73,7 @@ Opt-in Status,Opt-in Status
73
  "Magento fields","Magento fields"
74
  "Mailup fields","Mailup fields"
75
  "Fields mapping","Map Fields"
76
- Filters,"Segment Customers"
77
  "By this plugin you can import contacts registered in your eCommerce in the MailUp platform.","Create custom segments using the filters below and easily transfer them to a new or existing Group in your MailUp account."
78
  "Web service username is not in the right format","Web service username is not in the right format, it should be the a letter followed by some numbers (eg: a12345)"
79
  "Please fill the admin console URL","Please fill the admin console URL"
@@ -81,4 +81,7 @@ Filters,"Segment Customers"
81
  "Unable to connect to MailUp console","Unable to connect to your MailUp account"
82
  "Your subscription is waiting for confirmation","Your subscription to the newsletter is waiting for confirmation, please check your email and click the confirmation link"
83
  "MailUp configuration is not complete", "MailUp configuration is not complete, please <a href=''>click here</a> to fill the missing information"
84
- "MailUp fields mapping is not complete","MailUp fields mapping is not complete, please <a href=''>click here</a> to fill the missing information"
 
 
 
73
  "Magento fields","Magento fields"
74
  "Mailup fields","Mailup fields"
75
  "Fields mapping","Map Fields"
76
+ Filters,"Sync/segment Customers"
77
  "By this plugin you can import contacts registered in your eCommerce in the MailUp platform.","Create custom segments using the filters below and easily transfer them to a new or existing Group in your MailUp account."
78
  "Web service username is not in the right format","Web service username is not in the right format, it should be the a letter followed by some numbers (eg: a12345)"
79
  "Please fill the admin console URL","Please fill the admin console URL"
81
  "Unable to connect to MailUp console","Unable to connect to your MailUp account"
82
  "Your subscription is waiting for confirmation","Your subscription to the newsletter is waiting for confirmation, please check your email and click the confirmation link"
83
  "MailUp configuration is not complete", "MailUp configuration is not complete, please <a href=''>click here</a> to fill the missing information"
84
+ "MailUp fields mapping is not complete","MailUp fields mapping is not complete, please <a href=''>click here</a> to fill the missing information"
85
+ "Filtered customers preview","Filtered customers preview (max 25)"
86
+ "Members have been sent correctly","Customers segmented successfully. The data export to MailUp will start within 5 minutes. The duration of the export process depends on the total amount of data being transferred."
87
+ "A MailUp import process is schedules and will be executed soon.","A MailUp import process is scheduled and will be executed soon."
app/locale/it_IT/SevenLike_MailUp.csv CHANGED
@@ -1,4 +1,4 @@
1
- "Members have been sent correctly","Gli iscritti sono stati inviati correttamente"
2
  "Warning: no member has been selected","Attenzione: non hai inviato nessun iscritto"
3
  "WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp","ATTENZIONE: prima di procedere devi configurare correttamente i parametri per accedere a MailUp in Sistema->Configurazione->Newsletter->MailUp"
4
  "Apply filter","Applica filtro"
@@ -72,7 +72,7 @@
72
  "Opt-in Status","Iscrizione alla newsletter"
73
  "Associate all Magento fields with MailUp ones","Associa i campi Magento con quelli MailUp"
74
  "Fields mapping","Mappa campi"
75
- "Filters","Segmenta clienti"
76
  "It's the domain portion of the browser address field when you using the MailUp Admin console (e.g. g4a0.s03.it)","E' il solo nome di dominio, visualizzato nella barra degli indirizzi del browser mentre stai navigando la console di mailup (es: g4a0.s03.it)"
77
  "Export Frequency","Frequenza di esportazione"
78
  "Enable Automatic Data Export to MailUp","Abilita l'export automatico dei dati verso MailUp"
@@ -95,4 +95,12 @@
95
  "MailUp configuration is not complete", "La configurazione di MailUp non è completa, <a href=''>clicca qui</a> per digitare le informazioni mancanti"
96
  "MailUp fields mapping is not complete","La mappatura dei campi MailUp non è completa, <a href=''>clicca qui</a> per digitare le informazioni mancanti"
97
  "Connect to MailUp","Connetti a MailUp"
98
- "For assistance visit help.mailup.com and search for ""API credentials""","Per assistenza visita help.mailup.com e cerca ""credenziali API"""
 
 
 
 
 
 
 
 
1
+ "Members have been sent correctly","Segmentazione completata con successo. L'esportazione verso MailUp verra' attivata nei prossimi 5 minuti. La durata totale dell'esportazione dipende dal volume dei dati trasferiti."
2
  "Warning: no member has been selected","Attenzione: non hai inviato nessun iscritto"
3
  "WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp","ATTENZIONE: prima di procedere devi configurare correttamente i parametri per accedere a MailUp in Sistema->Configurazione->Newsletter->MailUp"
4
  "Apply filter","Applica filtro"
72
  "Opt-in Status","Iscrizione alla newsletter"
73
  "Associate all Magento fields with MailUp ones","Associa i campi Magento con quelli MailUp"
74
  "Fields mapping","Mappa campi"
75
+ "Filters","Sincronizza/segmenta clienti"
76
  "It's the domain portion of the browser address field when you using the MailUp Admin console (e.g. g4a0.s03.it)","E' il solo nome di dominio, visualizzato nella barra degli indirizzi del browser mentre stai navigando la console di mailup (es: g4a0.s03.it)"
77
  "Export Frequency","Frequenza di esportazione"
78
  "Enable Automatic Data Export to MailUp","Abilita l'export automatico dei dati verso MailUp"
95
  "MailUp configuration is not complete", "La configurazione di MailUp non è completa, <a href=''>clicca qui</a> per digitare le informazioni mancanti"
96
  "MailUp fields mapping is not complete","La mappatura dei campi MailUp non è completa, <a href=''>clicca qui</a> per digitare le informazioni mancanti"
97
  "Connect to MailUp","Connetti a MailUp"
98
+ "For assistance visit help.mailup.com and search for ""API credentials""","Per assistenza visita help.mailup.com e cerca ""credenziali API"""
99
+ "View data transfer log","Log di trasferimento dati"
100
+ "Enable subscription checkbox during checkout","Abilita la checkbox di iscrizione alla newsletter in fase di checkout"
101
+ "Send opt-in email to new subscribers","Invia richiesta conferma iscrizione a nuovi iscritti"
102
+ "Next step","Prossimo passo"
103
+ "Filtered customers preview","Anteprima dei clienti filtrati (max 25)"
104
+ "A MailUp import process is running.","L'importazione verso MailUp è in esecuzione."
105
+ "A MailUp import process is schedules and will be executed soon.","L'importazione verso MailUp è schedulata e inizierà a breve."
106
+ "Please wait for the next step to load","Attendere il caricamento della prossima schermata"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MailUp</name>
4
- <version>2.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
@@ -47,20 +47,16 @@
47
  &lt;p&gt;&lt;br /&gt;Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&amp;agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.&lt;/p&gt;</description>
48
  <notes>Changelog:&lt;br /&gt;&#xD;
49
  &lt;ul&gt;&#xD;
50
- &lt;li&gt;timezones are now correctly handled by the whole extention&lt;/li&gt;&#xD;
51
- &lt;li&gt;users in "waiting for confirmation email" state are now correctly handled&lt;/li&gt;&#xD;
52
- &lt;li&gt;Magento's backend menu has was reorganized&lt;/li&gt;&#xD;
53
- &lt;li&gt;a console url validation check was added upon system configuration save&lt;/li&gt;&#xD;
54
- &lt;li&gt;upon loggin to the Magento's backend (or system configuration save) a configuration check is done, if MailUp isn't completely configured (system configurations and fields mapping) than an alert message is shown&lt;/li&gt;&#xD;
55
- &lt;li&gt;Magento's category multilevel hierarchy is now fully supported&lt;/li&gt;&#xD;
56
- &lt;li&gt;if an error occour during the connection to the MailUp console a warning is shown (a timeout was also added)&lt;/li&gt;&#xD;
57
- &lt;li&gt;PHP short tags were completely removed&lt;/li&gt;&#xD;
58
- &lt;li&gt;better and more complete translations (English and Italian)&lt;/li&gt;&#xD;
59
  &lt;/ul&gt;</notes>
60
  <authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
61
- <date>2012-11-19</date>
62
- <time>2012-11-19</time>
63
- <contents><target name="magelocal"><dir name="SevenLike"><dir name="MailUp"><dir name="Block"><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="a1d905b6a591f087c5debb04d5ee0e22"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="6883a8ed591fb256b13452a1c95571f9"/><file name="Hours.php" hash="a29b9482b58cd4d492535323e957e74e"/></dir></dir></dir></dir><file name="Consoleurlvalidator.php" hash="445cea54aeca48b1e6197d85d0dfe524"/><file name="Cron.php" hash="f31ff2354048584e37abb89bde87aea2"/><file name="Lists.php" hash="d014f01fc68f5982fd8e0a7d6eb540ea"/><file name="MailUp.php" hash="fee7ff035654ad08c9c88a8fbf95089d"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="0b655573c6ed02bb67d7ff9241a1fd73"/></dir><file name="MailUp.php" hash="5a261952db1cedf7cdc7888e2ced7e16"/></dir><file name="Observer.php" hash="c31e39e4c1bffdeea30496073f6a8559"/><file name="Webserviceusernamevalidator.php" hash="f6cbe6394f685a93206ace6ed33ff2fa"/><file name="Ws.php" hash="8acfb46468c1017d4e9aabe4d1aa6751"/><file name="Wssend.php" hash="2d70b7faeea405ec2e3a9654aff66005"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigurationController.php" hash="a2c9df0f275cd9da036dc96311d1c8d1"/><file name="FieldsmappingController.php" hash="328e6d87338a7ce50894ade00e35ffb2"/><file name="FilterController.php" hash="079f76269091e357b601193c85ff9ccd"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="e447b775d738780688bceb1ced65df99"/><file name="system.xml" hash="8069c84eff5793611bed992a449b7afa"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="43f2d3f43e10d493e748a6732bb4f5c5"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="43f2d3f43e10d493e748a6732bb4f5c5"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="0a6a28082e3d589cf32516b44bcd9408"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="4ab5fd71fbc9ba8e6cce8e974bfed2fc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sevenlike"><dir name="mailup"><file name="confirm.phtml" hash="a9a1c5321128d85e8a058503846bf225"/><file name="fieldsmapping.phtml" hash="ab91a8f0b1598f6e8dadda6db51c4d33"/><file name="filter.phtml" hash="670298be6739e1348927eaa48385cd02"/></dir></dir></dir><dir name="layout"><file name="mailup.xml" hash="37a171055aedfb552cb261dede1e0037"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SevenLike_MailUp.xml" hash="8377b55193e7524ca9572ed4dc2dca62"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sevenlike"><dir name="mailup"><dir name="images"><file name="titoli.png" hash="95a7996cd77d3413fd048018095aec6e"/></dir><file name="mailup.css" hash="37febcfd87a78148d5962da507c62ecc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="a8a36f24e143da813d3fb796c8d1279f"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="e11364be0090dd0ef49543f9edc421d6"/></dir></target></contents>
64
  <compatible/>
65
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
66
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MailUp</name>
4
+ <version>2.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
47
  &lt;p&gt;&lt;br /&gt;Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&amp;agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.&lt;/p&gt;</description>
48
  <notes>Changelog:&lt;br /&gt;&#xD;
49
  &lt;ul&gt;&#xD;
50
+ &lt;li&gt;you can now show the subscription checkbox during checkout&lt;/li&gt;&#xD;
51
+ &lt;li&gt;MailUp webhooks are now supported to manage realtime subscribe/unsubscribe&lt;/li&gt;&#xD;
52
+ &lt;li&gt;incremental sync was implemented, so that now only modified users are transferred to mailup during scheduled transmissions&lt;/li&gt;&#xD;
53
+ &lt;li&gt;logs can now be disabled&lt;/li&gt;&#xD;
54
+ &lt;li&gt;small interface tweeks&lt;/li&gt;&#xD;
 
 
 
 
55
  &lt;/ul&gt;</notes>
56
  <authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
57
+ <date>2013-03-22</date>
58
+ <time>2013-03-22</time>
59
+ <contents><target name="magelocal"><dir name="SevenLike"><dir name="MailUp"><dir name="Block"><dir name="Checkout"><file name="Subscribe.php" hash="ccfe2351962ae4aa4c2962cee2e8e1af"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Helper"><file name="Data.php" hash="678302968f4aa70cdb06aaebb66d97b6"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="6883a8ed591fb256b13452a1c95571f9"/><file name="Hours.php" hash="a29b9482b58cd4d492535323e957e74e"/></dir></dir></dir></dir><file name="Consoleurlvalidator.php" hash="445cea54aeca48b1e6197d85d0dfe524"/><file name="Cron.php" hash="f79da19fe6ef26bf6f261ad6bfb75ae1"/><file name="Lists.php" hash="c226fd4e9facd46bfc95c8d55adeffd5"/><file name="MailUp.php" hash="eb0517043c0dddcc22f2bd6c9c2bb27c"/><file name="MailUpWsImport.php" hash="1d2cbcf20bfa2b2a0f883f631fb7faec"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="0b655573c6ed02bb67d7ff9241a1fd73"/></dir><file name="MailUp.php" hash="5a261952db1cedf7cdc7888e2ced7e16"/></dir><file name="Observer.php" hash="4b373a553ce4e77cd2282904469d4b80"/><file name="Webserviceusernamevalidator.php" hash="f6cbe6394f685a93206ace6ed33ff2fa"/><file name="Ws.php" hash="c61719e82030d4117ff2badbed12ff43"/><file name="Wssend.php" hash="7e7e53d76085ab1f2085d3f719ae44f5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigurationController.php" hash="2172562c17ac532894faf5e77ca9c9e0"/><file name="FieldsmappingController.php" hash="99b01856290d58f1b0f2d0f9f2c0389a"/><file name="FilterController.php" hash="fe56870180812ae67d01d3fc14e55da1"/><file name="ViewdatatransferlogController.php" hash="b6fd65804c91b8386a10579dc1d6cf1e"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name="WebhookController.php" hash="52369ec7a70c7245e55bf215d1bee187"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="84f63ba6b1bbb746ccec809b1dc3771f"/><file name="system.xml" hash="7e68ebaf83dfe2b3201f775eaf0f66ea"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="43f2d3f43e10d493e748a6732bb4f5c5"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="43f2d3f43e10d493e748a6732bb4f5c5"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="0a6a28082e3d589cf32516b44bcd9408"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="4ab5fd71fbc9ba8e6cce8e974bfed2fc"/><file name="mysql4-upgrade-2.1.3-2.2.0.php" hash="577c0690622460d5ebb8d5df35bab9db"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sevenlike"><dir name="mailup"><file name="confirm.phtml" hash="32a6593e1692c5596fffea44723c94b0"/><file name="fieldsmapping.phtml" hash="ea1f418f8cb7fb2a842b091562296417"/><file name="filter.phtml" hash="9efaec8fa3e1a44b36127113274a90dd"/><file name="viewdatatransferlog.phtml" hash="746289040d75fef7b4d61bba560e294c"/></dir></dir></dir><dir name="layout"><file name="mailup.xml" hash="ab6fbb5efccb497cfd9a3721ecc161a9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SevenLike_MailUp.xml" hash="8377b55193e7524ca9572ed4dc2dca62"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="sevenlike"><dir name="mailup"><dir name="images"><file name="titoli.png" hash="95a7996cd77d3413fd048018095aec6e"/></dir><file name="mailup.css" hash="5be195046fd49a2ade184a10786a5a58"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="f411a2106aab75fac44c681fd7ba995e"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="c5bf7b0d7c9951153ec355bd9e1be6aa"/></dir></target></contents>
60
  <compatible/>
61
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
62
  </package>
skin/adminhtml/default/default/sevenlike/mailup/images/titoli.png CHANGED
File without changes
skin/adminhtml/default/default/sevenlike/mailup/mailup.css CHANGED
@@ -16,4 +16,6 @@ td.labelpg1 { width: 170px; }
16
  .istrz1 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; }
17
  .istrz2 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; margin: 0 0 20px 0; }
18
  input, select { margin-bottom: 5px; }
19
- span.tip { font-style: italic; }
 
 
16
  .istrz1 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; }
17
  .istrz2 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; margin: 0 0 20px 0; }
18
  input, select { margin-bottom: 5px; }
19
+ span.tip { font-style: italic; }
20
+
21
+ .mailuploading {display:none;padding-left:20px;float:right;background:url(data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==) top left no-repeat;}