MailUp - Version 0.3.0

Version Notes

Refactoring to support newer versions of Magento, layout enhancements

Download this release

Release Info

Developer Sevenlike
Extension MailUp
Version 0.3.0
Comparing to
See all releases


Code changes from version 0.2.1 to 0.3.0

app/code/local/SevenLike/MailUp/Block/.DS_Store ADDED
Binary file
app/code/local/SevenLike/MailUp/Helper/.DS_Store ADDED
Binary file
app/code/local/SevenLike/MailUp/Model/Ws.php CHANGED
@@ -1,5 +1,5 @@
1
<?php
2
- //ini_set(�soap.wsdl_cache_enabled�, 0�);
3
4
class MailUpWsImport {
5
@@ -12,23 +12,15 @@ class MailUpWsImport {
12
private $xmlResponse;
13
protected $domResult;
14
15
-
16
function __construct() {
17
-
18
- $urlConsole = Mage::getStoreConfig('newsletter/mailup/url_console');
19
- $WSDLUrl = "http://".$urlConsole."/services/WSMailUpImport.asmx?WSDL";
20
- $user = Mage::getStoreConfig('newsletter/mailup/user');
21
- $password = Mage::getStoreConfig('newsletter/mailup/password');
22
- $headers = array("User" => $user, "Password" => $password);
23
- $this->header = new SOAPHeader($this->ns, "Authentication", $headers);
24
- $this->soapClient = new SoapClient($WSDLUrl,
25
- array("trace" => 1,
26
- "exceptions" => 0));
27
-
28
- $this->soapClient->__setSoapHeaders($this->header);
29
-
30
-
31
-
32
}
33
34
function __destruct() {
@@ -41,15 +33,12 @@ class MailUpWsImport {
41
42
public function creaGruppo($newGroup) {
43
try {
44
-
45
$this->soapClient->CreateGroup($newGroup);
46
$this-> printLastRequest();
47
$this->printLastResponse();
48
return $this->readReturnCode("CreateGroup","ReturnCode");
49
-
50
-
51
- } catch (SoapFault $soapFault) {
52
- var_dump($soapFault);
53
}
54
}
55
@@ -58,9 +47,8 @@ class MailUpWsImport {
58
$this->soapClient->GetNlLists();
59
$this->printLastRequest();
60
$this->printLastResponse();
61
- return $this->soapClient->__getLastResponse();
62
-
63
- } catch (SoapFault $soapFault) {
64
var_dump($soapFault);
65
}
66
}
@@ -78,8 +66,7 @@ class MailUpWsImport {
78
try {
79
$this->soapClient->StartProcess($processData);
80
//echo "<br />ReturnCode: ". $this->readReturnCode("StartProcess","ReturnCode")."<br />";
81
-
82
- } catch (SoapFault $soapFault) {
83
var_dump($soapFault);
84
}
85
}
@@ -90,8 +77,7 @@ class MailUpWsImport {
90
//echo "<br />ReturnCode: ". $this->readReturnCode("GetProcessDetails","ReturnCode")."<br />";
91
//echo "<br />IsRunning: ". $this->readReturnCode("GetProcessDetails","IsRunning")."<br />";
92
//echo "<br />StartDate: ". $this->readReturnCode("GetProcessDetails","StartDate")."<br />";
93
-
94
- } catch (SoapFault $soapFault) {
95
var_dump($soapFault);
96
}
97
}
@@ -102,25 +88,24 @@ class MailUpWsImport {
102
$this-> printLastRequest();
103
$this->printLastResponse();
104
//echo "<br />ReturnCode: ". $this->readReturnCode("StartImportProcesses","ReturnCode")."<br />";
105
-
106
- } catch (SoapFault $soapFault) {
107
var_dump($soapFault);
108
}
109
}
110
111
private function readReturnCode($func, $param) {
112
- static $func_in = ""; //static variable to test xmlResponse update
113
if ($func_in != $func) {//(!isset($this->xmlResponse))
114
$func_in = $func;
115
- //prendi l'XML di ritorno se non l'ho gi� preso
116
$this->xmlResponse = $this->soapClient->__getLastResponse();
117
118
$dom = new DomDocument();
119
- $dom->loadXML($this->xmlResponse) or die("File XML non valido!");
120
- $xmlResult = $dom->getElementsByTagName($func."Result");
121
122
$this->domResult = new DomDocument();
123
- $this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die("File XML1 non valido!");;
124
}
125
$rCode = $this->domResult->getElementsByTagName($param);
126
return $rCode->item(0)->nodeValue;
@@ -134,8 +119,10 @@ class MailUpWsImport {
134
//echo "<br />XMLResponse: " . $this->soapClient->__getLastResponse() . "<br />";
135
}
136
137
- public function getCustomersFiltered($request)
138
- {
139
if (!$request->getRequest()->getParam('mailupCustomerFilteredMod')) {
140
//ottengo la collection con tutti i clienti
141
$customerCollection = Mage::getModel('customer/customer')
@@ -143,409 +130,398 @@ class MailUpWsImport {
143
->addAttributeToSelect('entity_id')
144
->addAttributeToSelect('group_id')
145
->addAttributeToSelect('created_at');
146
-
147
//inizializzo l'array dei clienti filtrati con tutti i clienti
148
- $customersFiltered = array();
149
foreach ($customerCollection as $customer) {
150
$customersFiltered[] = $customer->toArray();
151
}
152
-
153
//se richiesto, seleziono solo quelli iscritti alla newsletter di Magento
154
- if ($request->getRequest()->getParam('mailupSubscribed') > 0 ) {
155
foreach ($customersFiltered as $customer) {
156
$customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
157
- if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customerItem)->isSubscribed()){
158
$tempSubscribed[] = $customer;
159
}
160
}
161
- $customersFiltered = $tempSubscribed;
162
}
163
-
164
//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
165
$count = 0;
166
$result = array();
167
$tempPurchased = array();
168
$tempNoPurchased = array();
169
-
170
- if ($request->getRequest()->getParam('mailupCustomers') > 0 ) {
171
- foreach ($customersFiltered as $customer) {
172
- $result[] = $customer;
173
-
174
- //filtro gli ordini in base al customer id
175
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
176
-
177
- $ordered = 0;
178
-
179
- foreach($orders->getData() as $order){
180
- $ordered = 1;
181
- }
182
- //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
183
- if ($ordered == 1)
184
- $tempPurchased[] = $result[$count];
185
- else
186
- $tempNoPurchased[] = $result[$count];
187
-
188
- //unsetto la variabile
189
- $orders->unsetData();
190
- $count++;
191
- }
192
-
193
- if ($request->getRequest()->getParam('mailupCustomers') == 1)
194
- $customersFiltered = $tempPurchased;
195
- elseif ($request->getRequest()->getParam('mailupCustomers') == 2)
196
- $customersFiltered = $tempNoPurchased;
197
-
198
}
199
//FINE FILTRO 1 ACQUISTATO: testato OK
200
-
201
-
202
//FILTRO 2 PRODOTTO ACQUISTATO: in base al fatto se ha acquistato un determinato prodotto
203
$count = 0;
204
$result = array();
205
$tempProduct = array();
206
-
207
if ($request->getRequest()->getParam('mailupProductSku')) {
208
foreach ($customersFiltered as $customer) {
209
- $result[] = $customer;
210
-
211
- //filtro gli ordini in base al customer id
212
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
213
- $purchasedProduct = 0;
214
-
215
- $mailupProductId = Mage::getModel('catalog/product') ->getIdBySku($request->getRequest()->getParam('mailupProductSku'));
216
-
217
- foreach($orders->getData() as $order){
218
- $orderIncrementId = $order['increment_id'];
219
-
220
- //carico i dati di ogni ordine
221
- $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
222
- $items = $orderData->getAllItems();
223
- $ids=array();
224
- foreach ($items as $itemId => $item){
225
- $ids[]=$item->getProductId();
226
- }
227
-
228
- if (in_array($mailupProductId, $ids)) {
229
- $purchasedProduct = 1;
230
- }
231
-
232
- }
233
- //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
234
- if ($purchasedProduct == 1)
235
- $tempProduct[] = $result[$count];
236
-
237
- //unsetto la variabile
238
- $orders->unsetData();
239
-
240
- $count++;
241
- }
242
-
243
- $customersFiltered = $tempProduct;
244
-
245
-
246
}
247
//FINE FILTRO 2 PRODOTTO ACQUISTATO: testato OK
248
-
249
-
250
//FILTRO 3 ACQUISTATO IN CATEGORIA: in base al fatto se ha acquistato almeno un prodotto in una determinata categoria
251
$count = 0;
252
$result = array();
253
$tempCategory = array();
254
-
255
- if ($request->getRequest()->getParam('mailupCategoryId') > 0 ) {
256
foreach ($customersFiltered as $customer) {
257
- $result[] = $customer;
258
-
259
- //filtro gli ordini in base al customer id
260
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
261
- $purchasedCategory = 0;
262
-
263
- foreach($orders->getData() as $order){
264
- $orderIncrementId = $order['increment_id'];
265
-
266
- //carico i dati di ogni ordine
267
- $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
268
- $items = $orderData->getAllItems();
269
- $ids=array();
270
- foreach ($items as $product){
271
- $cat_ids = Mage::getResourceSingleton('catalog/product')->getCategoryIds($product);
272
- }
273
-
274
- if (in_array($request->getRequest()->getParam('mailupCategoryId'), $cat_ids)) {
275
- $purchasedCategory = 1;
276
- }
277
-
278
- }
279
- //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
280
- if ($purchasedCategory == 1)
281
- $tempCategory[] = $result[$count];
282
-
283
- //unsetto la variabile
284
- $orders->unsetData();
285
-
286
- $count++;
287
}
288
-
289
- $customersFiltered = $tempCategory;
290
-
291
-
292
}
293
//FINE FILTRO 3 ACQUISTATO IN CATEGORIA: testato ok
294
-
295
-
296
//FILTRO 4 GRUPPO DI CLIENTI
297
$count = 0;
298
$result = array();
299
$tempGroup = array();
300
-
301
- if ($request->getRequest()->getParam('mailupCustomerGroupId') > 0 ) {
302
-
303
foreach ($customersFiltered as $customer) {
304
-
305
- if ($customer['group_id'] == $request->getRequest()->getParam('mailupCustomerGroupId'))
306
- $tempGroup[] = $customer;
307
}
308
-
309
- $customersFiltered = $tempGroup;
310
}
311
//FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
312
-
313
-
314
//FILTRO 5 PAESE DI PROVENIENZA
315
$count = 0;
316
$result = array();
317
$tempCountry = array();
318
-
319
- if ($request->getRequest()->getParam('mailupCountry') != "0" ) {
320
-
321
foreach ($customersFiltered as $customer) {
322
-
323
- //ottengo la nazione del primary billing address
324
- $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
325
- $customerAddress = $customerItem->getPrimaryBillingAddress();
326
- $countryId = $customerAddress['country_id'];
327
-
328
-
329
- if ($countryId == $request->getRequest()->getParam('mailupCountry'))
330
- $tempCountry[] = $customer;
331
-
332
- //unsetto la variabile
333
- $customerItem->unsetData();
334
335
}
336
-
337
- $customersFiltered = $tempCountry;
338
}
339
//FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
340
-
341
-
342
//FILTRO 6 CAP DI PROVENIENZA
343
$count = 0;
344
$result = array();
345
$tempPostCode = array();
346
-
347
if ($request->getRequest()->getParam('mailupPostCode')) {
348
-
349
foreach ($customersFiltered as $customer) {
350
-
351
- //ottengo la nazione del primary billing address
352
- $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
353
- $customerAddress = $customerItem->getPrimaryBillingAddress();
354
- $postCode = $customerAddress['postcode'];
355
-
356
- if ($postCode == $request->getRequest()->getParam('mailupPostCode'))
357
- $tempPostCode[] = $customer;
358
-
359
- //unsetto la variabile
360
- $customerItem->unsetData();
361
}
362
-
363
- $customersFiltered = $tempPostCode;
364
- }
365
//FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
366
-
367
-
368
//FILTRO 7 DATA CREAZIONE CLIENTE
369
$count = 0;
370
$result = array();
371
$tempDate = array();
372
-
373
if ($request->getRequest()->getParam('mailupCustomerStartDate') || $request->getRequest()->getParam('mailupCustomerEndDate') ) {
374
-
375
foreach ($customersFiltered as $customer) {
376
-
377
- //trasformo tutte le date in aaaammgg
378
- $createdAt = substr(str_replace("-","", $customer['created_at']), 0, 8);
379
- $filterStart = '';
380
- $filterEnd = '';
381
-
382
- if($request->getRequest()->getParam('mailupCustomerStartDate'))
383
- $filterStart = substr($request->getRequest()->getParam('mailupCustomerStartDate'), 6, 4).substr($request->getRequest()->getParam('mailupCustomerStartDate'), 3, 2).substr($request->getRequest()->getParam('mailupCustomerStartDate'), 0, 2);
384
-
385
- if($request->getRequest()->getParam('mailupCustomerEndDate'))
386
- $filterEnd = substr($request->getRequest()->getParam('mailupCustomerEndDate'), 6, 4).substr($request->getRequest()->getParam('mailupCustomerEndDate'), 3, 2).substr($request->getRequest()->getParam('mailupCustomerEndDate'), 0, 2);
387
-
388
- if($filterStart && $filterEnd) {
389
- //compreso tra start e end date
390
- if ($createdAt >= $filterStart && $createdAt <= $filterEnd)
391
- $tempDate[] = $customer;
392
- } elseif ($filterStart) {
393
- // >= di start date
394
- if ($createdAt >= $filterStart)
395
- $tempDate[] = $customer;
396
- } else {
397
- // <= di end date
398
- if ($createdAt <= $filterEnd)
399
- $tempDate[] = $customer;
400
- }
401
-
402
}
403
-
404
- $customersFiltered = $tempDate;
405
}
406
//FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
407
-
408
-
409
//FILTRO 8 TOTALE ACQUISTATO
410
$count = 0;
411
$result = array();
412
$tempTotal = array();
413
-
414
- if ($request->getRequest()->getParam('mailupTotalAmountValue') > 0 ) {
415
foreach ($customersFiltered as $customer) {
416
- $result[] = $customer;
417
-
418
- //filtro gli ordini in base al customer id
419
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
420
-
421
- $totalOrdered = 0;
422
-
423
- foreach($orders->getData() as $order){
424
- $totalOrdered += $order['subtotal'];
425
- }
426
-
427
- if ($totalOrdered == $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "eq" )
428
- $tempTotal[] = $result[$count];
429
-
430
- if ($totalOrdered > $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "gt" )
431
- $tempTotal[] = $result[$count];
432
-
433
- if ($totalOrdered < $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "lt" )
434
- $tempTotal[] = $result[$count];
435
-
436
- $count++;
437
-
438
- //unsetto la variabile
439
- $orders->unsetData();
440
}
441
-
442
- $customersFiltered = $tempTotal;
443
}
444
//FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
445
-
446
-
447
//FILTRO 9 DATA ACQUISTATO
448
$count = 0;
449
$result = array();
450
$tempOrderedDateYes = array();
451
$tempOrderedDateNo = array();
452
-
453
if ($request->getRequest()->getParam('mailupOrderStartDate') || $request->getRequest()->getParam('mailupOrderEndDate') ) {
454
foreach ($customersFiltered as $customer) {
455
- $result[] = $customer;
456
-
457
- //filtro gli ordini in base al customer id
458
- $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
459
-
460
- $orderedDate = 0;
461
-
462
- foreach($orders->getData() as $order){
463
- $createdAt = substr(str_replace("-","", $order['created_at']), 0, 8);
464
-
465
- $filterStart = '';
466
- $filterEnd = '';
467
-
468
- if($request->getRequest()->getParam('mailupOrderStartDate'))
469
- $filterStart = substr($request->getRequest()->getParam('mailupOrderStartDate'), 6, 4).substr($request->getRequest()->getParam('mailupOrderStartDate'), 3, 2).substr($request->getRequest()->getParam('mailupOrderStartDate'), 0, 2);
470
-
471
- if($request->getRequest()->getParam('mailupOrderEndDate'))
472
- $filterEnd = substr($request->getRequest()->getParam('mailupOrderEndDate'), 6, 4).substr($request->getRequest()->getParam('mailupOrderEndDate'), 3, 2).substr($request->getRequest()->getParam('mailupOrderEndDate'), 0, 2);
473
-
474
- if($filterStart && $filterEnd) {
475
- //compreso tra start e end date
476
- if ($createdAt >= $filterStart && $createdAt <= $filterEnd)
477
- $orderedDate = 1;
478
- } elseif ($filterStart) {
479
- // >= di start date
480
- if ($createdAt >= $filterStart)
481
- $orderedDate = 1;
482
- } else {
483
- // <= di end date
484
- if ($createdAt <= $filterEnd)
485
- $orderedDate = 1;
486
- }
487
-
488
- //unsetto la variabile
489
- $orders->unsetData();
490
- }
491
-
492
- if ($orderedDate == 1)
493
- $tempOrderedDateYes[] = $result[$count];
494
- else
495
- $tempOrderedDateNo[] = $result[$count];
496
-
497
- $count++;
498
}
499
-
500
- if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes')
501
- $customersFiltered = $tempOrderedDateYes;
502
- else
503
- $customersFiltered = $tempOrderedDateNo;
504
}
505
//FINE FILTRO 9 DATA ACQUISTATO: testato ok
506
-
507
-
508
- }
509
-
510
- else {
511
//GESTISCO LE MODIFICHE MANUALI
512
$count = 0;
513
$result = array();
514
$tempMod = array();
515
-
516
$emails = explode('
517
', $request->getRequest()->getParam('mailupCustomerFilteredMod'));
518
-
519
foreach ($emails as $email) {
520
-
521
$email = trim($email);
522
-
523
if (strstr($email, '@')) {
524
- $customerModCollection = Mage::getModel('customer/customer')
525
- ->getCollection()
526
- ->addAttributeToSelect('email')
527
- ->addAttributeToFilter('email',$email);
528
-
529
- $added = 0;
530
-
531
- foreach($customerModCollection as $customerMod) {
532
- $tempMod[] = $customerMod->toArray();
533
- $added = 1;
534
- }
535
-
536
- if ($added == 0)
537
- $tempMod[] = array('entity_id'=>0,'firstname'=>'','lastname'=>'','email'=>$email);;
538
-
539
-
540
}
541
}
542
-
543
- $customersFiltered = $tempMod;
544
- }
545
- //FINE GESTISCO LE MODIFICHE MANUALI
546
-
547
- return $customersFiltered;
548
-
549
}
550
-
551
}
1
<?php
2
+ //ini_set('soap.wsdl_cache_enabled', '0');
3
4
class MailUpWsImport {
5
12
private $xmlResponse;
13
protected $domResult;
14
15
function __construct() {
16
+ $urlConsole = Mage::getStoreConfig('newsletter/mailup/url_console');
17
+ $WSDLUrl = "http://". $urlConsole ."/services/WSMailUpImport.asmx?WSDL";
18
+ $user = Mage::getStoreConfig('newsletter/mailup/user');
19
+ $password = Mage::getStoreConfig('newsletter/mailup/password');
20
+ $headers = array("User" => $user, "Password" => $password);
21
+ $this->header = new SOAPHeader($this->ns, "Authentication", $headers);
22
+ $this->soapClient = new SoapClient($WSDLUrl, array("trace" => 1, "exceptions" => 0));
23
+ $this->soapClient->__setSoapHeaders($this->header);
24
}
25
26
function __destruct() {
33
34
public function creaGruppo($newGroup) {
35
try {
36
$this->soapClient->CreateGroup($newGroup);
37
$this-> printLastRequest();
38
$this->printLastResponse();
39
return $this->readReturnCode("CreateGroup","ReturnCode");
40
+ } catch (SoapFault $soapFault) {
41
+ var_dump($soapFault);
42
}
43
}
44
47
$this->soapClient->GetNlLists();
48
$this->printLastRequest();
49
$this->printLastResponse();
50
+ return $this->soapClient->__getLastResponse();
51
+ } catch (SoapFault $soapFault) {
52
var_dump($soapFault);
53
}
54
}
66
try {
67
$this->soapClient->StartProcess($processData);
68
//echo "<br />ReturnCode: ". $this->readReturnCode("StartProcess","ReturnCode")."<br />";
69
+ } catch (SoapFault $soapFault) {
70
var_dump($soapFault);
71
}
72
}
77
//echo "<br />ReturnCode: ". $this->readReturnCode("GetProcessDetails","ReturnCode")."<br />";
78
//echo "<br />IsRunning: ". $this->readReturnCode("GetProcessDetails","IsRunning")."<br />";
79
//echo "<br />StartDate: ". $this->readReturnCode("GetProcessDetails","StartDate")."<br />";
80
+ } catch (SoapFault $soapFault) {
81
var_dump($soapFault);
82
}
83
}
88
$this-> printLastRequest();
89
$this->printLastResponse();
90
//echo "<br />ReturnCode: ". $this->readReturnCode("StartImportProcesses","ReturnCode")."<br />";
91
+ } catch (SoapFault $soapFault) {
92
var_dump($soapFault);
93
}
94
}
95
96
private function readReturnCode($func, $param) {
97
+ static $func_in = ''; //static variable to test xmlResponse update
98
if ($func_in != $func) {//(!isset($this->xmlResponse))
99
$func_in = $func;
100
+ //prendi l'XML di ritorno se non l'ho già preso
101
$this->xmlResponse = $this->soapClient->__getLastResponse();
102
103
$dom = new DomDocument();
104
+ $dom->loadXML($this->xmlResponse) or die('File XML non valido!');
105
+ $xmlResult = $dom->getElementsByTagName($func.'Result');
106
107
$this->domResult = new DomDocument();
108
+ $this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die('File XML1 non valido!');
109
}
110
$rCode = $this->domResult->getElementsByTagName($param);
111
return $rCode->item(0)->nodeValue;
119
//echo "<br />XMLResponse: " . $this->soapClient->__getLastResponse() . "<br />";
120
}
121
122
+ public function getCustomersFiltered($request) {
123
+ //inizializzo l'array dei clienti
124
+ $customersFiltered = array();
125
+
126
if (!$request->getRequest()->getParam('mailupCustomerFilteredMod')) {
127
//ottengo la collection con tutti i clienti
128
$customerCollection = Mage::getModel('customer/customer')
130
->addAttributeToSelect('entity_id')
131
->addAttributeToSelect('group_id')
132
->addAttributeToSelect('created_at');
133
+
134
//inizializzo l'array dei clienti filtrati con tutti i clienti
135
foreach ($customerCollection as $customer) {
136
$customersFiltered[] = $customer->toArray();
137
}
138
+
139
//se richiesto, seleziono solo quelli iscritti alla newsletter di Magento
140
+ if ($request->getRequest()->getParam('mailupSubscribed') > 0) {
141
+ $tempSubscribed = array();
142
foreach ($customersFiltered as $customer) {
143
$customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
144
+ if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customerItem)->isSubscribed()) {
145
$tempSubscribed[] = $customer;
146
}
147
}
148
+ $customersFiltered = array_intersect($tempSubscribed, $customersFiltered);
149
}
150
+
151
//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
152
$count = 0;
153
$result = array();
154
$tempPurchased = array();
155
$tempNoPurchased = array();
156
+
157
+ if ($request->getRequest()->getParam('mailupCustomers') > 0) {
158
+ foreach ($customersFiltered as $customer) {
159
+ $result[] = $customer;
160
+
161
+ //filtro gli ordini in base al customer id
162
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
163
+
164
+ //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
165
+ if ($orders->getData()) {
166
+ $tempPurchased[] = $result[$count];
167
+ } else {
168
+ $tempNoPurchased[] = $result[$count];
169
+ }
170
+
171
+ //unsetto la variabile
172
+ unset($orders); //->unsetData();
173
+
174
+ $count++;
175
+ }
176
+
177
+ if ($request->getRequest()->getParam('mailupCustomers') == 1) {
178
+ $customersFiltered = array_intersect($tempPurchased, $customersFiltered);
179
+ } elseif ($request->getRequest()->getParam('mailupCustomers') == 2) {
180
+ $customersFiltered = array_intersect($tempNoPurchased, $customersFiltered);
181
+ }
182
}
183
//FINE FILTRO 1 ACQUISTATO: testato OK
184
+
185
//FILTRO 2 PRODOTTO ACQUISTATO: in base al fatto se ha acquistato un determinato prodotto
186
$count = 0;
187
$result = array();
188
$tempProduct = array();
189
+
190
if ($request->getRequest()->getParam('mailupProductSku')) {
191
foreach ($customersFiltered as $customer) {
192
+ $result[] = $customer;
193
+
194
+ //filtro gli ordini in base al customer id
195
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
196
+ $purchasedProduct = 0;
197
+
198
+ $mailupProductId = Mage::getModel('catalog/product')->getIdBySku($request->getRequest()->getParam('mailupProductSku'));
199
+
200
+ foreach ($orders->getData() as $order) {
201
+ $orderIncrementId = $order['increment_id'];
202
+
203
+ //carico i dati di ogni ordine
204
+ $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
205
+ $items = $orderData->getAllItems();
206
+ $ids = array();
207
+ foreach ($items as $itemId => $item) {
208
+ $ids[] = $item->getProductId();
209
+ }
210
+
211
+ if (in_array($mailupProductId, $ids)) {
212
+ $purchasedProduct = 1;
213
+ }
214
+ }
215
+
216
+ //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
217
+ if ($purchasedProduct == 1) {
218
+ $tempProduct[] = $result[$count];
219
+ }
220
+
221
+ //unsetto la variabile
222
+ unset($orders); //->unsetData();
223
+
224
+ $count++;
225
+ }
226
+
227
+ $customersFiltered = array_intersect($tempProduct, $customersFiltered);
228
}
229
//FINE FILTRO 2 PRODOTTO ACQUISTATO: testato OK
230
+
231
+
232
//FILTRO 3 ACQUISTATO IN CATEGORIA: in base al fatto se ha acquistato almeno un prodotto in una determinata categoria
233
$count = 0;
234
$result = array();
235
$tempCategory = array();
236
+
237
+ if ($request->getRequest()->getParam('mailupCategoryId') > 0) {
238
foreach ($customersFiltered as $customer) {
239
+ $result[] = $customer;
240
+
241
+ //filtro gli ordini in base al customer id
242
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
243
+ $purchasedCategory = 0;
244
+
245
+ foreach ($orders->getData() as $order) {
246
+ $orderIncrementId = $order['increment_id'];
247
+
248
+ //carico i dati di ogni ordine
249
+ $orderData = Mage::getModel('sales/order')->loadByIncrementID($orderIncrementId);
250
+ $items = $orderData->getAllItems();
251
+ $cat_ids = array();
252
+ foreach ($items as $product) {
253
+ $cat_ids[] = Mage::getResourceSingleton('catalog/product')->getCategoryIds($product);
254
+ }
255
+
256
+ if (in_array($request->getRequest()->getParam('mailupCategoryId'), $cat_ids)) {
257
+ $purchasedCategory = 1;
258
+ }
259
+ }
260
+ //aggiungo il cliente ad un determinato array in base a se ha ordinato o meno
261
+ if ($purchasedCategory == 1) {
262
+ $tempCategory[] = $result[$count];
263
+ }
264
+
265
+ //unsetto la variabile
266
+ unset($orders); //->unsetData();
267
+
268
+ $count++;
269
}
270
+
271
+ $customersFiltered = array_intersect($tempCategory, $customersFiltered);
272
}
273
//FINE FILTRO 3 ACQUISTATO IN CATEGORIA: testato ok
274
+
275
+
276
//FILTRO 4 GRUPPO DI CLIENTI
277
$count = 0;
278
$result = array();
279
$tempGroup = array();
280
+
281
+ if ($request->getRequest()->getParam('mailupCustomerGroupId') > 0) {
282
foreach ($customersFiltered as $customer) {
283
+ if ($customer['group_id'] == $request->getRequest()->getParam('mailupCustomerGroupId')) {
284
+ $tempGroup[] = $customer;
285
+ }
286
}
287
+
288
+ $customersFiltered = array_intersect($tempGroup, $customersFiltered);
289
}
290
//FINE FILTRO 4 GRUPPO DI CLIENTI: testato ok
291
+
292
+
293
//FILTRO 5 PAESE DI PROVENIENZA
294
$count = 0;
295
$result = array();
296
$tempCountry = array();
297
+
298
+ if ($request->getRequest()->getParam('mailupCountry') != '0') {
299
foreach ($customersFiltered as $customer) {
300
+ //ottengo la nazione del primary billing address
301
+ $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
302
+ $customerAddress = $customerItem->getPrimaryBillingAddress();
303
+ $countryId = $customerAddress['country_id'];
304
+
305
+ if ($countryId == $request->getRequest()->getParam('mailupCountry')) {
306
+ $tempCountry[] = $customer;
307
+ }
308
309
+ //unsetto la variabile
310
+ unset($customerItem); //->unsetData();
311
}
312
+
313
+ $customersFiltered = array_intersect($tempCountry, $customersFiltered);
314
}
315
//FINE FILTRO 5 PAESE DI PROVENIENZA: testato ok
316
+
317
+
318
//FILTRO 6 CAP DI PROVENIENZA
319
$count = 0;
320
$result = array();
321
$tempPostCode = array();
322
+
323
if ($request->getRequest()->getParam('mailupPostCode')) {
324
foreach ($customersFiltered as $customer) {
325
+ //ottengo la nazione del primary billing address
326
+ $customerItem = Mage::getModel('customer/customer')->load($customer['entity_id']);
327
+ $customerAddress = $customerItem->getPrimaryBillingAddress();
328
+ $postCode = $customerAddress['postcode'];
329
+
330
+ if ($postCode == $request->getRequest()->getParam('mailupPostCode')) {
331
+ $tempPostCode[] = $customer;
332
+ }
333
+
334
+ //unsetto la variabile
335
+ unset($customerItem); //->unsetData();
336
}
337
+
338
+ $customersFiltered = array_intersect($tempPostCode, $customersFiltered);
339
+ }
340
//FINE FILTRO 6 CAP DI PROVENIENZA: testato ok
341
+
342
+
343
//FILTRO 7 DATA CREAZIONE CLIENTE
344
$count = 0;
345
$result = array();
346
$tempDate = array();
347
+
348
if ($request->getRequest()->getParam('mailupCustomerStartDate') || $request->getRequest()->getParam('mailupCustomerEndDate') ) {
349
foreach ($customersFiltered as $customer) {
350
+ //trasformo tutte le date in aaaammgg
351
+ $createdAt = substr(str_replace('-', '', $customer['created_at']), 0, 8);
352
+ $filterStart = '';
353
+ $filterEnd = '';
354
+
355
+ if ($request->getRequest()->getParam('mailupCustomerStartDate')) {
356
+ $filterStart = substr($request->getRequest()->getParam('mailupCustomerStartDate'), 6, 4).substr($request->getRequest()->getParam('mailupCustomerStartDate'), 3, 2).substr($request->getRequest()->getParam('mailupCustomerStartDate'), 0, 2);
357
+ }
358
+ if ($request->getRequest()->getParam('mailupCustomerEndDate')) {
359
+ $filterEnd = substr($request->getRequest()->getParam('mailupCustomerEndDate'), 6, 4).substr($request->getRequest()->getParam('mailupCustomerEndDate'), 3, 2).substr($request->getRequest()->getParam('mailupCustomerEndDate'), 0, 2);
360
+ }
361
+ if ($filterStart && $filterEnd) {
362
+ //compreso tra start e end date
363
+ if ($createdAt >= $filterStart && $createdAt <= $filterEnd) {
364
+ $tempDate[] = $customer;
365
+ }
366
+ } elseif ($filterStart) {
367
+ // >= di start date
368
+ if ($createdAt >= $filterStart) {
369
+ $tempDate[] = $customer;
370
+ }
371
+ } else {
372
+ // <= di end date
373
+ if ($createdAt <= $filterEnd) {
374
+ $tempDate[] = $customer;
375
+ }
376
+ }
377
}
378
+
379
+ $customersFiltered = array_intersect($tempDate, $customersFiltered);
380
}
381
//FINE FILTRO 7 DATA CREAZIONE CLIENTE: testato ok
382
+
383
+
384
//FILTRO 8 TOTALE ACQUISTATO
385
$count = 0;
386
$result = array();
387
$tempTotal = array();
388
+
389
+ if ($request->getRequest()->getParam('mailupTotalAmountValue') > 0) {
390
foreach ($customersFiltered as $customer) {
391
+ $result[] = $customer;
392
+
393
+ //filtro gli ordini in base al customer id
394
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
395
+
396
+ $totalOrdered = 0;
397
+
398
+ foreach ($orders->getData() as $order) {
399
+ $totalOrdered += $order['subtotal'];
400
+ }
401
+
402
+ if ($totalOrdered == $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "eq") {
403
+ $tempTotal[] = $result[$count];
404
+ }
405
+
406
+ if ($totalOrdered > $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "gt") {
407
+ $tempTotal[] = $result[$count];
408
+ }
409
+
410
+ if ($totalOrdered < $request->getRequest()->getParam('mailupTotalAmountValue') && $request->getRequest()->getParam('mailupTotalAmountCond') == "lt" ) {
411
+ $tempTotal[] = $result[$count];
412
+ }
413
+
414
+ $count++;
415
+
416
+ //unsetto la variabile
417
+ unset($orders); //->unsetData();
418
}
419
+
420
+ $customersFiltered = array_intersect($tempTotal, $customersFiltered);
421
}
422
//FINE FILTRO 8 TOTALE ACQUISTATO: testato ok
423
+
424
+
425
//FILTRO 9 DATA ACQUISTATO
426
$count = 0;
427
$result = array();
428
$tempOrderedDateYes = array();
429
$tempOrderedDateNo = array();
430
+
431
if ($request->getRequest()->getParam('mailupOrderStartDate') || $request->getRequest()->getParam('mailupOrderEndDate') ) {
432
foreach ($customersFiltered as $customer) {
433
+ $result[] = $customer;
434
+
435
+ //filtro gli ordini in base al customer id
436
+ $orders = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('customer_id', $result[$count]['entity_id']);
437
+
438
+ $orderedDate = 0;
439
+
440
+ foreach ($orders->getData() as $order) {
441
+ $createdAt = substr(str_replace('-', '', $order['created_at']), 0, 8);
442
+
443
+ $filterStart = '';
444
+ $filterEnd = '';
445
+
446
+ if ($request->getRequest()->getParam('mailupOrderStartDate')) {
447
+ $filterStart = substr($request->getRequest()->getParam('mailupOrderStartDate'), 6, 4).substr($request->getRequest()->getParam('mailupOrderStartDate'), 3, 2).substr($request->getRequest()->getParam('mailupOrderStartDate'), 0, 2);
448
+ }
449
+ if ($request->getRequest()->getParam('mailupOrderEndDate')) {
450
+ $filterEnd = substr($request->getRequest()->getParam('mailupOrderEndDate'), 6, 4).substr($request->getRequest()->getParam('mailupOrderEndDate'), 3, 2).substr($request->getRequest()->getParam('mailupOrderEndDate'), 0, 2);
451
+ }
452
+ if ($filterStart && $filterEnd) {
453
+ //compreso tra start e end date
454
+ if ($createdAt >= $filterStart && $createdAt <= $filterEnd) {
455
+ $orderedDate = 1;
456
+ }
457
+ } elseif ($filterStart) {
458
+ // >= di start date
459
+ if ($createdAt >= $filterStart) {
460
+ $orderedDate = 1;
461
+ }
462
+ } else {
463
+ // <= di end date
464
+ if ($createdAt <= $filterEnd) {
465
+ $orderedDate = 1;
466
+ }
467
+ }
468
+
469
+ //unsetto la variabile
470
+ unset($orders); //->unsetData();
471
+ }
472
+
473
+ if ($orderedDate == 1) {
474
+ $tempOrderedDateYes[] = $result[$count];
475
+ } else {
476
+ $tempOrderedDateNo[] = $result[$count];
477
+ }
478
+
479
+ $count++;
480
+ }
481
+
482
+ if ($request->getRequest()->getParam('mailupOrderYesNo') == 'yes') {
483
+ $customersFiltered = array_intersect($tempOrderedDateYes, $customersFiltered);
484
+ } else {
485
+ $customersFiltered = array_intersect($tempOrderedDateNo, $customersFiltered);
486
}
487
}
488
//FINE FILTRO 9 DATA ACQUISTATO: testato ok
489
+
490
+ } else {
491
//GESTISCO LE MODIFICHE MANUALI
492
$count = 0;
493
$result = array();
494
$tempMod = array();
495
+
496
$emails = explode('
497
', $request->getRequest()->getParam('mailupCustomerFilteredMod'));
498
+
499
foreach ($emails as $email) {
500
$email = trim($email);
501
+
502
if (strstr($email, '@')) {
503
+ $customerModCollection = Mage::getModel('customer/customer')
504
+ ->getCollection()
505
+ ->addAttributeToSelect('email')
506
+ ->addAttributeToFilter('email', $email);
507
+
508
+ $added = 0;
509
+
510
+ foreach ($customerModCollection as $customerMod) {
511
+ $tempMod[] = $customerMod->toArray();
512
+ $added = 1;
513
+ }
514
+
515
+ if ($added == 0) {
516
+ $tempMod[] = array('entity_id'=>0, 'firstname'=>'', 'lastname'=>'', 'email'=>$email);
517
+ }
518
}
519
}
520
+
521
+ $customersFiltered = array_intersect($tempMod, $customersFiltered);
522
+ }
523
+ //FINE GESTISCO LE MODIFICHE MANUALI
524
+
525
+ return $customersFiltered;
526
}
527
}
app/code/local/SevenLike/MailUp/controllers/.DS_Store ADDED
Binary file
app/code/local/SevenLike/MailUp/controllers/Adminhtml/.DS_Store ADDED
Binary file
app/code/local/SevenLike/MailUp/etc/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml CHANGED
@@ -40,7 +40,7 @@ $xml = simplexml_load_string($xmlLists);
40
<input type="hidden" name="mailupOrderStartDate" value="<?php echo $this->getRequest()->getParam('mailupOrderStartDate'); ?>" />
41
<input type="hidden" name="mailupOrderEndDate" value="<?php echo $this->getRequest()->getParam('mailupOrderEndDate'); ?>" />
42
<input type="hidden" name="mailupOrderYesNo" value="<?php echo $this->getRequest()->getParam('mailupOrderYesNo'); ?>" />
43
- <input type="hidden" name="mailupOrderYesNo" value="<?php echo $this->getRequest()->getParam('mailupSubscribed'); ?>" />
44
</form>
45
46
<form id="csv_form" name="csv_form" method="post" action="<?php echo $this->getUrl('*/*/csv'); ?>">
40
<input type="hidden" name="mailupOrderStartDate" value="<?php echo $this->getRequest()->getParam('mailupOrderStartDate'); ?>" />
41
<input type="hidden" name="mailupOrderEndDate" value="<?php echo $this->getRequest()->getParam('mailupOrderEndDate'); ?>" />
42
<input type="hidden" name="mailupOrderYesNo" value="<?php echo $this->getRequest()->getParam('mailupOrderYesNo'); ?>" />
43
+ <input type="hidden" name="mailupSubscribed" value="<?php echo $this->getRequest()->getParam('mailupSubscribed'); ?>" />
44
</form>
45
46
<form id="csv_form" name="csv_form" method="post" action="<?php echo $this->getUrl('*/*/csv'); ?>">
app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml CHANGED
@@ -28,7 +28,7 @@ if ($loginTest > 0){
28
if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
29
echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
30
} else {
31
- //controllo se la lista stata selezionata correttamente
32
$MailUpWsImport = Mage::getModel('mailup/ws');
33
$wsImport = new MailUpWsImport();
34
$mailupLists = $wsImport->GetNlList();
@@ -52,9 +52,9 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
52
$mailupOrderEndDate = $this->getRequest()->getParam('mailupOrderEndDate');
53
$mailupOrderYesNo = $this->getRequest()->getParam('mailupOrderYesNo');
54
$mailupSubscribed = $this->getRequest()->getParam('mailupSubscribed');
55
- ?>
56
57
- <div class="content-header">
58
<table cellspacing="0" class="grid-header">
59
<tr>
60
<td><h3><?=$this->__('MailUp')?></h3></td>
@@ -63,9 +63,9 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
63
</td>
64
</tr>
65
</table>
66
- </div>
67
- <div class="entry-edit">
68
-
69
<form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/confirm')?>">
70
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
71
<h4><span id="spantitle2"><?=$this->__('Filter customers')?></span><span id="spansugger"><a href="#ottsugg"><?=$this->__('Get hints')?> &rArr;</a></span></h4>
@@ -73,326 +73,326 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
73
<fieldset id="my-fieldset">
74
<table cellspacing="0" class="form-list">
75
<tr>
76
- <td colspan="3"><?=$this->__('By this plugin you can import contacts registered in your eCommerce in the MailUp platform.')?></td>
77
</tr>
78
<tr>
79
- <td colspan="3"><input type="checkbox" name="mailupSubscribed" value="1" <?php if($mailupSubscribed == 1) echo 'checked="checked"'; ?> /> <?=$this->__("Subscribed to Newsletter") ?>
80
</tr>
81
<tr>
82
<td colspan="3">
83
- <strong>
84
- <?=$this->__('Sold products')?>
85
- </strong></td>
86
</tr>
87
<?php //imposto il filtro per clienti: 0 = tutti, 1 = che hanno acquistato, 2 = che non hanno mai acquistato ?>
88
<tr>
89
-
90
- <td class="input-ele spdnpg1">
91
- <input type="radio" name="mailupCustomers" value="0" onclick="makeEnable('mailupProductId','mailupCategoryId','mailupTotalAmountCond','mailupTotalAmountValue')" <?php if($mailupCustomers == 0 || !$mailupCustomers) echo 'checked="checked"'; ?> />
92
- <?=$this->__('All customers')?>
93
- </td>
94
-
95
- <td class="input-ele spdnpg1">
96
- <input type="radio" name="mailupCustomers" value="1" onclick="makeEnable('mailupProductId','mailupCategoryId','mailupTotalAmountCond','mailupTotalAmountValue')" <?php if($mailupCustomers == 1) echo 'checked="checked"'; ?> />
97
- <?=$this->__('Customers who have purchased')?>
98
- </td>
99
-
100
- <td class="input-ele spdnpg1">
101
- <input type="radio" name="mailupCustomers" value="2" onclick="makeDisable('mailupProductId','mailupCategoryId','mailupTotalAmountCond','mailupTotalAmountValue')" <?php if($mailupCustomers == 2) echo 'checked="checked"'; ?> />
102
- <?=$this->__("Customers who haven't purchased yet")?>
103
- </td>
104
</tr>
105
-
106
-
107
</table>
108
109
- <table cellspacing="0" class="form-list">
110
-
111
- <?php //select con tutti i prodotti ?>
112
<tr>
113
- <td class="labelpg1"><?=$this->__('Insert product SKU')?></td>
114
- <td class="input-ele">
115
- <input type="text" class="inptptx1" name="mailupProductSku" size="30" value="<?php echo $mailupProductSku; ?>" />
116
- </td>
117
</tr>
118
- <?php //select con tutte le categorie ?>
119
<tr>
120
- <td class="labelpg1"><?=$this->__('Select category')?></td>
121
- <td class="input-ele">
122
- <?php
123
- $categoriesCollection = Mage::getModel('catalog/category')->getCollection();
124
- $categoriesCollection->addAttributeToSelect('name');
125
- $categoriesCollection->addAttributeToSelect('entity_id');
126
- /*
127
- foreach ($categoriesCollection as $category) {
128
- var_dump($category);
129
- }
130
- */
131
-
132
- ?>
133
- <select id="mailupCategoryId" name="mailupCategoryId" class="slctpg1">
134
-
135
- <?php
136
- if($mailupCategoryId) {
137
- $category = Mage::getModel('catalog/category')->load($mailupCategoryId);
138
- ?>
139
- <option value="<?php echo $mailupCategoryId; ?>"><?php echo $category->getData('name'); ?></option>
140
- <?php } ?>
141
-
142
- <option value="0">-- <?=$this->__('Any')?> --</option>
143
-
144
- <?php
145
- foreach ($categoriesCollection as $category) {
146
- //var_dump($product);
147
- if ($category->getLevel() == 2):
148
- echo '<option value="'.$category->getData('entity_id').'">'.($category->getData('name')).'</option>';
149
- endif;
150
- }
151
- ?>
152
- </select>
153
- </td>
154
</tr>
155
156
<tr>
157
<td colspan="2">
158
- <strong><br /><br />
159
- <?=$this->__('Groups')?>
160
- </strong></td>
161
</tr>
162
<tr>
163
- <td class="labelpg1"><?=$this->__('Select customer group')?></td>
164
- <td class="input-ele">
165
- <select name="mailupCustomerGroupId" class="slctpg1">
166
-
167
- <?php
168
- $customerGroups = Mage::helper('customer')->getGroups()->toOptionArray();
169
-
170
- if($mailupCustomerGroupId) {
171
- foreach ($customerGroups as $customerGroup){
172
- if($mailupCustomerGroupId == $customerGroup['value'])
173
- echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
174
- }
175
-
176
- } ?>
177
178
- <option value="0">-- <?=$this->__('Any')?> --</option>
179
180
- <?php
181
- foreach ($customerGroups as $customerGroup){
182
- echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
183
- }
184
- ?>
185
- </select>
186
- </td>
187
</tr>
188
-
189
<tr>
190
- <td colspan="2">
191
- <strong><br /><br />
192
- <?=$this->__('Country')?>
193
- </strong></td>
194
</tr>
195
<tr>
196
- <td class="labelpg1"><?=$this->__('Select country')?></td>
197
- <td class="input-ele">
198
- <select name="mailupCountry" class="slctpg1">
199
-
200
- <?php
201
-
202
- $countries = Mage::getResourceModel('directory/country_collection')
203
- ->loadData()
204
- ->toOptionArray(false);
205
-
206
- if($mailupCountry) {
207
-
208
- foreach ($countries as $country){
209
- if ($country['value'] == $mailupCountry)
210
- echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
211
- }
212
-
213
- }
214
- ?>
215
-
216
- <option value="0">-- <?=$this->__('Any')?> --</option>
217
-
218
- <?php
219
- foreach ($countries as $country){
220
- echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
221
- }
222
- ?>
223
- </select>
224
- </td>
225
</tr>
226
<tr>
227
- <td class="labelpg1"><?=$this->__('Zip code')?></td>
228
- <td class="input-ele">
229
- <input type="text" class="inptptx1" name="mailupPostCode" size="10" value="<?php echo $mailupPostCode; ?>" />
230
- </td>
231
</tr>
232
233
<tr>
234
<td colspan="2">
235
- <strong><br /><br />
236
- <?=$this->__('Subscritpion date')?>
237
- </strong></td>
238
</tr>
239
<tr>
240
- <td class="labelpg1"><?=$this->__('From')?></td>
241
- <td class="input-ele">
242
- <input type="text" class="inptptx1" name="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" /> (dd/mm/yyyy)
243
- </td>
244
</tr>
245
<tr>
246
- <td class="labelpg1"><?=$this->__('To')?></td>
247
- <td class="input-ele">
248
- <input type="text" class="inptptx1" name="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" /> (dd/mm/yyyy)
249
- </td>
250
</tr>
251
-
252
<tr>
253
<td colspan="2">
254
- <strong><br /><br />
255
- <?=$this->__('Total purchased amount')?>
256
- </strong></td>
257
</tr>
258
<tr>
259
- <td class="labelpg1"><?=$this->__('Order total')?></td>
260
- <td class="input-ele">
261
- <select id="mailupTotalAmountCond" name="mailupTotalAmountCond" class="slctpg2">
262
-
263
- <?php
264
- if ($mailupTotalAmountCond && $mailupTotalAmountCond != 'gt'){
265
- if ($mailupTotalAmountCond == 'lt')
266
- echo '<option value="lt"> '.$this->__('less than').' </option>';
267
- elseif ($mailupTotalAmountCond == 'eq')
268
- echo '<option value="eq"> '.$this->__('same as').' </option>';
269
- }
270
- ?>
271
- <option value="gt"> <?=$this->__('more than')?> </option>
272
- <option value="lt"> <?=$this->__('less than')?> </option>
273
- <option value="eq"> <?=$this->__('same as')?> </option>
274
- </select>
275
- <label for="mailupTotalAmountValue" class="lbl1"><?=$this->__('Specify amount')?></label>
276
- <input type="text" class="inptptx1" id="mailupTotalAmountValue" name="mailupTotalAmountValue" size="20" value="<?php echo $mailupTotalAmountValue; ?>" />
277
- </td>
278
</tr>
279
280
<tr>
281
<td colspan="2">
282
- <strong><br /><br />
283
- <?=$this->__('Date of purchase')?>
284
- </strong></td>
285
</tr>
286
287
<tr>
288
- <td><?=$this->__('Show customers who'); ?></td>
289
- <td>
290
- <select name="mailupOrderYesNo" class="slctpg2">
291
- <?php
292
- if ($mailupOrderYesNo == 'no'){
293
- echo '<option value="no">'.$this->__("Haven't purchased").'</option>';
294
- }
295
- ?>
296
- <option value="yes"> <?=$this->__('Have purchased'); ?> </option>
297
- <option value="no"> <?=$this->__("Haven't purchased"); ?> </option>
298
- </select>
299
- </td>
300
</tr>
301
<tr>
302
- <td colspan="2"><?=$this->__('In this period'); ?>:</td>
303
</tr>
304
305
<tr>
306
- <td class="labelpg1"><?=$this->__('From')?></td>
307
- <td class="input-ele">
308
- <input type="text" class="inptptx1" name="mailupOrderStartDate" size="20" value="<?php echo $mailupOrderStartDate; ?>" /> (dd/mm/yyyy)
309
- </td>
310
</tr>
311
<tr>
312
- <td class="labelpg1"><?=$this->__('To')?></td>
313
- <td class="input-ele">
314
- <input type="text" class="inptptx1" name="mailupOrderEndDate" size="20" value="<?php echo $mailupOrderEndDate; ?>" /> (dd/mm/yyyy)
315
- </td>
316
</tr>
317
-
318
- </table>
319
- </fieldset>
320
</form>
321
322
<!-- Secondo blocco -->
323
<h4><span id="spantitle1"><a name="ottsugg"><?=$this->__('Filter hints')?></a></span></h4>
324
- <fieldset id="my-fieldset">
325
<table cellspacing="0" class="form-list">
326
<tr>
327
- <td><?=$this->__('Set and customize one of the following filters:')?></td>
328
</tr>
329
<tr>
330
- <td>
331
- <form action="*/*/" id="filtro1" name="filtro1" method="post">
332
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
333
- <input name="mailupCustomers" type="hidden" value="2" />
334
- <input name="mailupCustomerGroupId" type="hidden" value="2" />
335
- <p class="parscefil"><?=$this->__("All wholesale customers who haven't purchased yet")?> &raquo;</p>
336
- <input type="submit" value="<?=$this->__('Set filter')?>" />
337
- <!--<<button onclick="filtro1.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
338
- input type="submit" value="Imposta filtro" />-->
339
- </form>
340
- </td>
341
</tr>
342
<tr>
343
- <td>
344
- <form action="*/*/" id="filtro2" name="filtro2" method="post">
345
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
346
- <input name="mailupCustomers" type="hidden" value="1" />
347
- <input name="mailupTotalAmountCond" type="hidden" value="gt" />
348
- <input name="mailupTotalAmountValue" type="hidden" value="50" />
349
- <p class="parscefil"><?=$this->__('More than 50 Euros orders')?> &raquo;</p>
350
- <input type="submit" value="<?=$this->__('Set filter')?>" />
351
- <!-- <button onclick="filtro2.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
352
- <input type="submit" value="Imposta filtro" /> -->
353
- </form>
354
- </td>
355
</tr>
356
<tr>
357
- <td>
358
- <form action="*/*/" id="filtro3" name="filtro2" method="post">
359
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
360
- <input name="mailupCustomers" type="hidden" value="0" />
361
- <input name="mailupOrderYesNo" type="hidden" value="no" />
362
- <input name="mailupOrderStartDate" type="hidden" value="01/01/<?php echo date('Y'); ?>" />
363
- <p class="parscefil"><?=$this->__('Members with no purchase in')?> <?php echo date('Y'); ?> &raquo;</p>
364
- <input type="submit" value="<?=$this->__('Set filter')?>" />
365
- <!-- <button onclick="filtro3.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
366
- <input type="submit" value="Imposta filtro" /> -->
367
- </form>
368
- </td>
369
</tr>
370
</table>
371
</fieldset>
372
- </div>
373
- <script type="text/javascript">
374
- var editForm = new varienForm('edit_form');
375
- </script>
376
- <script type="text/javascript">
377
- function makeDisable($ID1,$ID2,$ID3,$ID4){
378
- var x=document.getElementById($ID1)
379
- var y=document.getElementById($ID2)
380
- var z=document.getElementById($ID3)
381
- var t=document.getElementById($ID4)
382
- x.disabled=true
383
- y.disabled=true
384
- z.disabled=true
385
- t.disabled=true
386
- }
387
- function makeEnable($ID1,$ID2,$ID3,$ID4){
388
- var x=document.getElementById($ID1)
389
- var y=document.getElementById($ID2)
390
- var z=document.getElementById($ID3)
391
- var t=document.getElementById($ID4)
392
- x.disabled=false
393
- y.disabled=false
394
- z.disabled=false
395
- t.disabled=false
396
- }
397
- </script>
398
<?php } ?>
28
if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
29
echo $this->__('WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp');
30
} else {
31
+ //controllo se la lista e' stata selezionata correttamente
32
$MailUpWsImport = Mage::getModel('mailup/ws');
33
$wsImport = new MailUpWsImport();
34
$mailupLists = $wsImport->GetNlList();
52
$mailupOrderEndDate = $this->getRequest()->getParam('mailupOrderEndDate');
53
$mailupOrderYesNo = $this->getRequest()->getParam('mailupOrderYesNo');
54
$mailupSubscribed = $this->getRequest()->getParam('mailupSubscribed');
55
+ ?>
56
57
+ <div class="content-header">
58
<table cellspacing="0" class="grid-header">
59
<tr>
60
<td><h3><?=$this->__('MailUp')?></h3></td>
63
</td>
64
</tr>
65
</table>
66
+ </div>
67
+
68
+ <div class="entry-edit">
69
<form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/confirm')?>">
70
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
71
<h4><span id="spantitle2"><?=$this->__('Filter customers')?></span><span id="spansugger"><a href="#ottsugg"><?=$this->__('Get hints')?> &rArr;</a></span></h4>
73
<fieldset id="my-fieldset">
74
<table cellspacing="0" class="form-list">
75
<tr>
76
+ <td colspan="3"><?=$this->__('By this plugin you can import contacts registered in your eCommerce in the MailUp platform.')?></td>
77
</tr>
78
<tr>
79
+ <td colspan="3">&nbsp;</td>
80
</tr>
81
<tr>
82
<td colspan="3">
83
+ <strong><?=$this->__('Sold products')?></strong>
84
+ </td>
85
</tr>
86
+
87
<?php //imposto il filtro per clienti: 0 = tutti, 1 = che hanno acquistato, 2 = che non hanno mai acquistato ?>
88
+ <tr>
89
+ <td class="input-ele spdnpg1">
90
+ <input type="radio" name="mailupCustomers" id="mailupCustomersAll" value="0" <?php if (isset($mailupCustomers) && $mailupCustomers == 0) { echo 'checked="checked"'; } ?> onclick="customerDependentFilters(false);" />&nbsp;<label for="mailupCustomersAll"><?=$this->__('All customers')?></label>
91
+ </td>
92
+
93
+ <td class="input-ele spdnpg1">
94
+ <input type="radio" name="mailupCustomers" id="mailupCustomersWhoHaveBought" value="1" <?php if (isset($mailupCustomers) && $mailupCustomers == 1) { echo 'checked="checked"'; } ?> onclick="customerDependentFilters(false);" />&nbsp;<label for="mailupCustomersWhoHaveBought"><?=$this->__('Customers who have purchased')?></label>
95
+ </td>
96
+
97
+ <td class="input-ele spdnpg1">
98
+ <input type="radio" name="mailupCustomers" id="mailupCustomersWhoHaventBought" value="2" <?php if (isset($mailupCustomers) && $mailupCustomers == 2) { echo 'checked="checked"'; } ?> onclick="customerDependentFilters(true);" />&nbsp;<label for="mailupCustomersWhoHaventBought"><?=$this->__("Customers who haven't purchased yet")?></label>
99
+ </td>
100
+ </tr>
101
<tr>
102
+ <td colspan="3">
103
+ <input type="checkbox" name="mailupSubscribed" id="mailupSubscribed" value="1" <?php if (isset($mailupSubscribed) && $mailupSubscribed == 1) { echo 'checked="checked"'; } ?> />&nbsp;<label for="mailupSubscribed"><?php echo $this->__("Subscribed to Newsletter"); ?></label>
104
+ </td>
105
</tr>
106
</table>
107
108
+ <br /><br />
109
+
110
+ <table cellspacing="0" class="form-list">
111
<tr>
112
+ <td colspan="2">
113
+ <strong><?=$this->__('Groups')?></strong>
114
+ </td>
115
</tr>
116
<tr>
117
+ <td class="labelpg1"><?=$this->__('Select customer group')?></td>
118
+ <td class="input-ele">
119
+ <select name="mailupCustomerGroupId" class="slctpg1">
120
+ <?php
121
+ $customerGroups = Mage::helper('customer')->getGroups()->toOptionArray();
122
+
123
+ if ($mailupCustomerGroupId) {
124
+ foreach ($customerGroups as $customerGroup) {
125
+ if ($mailupCustomerGroupId == $customerGroup['value']) {
126
+ echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
127
+ }
128
+ }
129
+ }
130
+ ?>
131
+
132
+ <option value="0">-- <?=$this->__('Any')?> --</option>
133
+
134
+ <?php
135
+ foreach ($customerGroups as $customerGroup) {
136
+ echo '<option value="'.$customerGroup['value'].'">'.$customerGroup['label'].'</option>';
137
+ }
138
+ ?>
139
+ </select>
140
+ </td>
141
</tr>
142
143
<tr>
144
<td colspan="2">
145
+ <br /><br /><strong><?=$this->__('Country')?></strong>
146
+ </td>
147
</tr>
148
<tr>
149
+ <td class="labelpg1"><?=$this->__('Select country')?></td>
150
+ <td class="input-ele">
151
+ <select name="mailupCountry" class="slctpg1">
152
+ <?php
153
+ $countries = Mage::getResourceModel('directory/country_collection')
154
+ ->loadData()
155
+ ->toOptionArray(false);
156
+
157
+ if ($mailupCountry) {
158
+ foreach ($countries as $country){
159
+ if ($country['value'] == $mailupCountry)
160
+ echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
161
+ }
162
+ }
163
+ ?>
164
165
+ <option value="0">-- <?=$this->__('Any')?> --</option>
166
167
+ <?php
168
+ foreach ($countries as $country) {
169
+ echo '<option value="'.$country['value'].'">'.$country['label'].'</option>';
170
+ }
171
+ ?>
172
+ </select>
173
+ </td>
174
</tr>
175
<tr>
176
+ <td class="labelpg1"><?=$this->__('Zip code')?></td>
177
+ <td class="input-ele">
178
+ <input type="text" class="inptptx1" name="mailupPostCode" size="10" value="<?php echo $mailupPostCode; ?>" />
179
+ </td>
180
</tr>
181
+ </table>
182
+
183
+ <table cellspacing="0" class="form-list" id="customerDependentContainer">
184
<tr>
185
+ <td colspan="2">
186
+ <br /><br /><strong><?=$this->__('Prodotti e categorie')?></strong>
187
+ </td>
188
+ </tr>
189
+
190
+ <?php //select con tutti i prodotti ?>
191
+ <tr>
192
+ <td class="labelpg1"><?=$this->__('Insert product SKU')?></td>
193
+ <td class="input-ele">
194
+ <input type="text" class="inptptx1 customerDependent" name="mailupProductSku" size="30" value="<?php echo $mailupProductSku; ?>" />
195
+ </td>
196
</tr>
197
+ <?php //select con tutte le categorie ?>
198
<tr>
199
+ <td class="labelpg1"><?=$this->__('Select category')?></td>
200
+ <td class="input-ele">
201
+ <?php
202
+ $categoriesCollection = Mage::getModel('catalog/category')->getCollection();
203
+ $categoriesCollection->addAttributeToSelect('name');
204
+ $categoriesCollection->addAttributeToSelect('entity_id');
205
+ ?>
206
+ <select id="mailupCategoryId" name="mailupCategoryId" class="slctpg1 customerDependent">
207
+ <?php
208
+ if ($mailupCategoryId) {
209
+ $category = Mage::getModel('catalog/category')->load($mailupCategoryId);
210
+ echo '<option value="'.$mailupCategoryId.'">'.$category->getData('name').'</option>';
211
+ }
212
+ ?>
213
+
214
+ <option value="0">-- <?=$this->__('Any')?> --</option>
215
+
216
+ <?php
217
+ foreach ($categoriesCollection as $category) {
218
+ if ($category->getLevel() == 2) {
219
+ echo '<option value="'.$category->getData('entity_id').'">'.($category->getData('name')).'</option>';
220
+ }
221
+ }
222
+ ?>
223
+ </select>
224
+ </td>
225
</tr>
226
227
<tr>
228
<td colspan="2">
229
+ <br /><br /><strong><?=$this->__('Data di iscrizione')?></strong>
230
+ </td>
231
</tr>
232
<tr>
233
+ <td class="labelpg1"><?=$this->__('From')?></td>
234
+ <td class="input-ele">
235
+ <input type="text" class="inptptx1 customerDependent" name="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" /> (dd/mm/yyyy)
236
+ </td>
237
</tr>
238
<tr>
239
+ <td class="labelpg1"><?=$this->__('To')?></td>
240
+ <td class="input-ele">
241
+ <input type="text" class="inptptx1 customerDependent" name="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" /> (dd/mm/yyyy)
242
+ </td>
243
</tr>
244
<tr>
245
<td colspan="2">
246
+ <br /><br /><strong><?=$this->__('Total purchased amount')?></strong>
247
+ </td>
248
</tr>
249
<tr>
250
+ <td class="labelpg1"><?=$this->__('Order total')?></td>
251
+ <td class="input-ele">
252
+ <select id="mailupTotalAmountCond" name="mailupTotalAmountCond" class="slctpg2 customerDependent">
253
+ <?php
254
+ if ($mailupTotalAmountCond && $mailupTotalAmountCond != 'gt') {
255
+ if ($mailupTotalAmountCond == 'lt') {
256
+ echo '<option value="lt"> '.$this->__('less than').' </option>';
257
+ } elseif ($mailupTotalAmountCond == 'eq') {
258
+ echo '<option value="eq"> '.$this->__('same as').' </option>';
259
+ }
260
+ }
261
+ ?>
262
+ <option value="gt"> <?=$this->__('more than')?> </option>
263
+ <option value="lt"> <?=$this->__('less than')?> </option>
264
+ <option value="eq"> <?=$this->__('same as')?> </option>
265
+ </select>
266
+
267
+ <label for="mailupTotalAmountValue" class="lbl1"><?=$this->__('Specify amount')?></label>
268
+ <input type="text" class="inptptx1 customerDependent" id="mailupTotalAmountValue" name="mailupTotalAmountValue" size="20" value="<?php echo $mailupTotalAmountValue; ?>" />
269
+ </td>
270
</tr>
271
272
<tr>
273
<td colspan="2">
274
+ <br /><br /><strong><?=$this->__('Date of purchase')?></strong>
275
+ </td>
276
</tr>
277
278
<tr>
279
+ <td><?=$this->__('Show customers who'); ?></td>
280
+ <td>
281
+ <select name="mailupOrderYesNo" class="slctpg2 customerDependent">
282
+ <?php
283
+ if ($mailupOrderYesNo == 'no') {
284
+ echo '<option value="no">'.$this->__("Haven't purchased").'</option>';
285
+ }
286
+ ?>
287
+ <option value="yes"> <?=$this->__('Have purchased'); ?> </option>
288
+ <option value="no"> <?=$this->__("Haven't purchased"); ?> </option>
289
+ </select>
290
+ </td>
291
</tr>
292
<tr>
293
+ <td colspan="2"><?=$this->__('In this period'); ?>:</td>
294
</tr>
295
296
<tr>
297
+ <td class="labelpg1"><?=$this->__('From')?></td>
298
+ <td class="input-ele">
299
+ <input type="text" class="inptptx1 customerDependent" name="mailupOrderStartDate" size="20" value="<?php echo $mailupOrderStartDate; ?>" /> (dd/mm/yyyy)
300
+ </td>
301
</tr>
302
<tr>
303
+ <td class="labelpg1"><?=$this->__('To')?></td>
304
+ <td class="input-ele">
305
+ <input type="text" class="inptptx1 customerDependent" name="mailupOrderEndDate" size="20" value="<?php echo $mailupOrderEndDate; ?>" /> (dd/mm/yyyy)
306
+ </td>
307
</tr>
308
+ </table>
309
+ </fieldset>
310
</form>
311
312
<!-- Secondo blocco -->
313
<h4><span id="spantitle1"><a name="ottsugg"><?=$this->__('Filter hints')?></a></span></h4>
314
+ <fieldset id="my-fieldset2">
315
<table cellspacing="0" class="form-list">
316
<tr>
317
+ <td><?=$this->__('Set and customize one of the following filters:')?></td>
318
</tr>
319
<tr>
320
+ <td>
321
+ <form action="*/*/" id="filtro1" name="filtro1" method="post">
322
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
323
+ <input name="mailupCustomers" type="hidden" value="2" />
324
+ <input name="mailupCustomerGroupId" type="hidden" value="2" />
325
+ <p class="parscefil"><?=$this->__("All wholesale customers who haven't purchased yet")?> &raquo;</p>
326
+ <input type="submit" value="<?=$this->__('Set filter')?>" />
327
+ <!-- <button onclick="filtro1.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
328
+ <input type="submit" value="Imposta filtro" /> -->
329
+ </form>
330
+ </td>
331
</tr>
332
<tr>
333
+ <td>
334
+ <form action="*/*/" id="filtro2" name="filtro2" method="post">
335
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
336
+ <input name="mailupCustomers" type="hidden" value="1" />
337
+ <input name="mailupTotalAmountCond" type="hidden" value="gt" />
338
+ <input name="mailupTotalAmountValue" type="hidden" value="50" />
339
+ <p class="parscefil"><?=$this->__('More than 50 Euros orders')?> &raquo;</p>
340
+ <input type="submit" value="<?=$this->__('Set filter')?>" />
341
+ <!-- <button onclick="filtro2.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
342
+ <input type="submit" value="Imposta filtro" /> -->
343
+ </form>
344
+ </td>
345
</tr>
346
<tr>
347
+ <td>
348
+ <form action="*/*/" id="filtro3" name="filtro2" method="post">
349
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
350
+ <input name="mailupCustomers" type="hidden" value="0" />
351
+ <input name="mailupOrderYesNo" type="hidden" value="no" />
352
+ <input name="mailupOrderStartDate" type="hidden" value="01/01/<?php echo date('Y'); ?>" />
353
+ <p class="parscefil"><?=$this->__('Members with no purchase in')?> <?php echo date('Y'); ?> &raquo;</p>
354
+ <input type="submit" value="<?=$this->__('Set filter')?>" />
355
+ <!-- <button onclick="filtro3.submit()" class="scalable save" type="button"><span><?=$this->__('Set filter')?></span></button>
356
+ <input type="submit" value="Imposta filtro" /> -->
357
+ </form>
358
+ </td>
359
</tr>
360
</table>
361
</fieldset>
362
+ </div>
363
+ <script type="text/javascript">
364
+ var editForm = new varienForm('edit_form');
365
+ </script>
366
+ <script type="text/javascript">
367
+ document.getElementsByClassName = function(className) {
368
+ var retnode = [];
369
+ var myclass = new RegExp('\\b'+className+'\\b');
370
+ var elements = this.getElementsByTagName('*');
371
+ var elementsLength = elements.length;
372
+ var element = null;
373
+ for (var i = 0; i < elementsLength; i++) {
374
+ element = elements[i];
375
+ if (myclass.test(element.className)) {
376
+ retnode.push(element);
377
+ }
378
+ }
379
+ return retnode;
380
+ };
381
+
382
+ function customerDependentFilters(isDisabled) {
383
+ document.getElementById('customerDependentContainer').style.display = (isDisabled) ? 'none' : 'block';
384
+
385
+ var elements = document.getElementsByClassName('customerDependent');
386
+
387
+ var elementsLength = elements.length;
388
+ for (var i=0; i < elementsLength; i++) {
389
+ elements[i].disabled = isDisabled;
390
+ }
391
+ }
392
+
393
+ window.onload = function() {
394
+ var isDisabled = document.getElementById('mailupCustomersWhoHaventBought').checked;
395
+ customerDependentFilters(isDisabled);
396
+ }
397
+ </script>
398
<?php } ?>
package.xml CHANGED
@@ -1,48 +1,55 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>MailUp</name>
4
- <version>0.2.1</version>
5
<stability>stable</stability>
6
- <license>AFL</license>
7
<channel>community</channel>
8
<extends/>
9
- <summary>MailUp is a service created in 2002, fully web-based, which allows you to send e-mail, newsletters, sms, fax, letter paper and pre-recorded voice messages.</summary>
10
- <description>MailUP &#xE8; un servizio nato nel 2002, totalmente web based , che consente l'invio di e-mail, newsletter, sms, fax, lettere cartacee e messaggi vocali pre-registrati.
11
-
12
-
13
-
14
- La soluzione &#xE8; studiata appositamente per la gestione professionale e l'invio di elevati quantitativi di messaggi, con gestione della banda, invii di test e gestione delle code di uscita. Le e-mail vengono inviate dai server di MailUp, questo garantisce elevati tassi di deliverability, evitando che le mail vengano bloccate dai filtri antispam.
15
-
16
-
17
-
18
- Installando questo Plugin per Magento potrete importare nella piattaforma MailUP i nominativi registrati nel vostro eCommerce.
19
-
20
-
21
-
22
- ===========================================================
23
-
24
-
25
-
26
- MailUp is a service created in 2002, fully web-based, which allows you to send e-mail, newsletters, sms, fax, letter paper and pre-recorded voice messages.
27
-
28
-
29
-
30
- The solution is specifically designed for the professional management and sending high volumes of messages, with bandwidth management, and management of test items of egress queues.
31
-
32
-
33
-
34
- The e-mails are sent from servers MailUp, this ensures high rates of deliverability, while ensuring that mail being blocked by spam filters.
35
-
36
- By installing this Magento plugin you can import contacts registered in your eCommerce to the MailUp platform.
37
-
38
-
39
-
40
- Professionally manage newsletters and e-mail marketing campaigns with MailUp, a robust, hosted service that's been fully integrated with Magento. MailUp is a subscription service, and the price is&#xA0;per month. You can cancel at any time, and there is an initial, 30-day free trial&lt;/description&gt;</description>
41
- <notes>Bug fixing</notes>
42
- <authors><author><name>Sevenlike</name><user>auto-converted</user><email>moduli-magento@sevenlike.com</email></author></authors>
43
- <date>2011-07-29</date>
44
- <time>13:42:09</time>
45
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="mailup.xml" hash="eda776bc6cd233c52ef06f2046969665"/></dir><dir name="template"><dir name="sevenlike"><dir name="mailup"><file name="confirm.phtml" hash="e5bc6540c9de5657852cbc116f69f37e"/><file name="filter.phtml" hash="9dcca8fc30629cc6d8bc3aefbd6920a6"/></dir></dir></dir></dir></dir></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="4f935afe2e7b1c9de7c47795bca1f206"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="e870074bec24801c911e62e4e70b61e9"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="dd3bc84f1c4273b6683a640027aa78d9"/></dir></target><target name="mageetc"><dir name="modules"><file name="SevenLike_MailUp.xml" hash="8377b55193e7524ca9572ed4dc2dca62"/></dir></target><target name="magelocal"><dir name="SevenLike"><dir name="MailUp"><dir name="controllers"><dir name="Adminhtml"><file name="FilterController.php" hash="fc75d411d37752139ad111e7595c35c9"/></dir></dir><dir name="etc"><file name="config.xml" hash="1f2dd623f0486599874b9d54ed09d857"/><file name="system.xml" hash="27b5a26b450b8bdd8b4b46900f38af45"/></dir><dir name="Helper"><file name="Data.php" hash="15b30e8e02a50054be62bb6ee2458ac5"/></dir><dir name="Model"><dir name="Mysql14"><dir name="MailUp"><file name="Collection.php" hash="1435c91e677f7b668079373599aae3eb"/></dir><file name="MailUp.php" hash="4e6e23f0eccdfe35776d1e8eab68692a"/></dir><file name="Cron.php" hash="ca450afd264de7a840d4f2c8f4916697"/><file name="Lists.php" hash="1a4c1bf8ca0135bfe48e8243b7c57070"/><file name="MailUp.php" hash="2829fb8a8ad6317ce5b2a28a2fe0149d"/><file name="Ws.php" hash="05d1bf820df3cefa8beec727448dd070"/><file name="Wssend.php" hash="2d9d936bd9dad015e4ce143c1e7653de"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="022c3ba8a7d802aba927353096c826fc"/></dir></dir></dir></dir></target></contents>
46
<compatible/>
47
- <dependencies/>
48
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>MailUp</name>
4
+ <version>0.3.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>
8
<extends/>
9
+ <summary>Filter customers based on profile and sales history, and send them targeted messages. Support automatic messages too.</summary>
10
+ <description>&lt;p&gt;MailUp is a multi-channel marketing platform, used by thousands of companies around the world to send targeted email and text messages.&lt;/p&gt;&#xD;
11
+ &lt;p&gt;Robust and scalable, MailUp can handles large volumes and has long-term relationships with all the major international ISPs, including automatic Feedback Loop management and support for List-Unsubscribe. Over 10 billion messages were sent with MailUp in 2010.&lt;/p&gt;&#xD;
12
+ &lt;p&gt;Using MailUp with your Magento store ensures a high level of deliverability for your emails.&lt;/p&gt;&#xD;
13
+ &lt;p&gt;Once you install the MailUp extension, you will be able to run professional email marketing campaigns by easily filtering customers and seemlessly passing the data to MailUp, which will handle the sending and tracking of the messages.&lt;/p&gt;&#xD;
14
+ &lt;p&gt;The MailUp extension requires a MailUp account. If you are not already a customer, setup a free trial to check it out!&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ &lt;p&gt;For more advanced marketing campaigns, leverage MailUp&#x2019;s optional Marketing+ feature. It allows you to create &#x201C;event-based&#x201D; messages that are sent automatically when a certain condition occurs (e.g. automatically send a discount to your customers on their birthday). Features include:&lt;/p&gt;&#xD;
17
+ &lt;ul&gt;&#xD;
18
+ &lt;li&gt;create unlimited &#x201C;event-based&#x201D; messages&lt;/li&gt;&#xD;
19
+ &lt;li&gt;easily turn them on/off&lt;/li&gt;&#xD;
20
+ &lt;li&gt;specify how often the system will check for the condition to occur (e.g. daily, monthly, annually, one-time)&lt;/li&gt;&#xD;
21
+ &lt;li&gt;combine multiple filters to define the condition that will trigger the message (e.g. send a second &#x201C;Welcome&#x201D; message N days after the customer subscribed)&lt;/li&gt;&#xD;
22
+ &lt;li&gt;send a message to a specific group or any subscriber&lt;/li&gt;&#xD;
23
+ &lt;li&gt;create conditions that are based on customer behavior (e.g. whether a previous message was opened or not)&lt;/li&gt;&#xD;
24
+ &lt;li&gt;use ecommerce data to as a condition to trigger messages (e.g. total amount purchased; days since last purchase; etc.)&lt;/li&gt;&#xD;
25
+ &lt;li&gt;use the same feature to send text messages (SMS) too!&lt;/li&gt;&#xD;
26
+ &lt;/ul&gt;&#xD;
27
+ &lt;p&gt;For example, store the date of the last order in a MailUp custom field, then send a discount to promote a new purchase 60 days after that last order was placed.&lt;/p&gt;&#xD;
28
+ &#xD;
29
+ &lt;p&gt;===========================================================&lt;/p&gt;&#xD;
30
+ &#xD;
31
+ &lt;p&gt;MailUp &amp;egrave; un servizio nato nel 2002, totalmente "web based" , che consente l'invio di e-mail, newsletter, sms, fax, lettere cartacee e messaggi vocali pre-registrati.&lt;/p&gt;&#xD;
32
+ &lt;p&gt;La soluzione &amp;egrave; studiata appositamente per la gestione professionale e l'invio di elevati quantitativi di messaggi, con gestione della banda, invii di test e gestione delle code di uscita.&lt;/p&gt;&#xD;
33
+ &lt;p&gt;Le e-mail vengono inviate dai server di MailUp, questo garantisce elevati tassi di deliverability, evitando che le mail vengano bloccate dai filtri antispam.&lt;/p&gt;&#xD;
34
+ &lt;p&gt;Installando questo Plugin per Magento potrete importare nella piattaforma MailUP i nominativi registrati nel vostro eCommerce.&lt;/p&gt;&#xD;
35
+ &lt;p&gt;Prova gratuitamente MailUp per 30 giorni&lt;/p&gt;&#xD;
36
+ &#xD;
37
+ &lt;p&gt;Con la funzione INVII AUTOMATICI contenuta nel pacchetto opzionale Marketing+ &amp;egrave; possibile inviare in automatico email e sms, a seconda del verificarsi di condizioni o eventi. Si potranno inviare alert, auguri di compleanno, reminder, solleciti tramite email e/o sms in base a regole predefinite, per esempio in prossimit&amp;agrave; della scadenza di un contratto o un anniversario.&lt;br /&gt;&lt;br /&gt;Tramite l'opzione INVII AUTOMATICI, &amp;egrave; possibile&lt;/p&gt;&#xD;
38
+ &lt;ul&gt;&#xD;
39
+ &lt;li&gt;creare infiniti messaggi email o sms;&lt;/li&gt;&#xD;
40
+ &lt;li&gt;stabilire il periodo in cui devono essere abilitati o meno;&lt;/li&gt;&#xD;
41
+ &lt;li&gt;la frequenza di invio (es. giornaliera, mensile o annuale);&lt;/li&gt;&#xD;
42
+ &lt;li&gt;stabilire le condizioni tramite l'utilizzo dei filtri anagrafica (es. compleanno, campi vuoti) o attivit&amp;agrave; (es. iscrizione oppure se un utente non ha aperto il messaggio si pu&amp;ograve; programmare un invio automatico di un secondo messaggio)&lt;/li&gt;&#xD;
43
+ &lt;li&gt;stabilire se inviare ad un gruppo specifico di utenti o a tutto il mio database&lt;/li&gt;&#xD;
44
+ &lt;li&gt;alimentare la banca dati tramite API o web service o procedure batch ftp notturne;&lt;/li&gt;&#xD;
45
+ &lt;li&gt;gestire e configurare automatismi tramite una intuitiva interfaccia web.&lt;/li&gt;&#xD;
46
+ &lt;/ul&gt;&#xD;
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>Refactoring to support newer versions of Magento, layout enhancements</notes>
49
+ <authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
50
+ <date>2012-01-25</date>
51
+ <time>2012-01-25</time>
52
+ <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="15b30e8e02a50054be62bb6ee2458ac5"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><file name="Cron.php" hash="ca450afd264de7a840d4f2c8f4916697"/><file name="Lists.php" hash="1a4c1bf8ca0135bfe48e8243b7c57070"/><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="Ws.php" hash="cda8d8609e9f823afc273fc7b69d7183"/><file name="Wssend.php" hash="2d9d936bd9dad015e4ce143c1e7653de"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FilterController.php" hash="fc75d411d37752139ad111e7595c35c9"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="1f2dd623f0486599874b9d54ed09d857"/><file name="system.xml" hash="27b5a26b450b8bdd8b4b46900f38af45"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="sql"><dir name="mailup_setup"><file name="mysql4-install-0.1.0.php" hash="022c3ba8a7d802aba927353096c826fc"/></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="d1cd6978de19c79a114ee7dc6afc3268"/><file name="filter.phtml" hash="8c69f953b3fc6b02abd33fa1b4596e62"/></dir></dir></dir><dir name="layout"><file name="mailup.xml" hash="eda776bc6cd233c52ef06f2046969665"/></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="4f935afe2e7b1c9de7c47795bca1f206"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="e870074bec24801c911e62e4e70b61e9"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="dd3bc84f1c4273b6683a640027aa78d9"/></dir></target></contents>
53
<compatible/>
54
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
55
</package>