MailUp - Version 2.0.0

Version Notes

Changelog:


  • Automatic synchronization (via customizable Magento crons) of all customers/subscribers with a new "MAGENTO" group in the selected list.

Download this release

Release Info

Developer Sevenlike
Extension MailUp
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.5.5 to 2.0.0

app/code/local/SevenLike/MailUp/Helper/Data.php CHANGED
@@ -199,5 +199,151 @@ class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract {
199
}
200
return '';
201
}
202
- }
203
- ?>
199
}
200
return '';
201
}
202
+
203
+ public function generateAndSendCustomers($mailupCustomerIds, $post = null)
204
+ {
205
+ $MailUpWsSend = Mage::getModel('mailup/wssend');
206
+ $wsSend = new MailUpWsSend();
207
+ $MailUpWsSend = Mage::getModel('mailup/ws');
208
+ $wsImport = new MailUpWsImport();
209
+ $accessKey = $wsSend->loginFromId();
210
+
211
+ if (empty($mailupCustomerIds)) return false;
212
+ if ($post === null) {
213
+ // chiamata da cron, popolo con i dati del gruppo "magento" di default
214
+ $post['mailupIdList'] = Mage::getStoreConfig('newsletter/mailup/list');
215
+
216
+ $tmp = new SevenLike_MailUp_Model_Lists;
217
+ $tmp = $tmp->toOptionArray();
218
+ foreach ($tmp as $t) {
219
+ if ($t["value"] == $post['mailupIdList']) {
220
+ $post['mailupListGUID'] = $t["guid"];
221
+ $post["groups"] = $t["groups"];
222
+ break;
223
+ }
224
+ }
225
+ unset($tmp); unset($t);
226
+
227
+ $post['mailupGroupId'] = "";
228
+ foreach ($post["groups"] as $tmp_id_group=>$tmp_group_name) {
229
+ if ($tmp_group_name == "MAGENTO") {
230
+ $post['mailupGroupId'] = $tmp_id_group;
231
+ break;
232
+ }
233
+ }
234
+ unset($tmp_id_group); unset($tmp_group_name);
235
+
236
+ if (!strlen($post['mailupGroupId'])) {
237
+ $newGroup = array(
238
+ "idList" => $post['mailupIdList'],
239
+ "listGUID" => $post['mailupListGUID'],
240
+ "newGroupName" => "MAGENTO"
241
+ );
242
+
243
+ $post['mailupGroupId'] = $wsImport->CreaGruppo($newGroup);
244
+ }
245
+ }
246
+
247
+ $customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
248
+
249
+ if ($accessKey === false) {
250
+ Mage::throwException('no access key returned');
251
+ }
252
+ $fields = $wsSend->GetFields($accessKey);
253
+ $fields_mapping = $wsImport->getFieldsMapping();
254
+
255
+ //preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
256
+ $xmlData = '<subscribers>';
257
+ foreach ($mailupCustomerIds as $customerId) {
258
+ $tmp = array();
259
+ $subscriber = $customersData[$customerId['email']];
260
+ $xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name="">';
261
+
262
+ if (@$fields_mapping["Name"]) $tmp[$fields_mapping["Name"]] = '<campo'.$fields_mapping["Name"].'>'. ((!empty($subscriber['nome'])) ? $subscriber['nome'] : '') .'</campo'.$fields_mapping["Name"].'>';
263
+ if (@$fields_mapping["Last"]) $tmp[$fields_mapping["Last"]] = '<campo'.$fields_mapping["Last"].'>'. ((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'</campo'.$fields_mapping["Last"].'>';
264
+
265
+ foreach ($subscriber as $k=>$v) {
266
+ if (!strlen($subscriber[$k])) $subscriber[$k] = "-";
267
+ }
268
+
269
+ if (@$fields_mapping["Company"]) $tmp[$fields_mapping["Company"]] = '<campo'.$fields_mapping["Company"].'>'. $subscriber['azienda'] .'</campo'.$fields_mapping["Company"].'>';
270
+ if (@$fields_mapping["City"]) $tmp[$fields_mapping["City"]] = '<campo'.$fields_mapping["City"].'>'. $subscriber['città'] .'</campo'.$fields_mapping["City"].'>';
271
+ if (@$fields_mapping["Province"]) $tmp[$fields_mapping["Province"]] = '<campo'.$fields_mapping["Province"].'>'. $subscriber['provincia'] .'</campo'.$fields_mapping["Province"].'>';
272
+ if (@$fields_mapping["ZIP"]) $tmp[$fields_mapping["ZIP"]] = '<campo'.$fields_mapping["ZIP"].'>'. $subscriber['cap'].'</campo'.$fields_mapping["ZIP"].'>';
273
+ if (@$fields_mapping["Region"]) $tmp[$fields_mapping["Region"]] = '<campo'.$fields_mapping["Region"].'>'. $subscriber['regione'] .'</campo'.$fields_mapping["Region"].'>';
274
+ if (@$fields_mapping["Country"]) $tmp[$fields_mapping["Country"]] = '<campo'.$fields_mapping["Country"].'>'. $subscriber['paese'] .'</campo'.$fields_mapping["Country"].'>';
275
+ if (@$fields_mapping["Address"]) $tmp[$fields_mapping["Address"]] = '<campo'.$fields_mapping["Address"].'>'. $subscriber['indirizzo'] .'</campo'.$fields_mapping["Address"].'>';
276
+ if (@$fields_mapping["Fax"]) $tmp[$fields_mapping["Fax"]] = '<campo'.$fields_mapping["Fax"].'>'. $subscriber['fax'] .'</campo'.$fields_mapping["Fax"].'>';
277
+ if (@$fields_mapping["Phone"]) $tmp[$fields_mapping["Phone"]] = '<campo'.$fields_mapping["Phone"].'>'. $subscriber['telefono'] .'</campo'.$fields_mapping["Phone"].'>';
278
+ if (@$fields_mapping["CustomerID"]) $tmp[$fields_mapping["CustomerID"]] = '<campo'.$fields_mapping["CustomerID"].'>'. $subscriber['IDCliente'] .'</campo'.$fields_mapping["CustomerID"].'>';
279
+ if (@$fields_mapping["LatestOrderID"]) $tmp[$fields_mapping["LatestOrderID"]] = '<campo'.$fields_mapping["LatestOrderID"].'>'. $subscriber['IDUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderID"].'>';
280
+ if (@$fields_mapping["LatestOrderDate"]) $tmp[$fields_mapping["LatestOrderDate"]] = '<campo'.$fields_mapping["LatestOrderDate"].'>'. $subscriber['DataUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderDate"].'>';
281
+ if (@$fields_mapping["LatestOrderAmount"]) $tmp[$fields_mapping["LatestOrderAmount"]] = '<campo'.$fields_mapping["LatestOrderAmount"].'>'. $subscriber['TotaleUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderAmount"].'>';
282
+ if (@$fields_mapping["LatestOrderProductIDs"]) $tmp[$fields_mapping["LatestOrderProductIDs"]] = '<campo'.$fields_mapping["LatestOrderProductIDs"].'>'. $subscriber['IDProdottiUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderProductIDs"].'>';
283
+ if (@$fields_mapping["LatestOrderCategoryIDs"]) $tmp[$fields_mapping["LatestOrderCategoryIDs"]] = '<campo'.$fields_mapping["LatestOrderCategoryIDs"].'>'. $subscriber['IDCategorieUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderCategoryIDs"].'>';
284
+ if (@$fields_mapping["LatestShippedOrderDate"]) $tmp[$fields_mapping["LatestShippedOrderDate"]] = '<campo'.$fields_mapping["LatestShippedOrderDate"].'>'. $subscriber['DataUltimoOrdineSpedito'] .'</campo'.$fields_mapping["LatestShippedOrderDate"].'>';
285
+ if (@$fields_mapping["LatestShippedOrderID"]) $tmp[$fields_mapping["LatestShippedOrderID"]] = '<campo'.$fields_mapping["LatestShippedOrderID"].'>'. $subscriber['IDUltimoOrdineSpedito'] .'</campo'.$fields_mapping["LatestShippedOrderID"].'>';
286
+ if (@$fields_mapping["LatestAbandonedCartDate"]) $tmp[$fields_mapping["LatestAbandonedCartDate"]] = '<campo'.$fields_mapping["LatestAbandonedCartDate"].'>'. $subscriber['DataCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartDate"].'>';
287
+ if (@$fields_mapping["LatestAbandonedCartTotal"]) $tmp[$fields_mapping["LatestAbandonedCartTotal"]] = '<campo'.$fields_mapping["LatestAbandonedCartTotal"].'>'. $subscriber['TotaleCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartTotal"].'>';
288
+ if (@$fields_mapping["LatestAbandonedCartID"]) $tmp[$fields_mapping["LatestAbandonedCartID"]] = '<campo'.$fields_mapping["LatestAbandonedCartID"].'>'. $subscriber['IDCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartID"].'>';
289
+ if (@$fields_mapping["TotalOrdered"]) $tmp[$fields_mapping["TotalOrdered"]] = '<campo'.$fields_mapping["TotalOrdered"].'>'. $subscriber['TotaleFatturato'] .'</campo'.$fields_mapping["TotalOrdered"].'>';
290
+ if (@$fields_mapping["TotalOrderedLast12m"]) $tmp[$fields_mapping["TotalOrderedLast12m"]] = '<campo'.$fields_mapping["TotalOrderedLast12m"].'>'. $subscriber['TotaleFatturatoUltimi12Mesi'] .'</campo'.$fields_mapping["TotalOrderedLast12m"].'>';
291
+ if (@$fields_mapping["TotalOrderedLast30d"]) $tmp[$fields_mapping["TotalOrderedLast30d"]] = '<campo'.$fields_mapping["TotalOrderedLast30d"].'>'. $subscriber['TotaleFatturatoUltimi30gg'] .'</campo'.$fields_mapping["TotalOrderedLast30d"].'>';
292
+ if (@$fields_mapping["AllOrderedProductIDs"]) $tmp[$fields_mapping["AllOrderedProductIDs"]] = '<campo'.$fields_mapping["AllOrderedProductIDs"].'>'. $subscriber['IDTuttiProdottiAcquistati'] .'</campo'.$fields_mapping["AllOrderedProductIDs"].'>';
293
+
294
+ $last_field = max(array_keys($tmp));
295
+ for ($i=1; $i<$last_field; $i++) {
296
+ if (!isset($tmp[$i])) $tmp[$i] = "<campo{$i}>-</campo{$i}>";
297
+ }
298
+ ksort($tmp);
299
+ $tmp = implode("", $tmp);
300
+ $xmlData .= $tmp;
301
+ $xmlData .= "</subscriber>\n";
302
+ }
303
+ $xmlData .= '</subscribers>';
304
+
305
+ Mage::log($xmlData, 0);
306
+
307
+ //definisco il gruppo a cui aggiungere gli iscritti
308
+ $groupId = $post['mailupGroupId'];
309
+ $listGUID = $post['mailupListGUID'];
310
+ $idList = $post['mailupIdList'];
311
+
312
+ if ($post['mailupNewGroup'] == 1) {
313
+ $newGroup = array(
314
+ "idList" => $idList,
315
+ "listGUID" => $listGUID,
316
+ "newGroupName" => $post['mailupNewGroupName']
317
+ );
318
+
319
+ $groupId = $wsImport->CreaGruppo($newGroup);
320
+ }
321
+
322
+ $importProcessData = array(
323
+ "idList" => $idList,
324
+ "listGUID" => $listGUID,
325
+ "idGroup" => $groupId,
326
+ "xmlDoc" => $xmlData,
327
+ "idGroups" => $groupId,
328
+ "importType" => "3",
329
+ "mobileInputType" => "2",
330
+ "asPending" => "0",
331
+ "ConfirmEmail" => "0",
332
+ "asOptOut" => "0",
333
+ "forceOptIn" => "0",
334
+ "replaceGroups" => "0",
335
+ "idConfirmNL" => "0"
336
+ );
337
+
338
+ //avvio l'importazione su mailup
339
+ $processID = $wsImport->newImportProcess($importProcessData);
340
+
341
+ $process = array(
342
+ "idList" => $post['mailupIdList'],
343
+ "listGUID" => $post['mailupListGUID'],
344
+ "idProcess" => $processID
345
+ );
346
+
347
+ $wsImport->startProcess($process);
348
+ }
349
+ }
app/code/local/SevenLike/MailUp/Model/Cron.php CHANGED
@@ -1,59 +1,28 @@
1
<?php
2
- //ini_set('soap.wsdl_cache_enabled', '0');
3
4
class SevenLike_MailUp_Model_Cron {
5
6
public function run() {
7
- //echo 'lanciato';
8
Mage::log('Cron mailup', 0);
9
10
if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1) {
11
Mage::log('Cron export enabled', 0);
12
-
13
require_once(dirname(__FILE__) . '/../Helper/Data.php');
14
- self::saveToCsv(SevenLike_MailUp_Helper_Data::getCustomersData());
15
-
16
-
17
-
18
} else {
19
Mage::log('Cron export not enabled', 0);
20
}
21
22
Mage::log('Cron mailup terminato', 0);
23
}
24
-
25
- /*
26
- public function oldRun() {
27
- //echo 'lanciato';
28
- Mage::log('Cron mailup', 0);
29
- if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1) {
30
- Mage::log('Cron export enabled', 0);
31
-
32
- $MailUpWsImport = Mage::getModel('mailup/ws');
33
- $wsImport = new MailUpWsImport();
34
-
35
- require_once(dirname(__FILE__) . '/../Helper/Data.php');
36
- self::saveToCsv(SevenLike_MailUp_Helper_Data::getCustomersData());
37
- } else {
38
- Mage::log('Cron export not enabled', 0);
39
- }
40
-
41
- Mage::log('Cron mailup terminato', 0);
42
- }
43
-
44
- public function saveToCsv($toSave) {
45
- Mage::log('Cron: saving csv', 0);
46
- $file = '"Nome";"Cognome";"Email";"Data Registrazione";"Iscritto";"Azienda";"Codice paese";"Data ultimo ordine";"Totale ultimo ordine";"ID prodotti ultimo ordine";"ID Categorie ultimo ordine";"Totale fatturato";"Data carrello abbandonato";"Totale carrello abbandonato"';
47
- foreach ($toSave as $subscriber) {
48
- Mage::log($subscriber, 0);
49
- $file .= "\n";
50
- $file .= '"'.$subscriber['nome'].'";"'.$subscriber['cognome'].'";"'.$subscriber['email'].'";"'.$subscriber['registeredDate'].'";"'.$subscriber['subscribed'].'";"'.$subscriber['azienda'].'";"'.$subscriber['paese'].'";"'.$subscriber['dateLastOrder'].'";"'.$subscriber['totalLastOrder'].'";"'.$subscriber['productIds'].'";"'.$subscriber['categoryIds'].'";"'.$subscriber['totalOrders'].'";"'.$subscriber['dateCart'].'";"'.$subscriber['totalCart'].'"';
51
- }
52
-
53
- //Mage::log(Mage::getBaseDir('base').'/slMailupSubscribers.csv', null, 'danielePath.log');
54
- $csv = fopen(Mage::getBaseDir('media').'/slMailupSubscribers.csv', 'w');
55
- fwrite($csv, $file);
56
- fclose($csv);
57
- } */
58
-
59
}
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
+ $mailupCustomerIds[] = array(
16
+ "entity_id" => $tmp["IDCliente"],
17
+ "email" => $tmp["email"]
18
+ );
19
+ }
20
+
21
+ SevenLike_MailUp_Helper_Data::generateAndSendCustomers($mailupCustomerIds);
22
} else {
23
Mage::log('Cron export not enabled', 0);
24
}
25
26
Mage::log('Cron mailup terminato', 0);
27
}
28
}
app/code/local/SevenLike/MailUp/Model/Lists.php CHANGED
@@ -12,12 +12,16 @@ class SevenLike_MailUp_Model_Lists {
12
$selectLists = array();
13
14
if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/username_ws') && Mage::getStoreConfig('newsletter/mailup/password_ws')) {
15
- $MailUpWsSend = Mage::getModel('mailup/wssend');
16
$wsSend = new MailUpWsSend();
17
$accessKey = $wsSend->loginFromId();
18
19
if ($accessKey !== false) {
20
- $MailUpWsImport = Mage::getModel('mailup/ws');
21
$wsImport = new MailUpWsImport();
22
23
$xmlString = $wsImport->GetNlList();
@@ -39,7 +43,11 @@ class SevenLike_MailUp_Model_Lists {
39
40
$count = 1;
41
foreach ($xml->List as $list) {
42
- $selectLists[$count] = array('value' => $list['idList'], 'label'=> $list['listName']);
43
$count++;
44
}
45
}
12
$selectLists = array();
13
14
if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/username_ws') && Mage::getStoreConfig('newsletter/mailup/password_ws')) {
15
+ if (!class_exists("MailUpWsSend")) {
16
+ $MailUpWsSend = Mage::getModel('mailup/wssend');
17
+ }
18
$wsSend = new MailUpWsSend();
19
$accessKey = $wsSend->loginFromId();
20
21
if ($accessKey !== false) {
22
+ if (!class_exists("MailUpWsImport")) {
23
+ $MailUpWsImport = Mage::getModel('mailup/ws');
24
+ }
25
$wsImport = new MailUpWsImport();
26
27
$xmlString = $wsImport->GetNlList();
43
44
$count = 1;
45
foreach ($xml->List as $list) {
46
+ $groups = array();
47
+ foreach ($list->Groups->Group as $tmp) {
48
+ $groups[(string)$tmp["idGroup"]] = (string)$tmp["groupName"];
49
+ }
50
+ $selectLists[$count] = array('value' => (string)$list['idList'], 'label'=> (string)$list['listName'], 'guid'=>(string)$list['listGUID'], "groups"=>$groups);
51
$count++;
52
}
53
}
app/code/local/SevenLike/MailUp/Model/Wssend.php CHANGED
@@ -301,5 +301,4 @@ class MailUpWsSend {
301
return $client->Method1('x12qaq','c56tf3');
302
}
303
304
- }
305
- ?>
301
return $client->Method1('x12qaq','c56tf3');
302
}
303
304
+ }
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php CHANGED
@@ -90,117 +90,8 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
90
}
91
92
$mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
93
-
94
- //require_once(dirname(__FILE__) . '/../Helper/Data.php');
95
- $customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
96
-
97
- $MailUpWsSend = Mage::getModel('mailup/wssend');
98
- $wsSend = new MailUpWsSend();
99
- $MailUpWsSend = Mage::getModel('mailup/ws');
100
- $wsImport = new MailUpWsImport();
101
- $accessKey = $wsSend->loginFromId();
102
-
103
- if ($accessKey === false) {
104
- Mage::throwException('no access key returned');
105
- }
106
- $fields = $wsSend->GetFields($accessKey);
107
- $fields_mapping = $wsImport->getFieldsMapping();
108
-
109
- //preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
110
- $xmlData = '<subscribers>';
111
- foreach ($mailupCustomerIds as $customerId) {
112
- $tmp = array();
113
- $subscriber = $customersData[$customerId['email']];
114
- $xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name="">';
115
-
116
- if (@$fields_mapping["Name"]) $tmp[$fields_mapping["Name"]] = '<campo'.$fields_mapping["Name"].'>'. ((!empty($subscriber['nome'])) ? $subscriber['nome'] : '') .'</campo'.$fields_mapping["Name"].'>';
117
- if (@$fields_mapping["Last"]) $tmp[$fields_mapping["Last"]] = '<campo'.$fields_mapping["Last"].'>'. ((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'</campo'.$fields_mapping["Last"].'>';
118
-
119
- foreach ($subscriber as $k=>$v) {
120
- if (!strlen($subscriber[$k])) $subscriber[$k] = "-";
121
- }
122
-
123
- if (@$fields_mapping["Company"]) $tmp[$fields_mapping["Company"]] = '<campo'.$fields_mapping["Company"].'>'. $subscriber['azienda'] .'</campo'.$fields_mapping["Company"].'>';
124
- if (@$fields_mapping["City"]) $tmp[$fields_mapping["City"]] = '<campo'.$fields_mapping["City"].'>'. $subscriber['città'] .'</campo'.$fields_mapping["City"].'>';
125
- if (@$fields_mapping["Province"]) $tmp[$fields_mapping["Province"]] = '<campo'.$fields_mapping["Province"].'>'. $subscriber['provincia'] .'</campo'.$fields_mapping["Province"].'>';
126
- if (@$fields_mapping["ZIP"]) $tmp[$fields_mapping["ZIP"]] = '<campo'.$fields_mapping["ZIP"].'>'. $subscriber['cap'].'</campo'.$fields_mapping["ZIP"].'>';
127
- if (@$fields_mapping["Region"]) $tmp[$fields_mapping["Region"]] = '<campo'.$fields_mapping["Region"].'>'. $subscriber['regione'] .'</campo'.$fields_mapping["Region"].'>';
128
- if (@$fields_mapping["Country"]) $tmp[$fields_mapping["Country"]] = '<campo'.$fields_mapping["Country"].'>'. $subscriber['paese'] .'</campo'.$fields_mapping["Country"].'>';
129
- if (@$fields_mapping["Address"]) $tmp[$fields_mapping["Address"]] = '<campo'.$fields_mapping["Address"].'>'. $subscriber['indirizzo'] .'</campo'.$fields_mapping["Address"].'>';
130
- if (@$fields_mapping["Fax"]) $tmp[$fields_mapping["Fax"]] = '<campo'.$fields_mapping["Fax"].'>'. $subscriber['fax'] .'</campo'.$fields_mapping["Fax"].'>';
131
- if (@$fields_mapping["Phone"]) $tmp[$fields_mapping["Phone"]] = '<campo'.$fields_mapping["Phone"].'>'. $subscriber['telefono'] .'</campo'.$fields_mapping["Phone"].'>';
132
- if (@$fields_mapping["CustomerID"]) $tmp[$fields_mapping["CustomerID"]] = '<campo'.$fields_mapping["CustomerID"].'>'. $subscriber['IDCliente'] .'</campo'.$fields_mapping["CustomerID"].'>';
133
- if (@$fields_mapping["LatestOrderID"]) $tmp[$fields_mapping["LatestOrderID"]] = '<campo'.$fields_mapping["LatestOrderID"].'>'. $subscriber['IDUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderID"].'>';
134
- if (@$fields_mapping["LatestOrderDate"]) $tmp[$fields_mapping["LatestOrderDate"]] = '<campo'.$fields_mapping["LatestOrderDate"].'>'. $subscriber['DataUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderDate"].'>';
135
- if (@$fields_mapping["LatestOrderAmount"]) $tmp[$fields_mapping["LatestOrderAmount"]] = '<campo'.$fields_mapping["LatestOrderAmount"].'>'. $subscriber['TotaleUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderAmount"].'>';
136
- if (@$fields_mapping["LatestOrderProductIDs"]) $tmp[$fields_mapping["LatestOrderProductIDs"]] = '<campo'.$fields_mapping["LatestOrderProductIDs"].'>'. $subscriber['IDProdottiUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderProductIDs"].'>';
137
- if (@$fields_mapping["LatestOrderCategoryIDs"]) $tmp[$fields_mapping["LatestOrderCategoryIDs"]] = '<campo'.$fields_mapping["LatestOrderCategoryIDs"].'>'. $subscriber['IDCategorieUltimoOrdine'] .'</campo'.$fields_mapping["LatestOrderCategoryIDs"].'>';
138
- if (@$fields_mapping["LatestShippedOrderDate"]) $tmp[$fields_mapping["LatestShippedOrderDate"]] = '<campo'.$fields_mapping["LatestShippedOrderDate"].'>'. $subscriber['DataUltimoOrdineSpedito'] .'</campo'.$fields_mapping["LatestShippedOrderDate"].'>';
139
- if (@$fields_mapping["LatestShippedOrderID"]) $tmp[$fields_mapping["LatestShippedOrderID"]] = '<campo'.$fields_mapping["LatestShippedOrderID"].'>'. $subscriber['IDUltimoOrdineSpedito'] .'</campo'.$fields_mapping["LatestShippedOrderID"].'>';
140
- if (@$fields_mapping["LatestAbandonedCartDate"]) $tmp[$fields_mapping["LatestAbandonedCartDate"]] = '<campo'.$fields_mapping["LatestAbandonedCartDate"].'>'. $subscriber['DataCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartDate"].'>';
141
- if (@$fields_mapping["LatestAbandonedCartTotal"]) $tmp[$fields_mapping["LatestAbandonedCartTotal"]] = '<campo'.$fields_mapping["LatestAbandonedCartTotal"].'>'. $subscriber['TotaleCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartTotal"].'>';
142
- if (@$fields_mapping["LatestAbandonedCartID"]) $tmp[$fields_mapping["LatestAbandonedCartID"]] = '<campo'.$fields_mapping["LatestAbandonedCartID"].'>'. $subscriber['IDCarrelloAbbandonato'] .'</campo'.$fields_mapping["LatestAbandonedCartID"].'>';
143
- if (@$fields_mapping["TotalOrdered"]) $tmp[$fields_mapping["TotalOrdered"]] = '<campo'.$fields_mapping["TotalOrdered"].'>'. $subscriber['TotaleFatturato'] .'</campo'.$fields_mapping["TotalOrdered"].'>';
144
- if (@$fields_mapping["TotalOrderedLast12m"]) $tmp[$fields_mapping["TotalOrderedLast12m"]] = '<campo'.$fields_mapping["TotalOrderedLast12m"].'>'. $subscriber['TotaleFatturatoUltimi12Mesi'] .'</campo'.$fields_mapping["TotalOrderedLast12m"].'>';
145
- if (@$fields_mapping["TotalOrderedLast30d"]) $tmp[$fields_mapping["TotalOrderedLast30d"]] = '<campo'.$fields_mapping["TotalOrderedLast30d"].'>'. $subscriber['TotaleFatturatoUltimi30gg'] .'</campo'.$fields_mapping["TotalOrderedLast30d"].'>';
146
- if (@$fields_mapping["AllOrderedProductIDs"]) $tmp[$fields_mapping["AllOrderedProductIDs"]] = '<campo'.$fields_mapping["AllOrderedProductIDs"].'>'. $subscriber['IDTuttiProdottiAcquistati'] .'</campo'.$fields_mapping["AllOrderedProductIDs"].'>';
147
-
148
- $last_field = max(array_keys($tmp));
149
- for ($i=1; $i<$last_field; $i++) {
150
- if (!isset($tmp[$i])) $tmp[$i] = "<campo{$i}>-</campo{$i}>";
151
- }
152
- ksort($tmp);
153
- $tmp = implode("", $tmp);
154
- $xmlData .= $tmp;
155
- $xmlData .= "</subscriber>\n";
156
- }
157
- $xmlData .= '</subscribers>';
158
-
159
- Mage::log($xmlData, 0);
160
-
161
- //definisco il gruppo a cui aggiungere gli iscritti
162
- $groupId = $post['mailupGroupId'];
163
- $listGUID = $post['mailupListGUID'];
164
- $idList = $post['mailupIdList'];
165
-
166
- if ($post['mailupNewGroup'] == 1) {
167
- $newGroup = array(
168
- "idList" => $idList,
169
- "listGUID" => $listGUID,
170
- "newGroupName" => $post['mailupNewGroupName']
171
- );
172
-
173
- $groupId = $wsImport->CreaGruppo($newGroup);
174
- }
175
-
176
- $importProcessData = array(
177
- "idList" => $idList,
178
- "listGUID" => $listGUID,
179
- "idGroup" => $groupId,
180
- "xmlDoc" => $xmlData,
181
- "idGroups" => $groupId,
182
- "importType" => "3",
183
- "mobileInputType" => "2",
184
- "asPending" => "0",
185
- "ConfirmEmail" => "0",
186
- "asOptOut" => "0",
187
- "forceOptIn" => "0",
188
- "replaceGroups" => "0",
189
- "idConfirmNL" => "0"
190
- );
191
-
192
- //avvio l'importazione su mailup
193
- $processID = $wsImport->newImportProcess($importProcessData);
194
-
195
- $process = array(
196
- "idList" => $post['mailupIdList'],
197
- "listGUID" => $post['mailupListGUID'],
198
- "idProcess" => $processID
199
- );
200
-
201
- $wsImport->startProcess($process);
202
-
203
- //echo $wsImport->getProcessDetail($process);
204
205
$message = $this->__('Members have been sent correctly');
206
Mage::getSingleton('adminhtml/session')->addSuccess($message);
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);
app/code/local/SevenLike/MailUp/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
<config>
4
<modules>
5
<SevenLike_MailUp>
6
- <version>1.5.5</version>
7
</SevenLike_MailUp>
8
</modules>
9
3
<config>
4
<modules>
5
<SevenLike_MailUp>
6
+ <version>1.5.6</version>
7
</SevenLike_MailUp>
8
</modules>
9
app/design/adminhtml/default/default/template/sevenlike/mailup/fieldsmapping.phtml CHANGED
@@ -15,10 +15,6 @@ if ($accessKey === false) {
15
// campi che arrivano da mailup
16
$wsFields = $wsSend->getFields($accessKey);
17
18
- if (! $wsFields) {
19
- echo '<p>'.$this->__('ERROR: cannot read fields mapping').'</p>';
20
- }
21
-
22
//carico i mapping salvati
23
$fields = $wsImport->getFieldsMapping();
24
?>
@@ -43,13 +39,11 @@ if ($accessKey === false) {
43
<select name="<?php echo $magentofield ?>" id="sl_<?php echo $magentofield ?>">
44
<option value=""></option>
45
<?php
46
- if ($wsFields) {
47
- foreach ($wsFields as $nome=>$id) {
48
- $selected = ($id == $fields[$magentofield]) ? "selected='selected'" : "";
49
- $nome = htmlspecialchars($nome);
50
- echo "<option value='$id' $selected>$nome</option>";
51
- }
52
- }
53
echo '</select>';
54
?>
55
</div>
15
// campi che arrivano da mailup
16
$wsFields = $wsSend->getFields($accessKey);
17
18
//carico i mapping salvati
19
$fields = $wsImport->getFieldsMapping();
20
?>
39
<select name="<?php echo $magentofield ?>" id="sl_<?php echo $magentofield ?>">
40
<option value=""></option>
41
<?php
42
+ foreach ($wsFields as $nome=>$id) {
43
+ $selected = ($id == $fields[$magentofield]) ? "selected='selected'" : "";
44
+ $nome = htmlspecialchars($nome);
45
+ echo "<option value='$id' $selected>$nome</option>";
46
+ }
47
echo '</select>';
48
?>
49
</div>
app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml CHANGED
@@ -409,8 +409,8 @@ if ($accessKey === false || strlen(Mage::getStoreConfig('newsletter/mailup/list'
409
</table>
410
</fieldset>
411
412
- <a href="<?=$this->getUrl('*/*/testCron')?>">TEST CRON</a>
413
- <a href="<?=$this->getUrl('*/*/testFields')?>">TEST GETFIELDS</a>
414
</div>
415
<script type="text/javascript">
416
var editForm = new varienForm('edit_form');
409
</table>
410
</fieldset>
411
412
+ <!--<a href="<?=$this->getUrl('*/*/testCron')?>">TEST CRON</a>
413
+ <a href="<?=$this->getUrl('*/*/testFields')?>">TEST GETFIELDS</a>-->
414
</div>
415
<script type="text/javascript">
416
var editForm = new varienForm('edit_form');
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>MailUp</name>
4
- <version>1.5.5</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,12 +47,12 @@
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;Addressed a bug related to php version under 5.3&lt;/li&gt;&#xD;
51
&lt;/ul&gt;</notes>
52
<authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
53
- <date>2012-05-31</date>
54
- <time>2012-05-31</time>
55
- <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="a279a072c9df896abd5153789b500a5d"/><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="57c892490ca67de41b2d5d4d043761b9"/><file name="Hours.php" hash="3f9ec0f1233b4468ed86b4eba050602e"/></dir></dir></dir></dir><file name="Cron.php" hash="bfcd480184d8c1f0553cdbcbb7015eb8"/><file name="Lists.php" hash="1032c009989f7050c271a16cb49f74df"/><file name="MailUp.php" hash="2829fb8a8ad6317ce5b2a28a2fe0149d"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="1435c91e677f7b668079373599aae3eb"/></dir><file name="MailUp.php" hash="4e6e23f0eccdfe35776d1e8eab68692a"/></dir><file name="Observer.php" hash="8882bcd505d163cd96c3e260494d7800"/><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="0a9ee4aacdcf270eb192f5b32e1e4a26"/><file name="Hours.php" hash="029b0d2d998c7e246333ee7bff64661a"/></dir></dir></dir><file name="Ws.php" hash="c6968947b0950b52f0fbeeddf347ad8c"/><file name="Wssend.php" hash="a8d8dfd456d672140b2a1478a92bbb2e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FieldsmappingController.php" hash="0e4ef6aca47bbbd1d1881ce02465a688"/><file name="FilterController.php" hash="732a732286d6679c90a49313a8ebb9c4"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="27acebe2407d8f44cc599c8e2bf570ba"/><file name="system.xml" hash="c9e10400e27057dacf2e3f9d18f6ed21"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="46770fc0e2204faeba2b82c975fc6fb8"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="8fb23d8f3c3d38661aa50697f23e98c7"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="89080c835857a5dd135da5608a77ced1"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="d88d151e34f9ddba5bdc7d8c8cc21f97"/></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="b6e4af2eb21000d218648abc3b2f7caf"/><file name="fieldsmapping.phtml" hash="55931280c93fb67d63ef395309b8d5d9"/><file name="filter.phtml" hash="8450f9d52e895e9a5171f2b4b4e3bfde"/></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="7388cfb49cf963f78f59c24633027f67"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="53b451a3b28669f6bebfa8f39e391302"/></dir></target></contents>
56
<compatible/>
57
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
58
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>MailUp</name>
4
+ <version>2.0.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;Automatic synchronization (via customizable Magento crons) of all customers/subscribers with a new "MAGENTO" group in the selected list.&lt;/li&gt;&#xD;
51
&lt;/ul&gt;</notes>
52
<authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
53
+ <date>2012-06-04</date>
54
+ <time>2012-06-04</time>
55
+ <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="6ad008113139ac367a22ad049e0632f3"/><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="57c892490ca67de41b2d5d4d043761b9"/><file name="Hours.php" hash="3f9ec0f1233b4468ed86b4eba050602e"/></dir></dir></dir></dir><file name="Cron.php" hash="4123ac2606add1be880f497b67597e6c"/><file name="Lists.php" hash="28b44514b3d3c325945f0fc8a83df4ec"/><file name="MailUp.php" hash="2829fb8a8ad6317ce5b2a28a2fe0149d"/><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="1435c91e677f7b668079373599aae3eb"/></dir><file name="MailUp.php" hash="4e6e23f0eccdfe35776d1e8eab68692a"/></dir><file name="Observer.php" hash="8882bcd505d163cd96c3e260494d7800"/><dir name="System"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="0a9ee4aacdcf270eb192f5b32e1e4a26"/><file name="Hours.php" hash="029b0d2d998c7e246333ee7bff64661a"/></dir></dir></dir><file name="Ws.php" hash="c6968947b0950b52f0fbeeddf347ad8c"/><file name="Wssend.php" hash="bbda3b6dcfbe8af129aa24431757605e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FieldsmappingController.php" hash="0e4ef6aca47bbbd1d1881ce02465a688"/><file name="FilterController.php" hash="496b739241dcbf4db8ae32804da5a5b1"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="bdd88d1039c2f2b5b748a3188c606487"/><file name="system.xml" hash="c9e10400e27057dacf2e3f9d18f6ed21"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="46770fc0e2204faeba2b82c975fc6fb8"/><file name="mysql4-upgrade-0.1.0-1.0.0.php" hash="8fb23d8f3c3d38661aa50697f23e98c7"/><file name="mysql4-upgrade-0.3.0-1.0.0.php" hash="89080c835857a5dd135da5608a77ced1"/><file name="mysql4-upgrade-1.0.0-1.5.2.php" hash="d88d151e34f9ddba5bdc7d8c8cc21f97"/></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="b6e4af2eb21000d218648abc3b2f7caf"/><file name="fieldsmapping.phtml" hash="6d31a300cf8774c94219a38b95635486"/><file name="filter.phtml" hash="9323b59d4b1214ab9d025a3eee106399"/></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="7388cfb49cf963f78f59c24633027f67"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="53b451a3b28669f6bebfa8f39e391302"/></dir></target></contents>
56
<compatible/>
57
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
58
</package>