Version Notes
Introduced custom filters, refactoring and fixes
Download this release
Release Info
Developer | Sevenlike |
Extension | MailUp |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.3.0 to 1.0.0
- app/code/local/SevenLike/MailUp/Model/Cron.php +14 -16
- app/code/local/SevenLike/MailUp/Model/Lists.php +13 -22
- app/code/local/SevenLike/MailUp/Model/Ws.php +64 -8
- app/code/local/SevenLike/MailUp/Model/Wssend.php +62 -58
- app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php +114 -92
- app/code/local/SevenLike/MailUp/etc/config.xml +1 -1
- app/code/local/SevenLike/MailUp/etc/system.xml +8 -7
- app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-install-0.1.0.php +2 -19
- app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.1.0-1.0.0.php +3 -0
- app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.3.0-1.0.0.php +11 -0
- app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml +98 -96
- app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml +110 -54
- app/locale/en_US/SevenLike_MailUp.csv +28 -15
- app/locale/it_IT/SevenLike_MailUp.csv +17 -5
- package.xml +5 -5
- skin/adminhtml/default/default/sevenlike/mailup/mailup.css +19 -76
app/code/local/SevenLike/MailUp/Model/Cron.php
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
<?php
|
2 |
-
//ini_set(�soap.wsdl_cache_enabled�, �0�);
|
3 |
|
4 |
class SevenLike_MailUp_Model_Cron {
|
5 |
|
6 |
-
public function run()
|
7 |
-
{
|
8 |
//echo 'lanciato';
|
9 |
if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1):
|
10 |
//Mage::log('Cron partito', null, 'danieleCron.log');
|
@@ -18,8 +17,7 @@ class SevenLike_MailUp_Model_Cron {
|
|
18 |
endif;
|
19 |
}
|
20 |
|
21 |
-
public function getCustomersCron()
|
22 |
-
{
|
23 |
//ottengo la collection con tutti i clienti
|
24 |
$customerCollection = Mage::getModel('customer/customer')->getCollection();
|
25 |
$i = 0;
|
@@ -34,7 +32,9 @@ class SevenLike_MailUp_Model_Cron {
|
|
34 |
$allOrderDates = array();
|
35 |
$allOrderTotals = array();
|
36 |
$allOrderIds = array();
|
37 |
-
|
|
|
|
|
38 |
foreach ($orders as $order):
|
39 |
$totalOrders += number_format($order->getGrandTotal(), 2, ',', '');
|
40 |
$allOrderDates[$order->getIncrementId()] = $order->getCreatedAt();
|
@@ -60,8 +60,8 @@ class SevenLike_MailUp_Model_Cron {
|
|
60 |
$toSend[$i]['firstname'] = $customer->getFirstname();
|
61 |
$toSend[$i]['lastname'] = $customer->getLastname();
|
62 |
$toSend[$i]['email'] = $customer->getEmail();
|
63 |
-
$
|
64 |
-
$toSend[$i]['registeredDate'] = $
|
65 |
|
66 |
//controllo se iscritto o meno alla newsletter
|
67 |
if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed()):
|
@@ -95,8 +95,9 @@ class SevenLike_MailUp_Model_Cron {
|
|
95 |
foreach ($items as $item):
|
96 |
$productIds[] = $item->getProductId();
|
97 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
98 |
-
if ($product->getCategoryIds())
|
99 |
$categoryIds[] = implode(",", $product->getCategoryIds());
|
|
|
100 |
endforeach;
|
101 |
|
102 |
$toSend[$i]['productIds'] = implode(",", $productIds);
|
@@ -124,15 +125,12 @@ class SevenLike_MailUp_Model_Cron {
|
|
124 |
self::saveToCsv($toSend);
|
125 |
}
|
126 |
|
127 |
-
public function saveToCsv
|
128 |
-
|
129 |
-
$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"
|
130 |
-
';
|
131 |
foreach ($toSave as $subscriber):
|
132 |
-
|
133 |
-
$file .= '"'.$subscriber['firstname'].'";"'.$subscriber['lastname'].'";"'.$subscriber['email'].'";"'.$subscriber['registeredDate'].'";"'.$subscriber['subscribed'].'";"'.$subscriber['company'].'";"'.$subscriber['countryCode'].'";"'.$subscriber['dateLastOrder'].'";"'.$subscriber['totalLastOrder'].'";"'.$subscriber['productIds'].'";"'.$subscriber['categoryIds'].'";"'.$subscriber['totalOrders'].'";"'.$subscriber['dateCart'].'";"'.$subscriber['totalCart'].'"
|
134 |
-
';
|
135 |
endforeach;
|
|
|
136 |
//Mage::log(Mage::getBaseDir('base').'/slMailupSubscribers.csv', null, 'danielePath.log');
|
137 |
$csv = fopen(Mage::getBaseDir('media').'/slMailupSubscribers.csv', 'w');
|
138 |
fwrite($csv, $file);
|
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 |
if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1):
|
9 |
//Mage::log('Cron partito', null, 'danieleCron.log');
|
17 |
endif;
|
18 |
}
|
19 |
|
20 |
+
public function getCustomersCron() {
|
|
|
21 |
//ottengo la collection con tutti i clienti
|
22 |
$customerCollection = Mage::getModel('customer/customer')->getCollection();
|
23 |
$i = 0;
|
32 |
$allOrderDates = array();
|
33 |
$allOrderTotals = array();
|
34 |
$allOrderIds = array();
|
35 |
+
|
36 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
37 |
+
->addAttributeToFilter('customer_id', $customer->getId());
|
38 |
foreach ($orders as $order):
|
39 |
$totalOrders += number_format($order->getGrandTotal(), 2, ',', '');
|
40 |
$allOrderDates[$order->getIncrementId()] = $order->getCreatedAt();
|
60 |
$toSend[$i]['firstname'] = $customer->getFirstname();
|
61 |
$toSend[$i]['lastname'] = $customer->getLastname();
|
62 |
$toSend[$i]['email'] = $customer->getEmail();
|
63 |
+
$registeredDate = explode(' ', $customer->getCreatedAt());
|
64 |
+
$toSend[$i]['registeredDate'] = $registeredDate[0];
|
65 |
|
66 |
//controllo se iscritto o meno alla newsletter
|
67 |
if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed()):
|
95 |
foreach ($items as $item):
|
96 |
$productIds[] = $item->getProductId();
|
97 |
$product = Mage::getModel('catalog/product')->load($item->getProductId());
|
98 |
+
if ($product->getCategoryIds()) {
|
99 |
$categoryIds[] = implode(",", $product->getCategoryIds());
|
100 |
+
}
|
101 |
endforeach;
|
102 |
|
103 |
$toSend[$i]['productIds'] = implode(",", $productIds);
|
125 |
self::saveToCsv($toSend);
|
126 |
}
|
127 |
|
128 |
+
public function saveToCsv($toSave) {
|
129 |
+
$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"';
|
|
|
|
|
130 |
foreach ($toSave as $subscriber):
|
131 |
+
$file .= '"'.$subscriber['firstname'].'";"'.$subscriber['lastname'].'";"'.$subscriber['email'].'";"'.$subscriber['registeredDate'].'";"'.$subscriber['subscribed'].'";"'.$subscriber['company'].'";"'.$subscriber['countryCode'].'";"'.$subscriber['dateLastOrder'].'";"'.$subscriber['totalLastOrder'].'";"'.$subscriber['productIds'].'";"'.$subscriber['categoryIds'].'";"'.$subscriber['totalOrders'].'";"'.$subscriber['dateCart'].'";"'.$subscriber['totalCart'].'"';
|
|
|
|
|
132 |
endforeach;
|
133 |
+
|
134 |
//Mage::log(Mage::getBaseDir('base').'/slMailupSubscribers.csv', null, 'danielePath.log');
|
135 |
$csv = fopen(Mage::getBaseDir('media').'/slMailupSubscribers.csv', 'w');
|
136 |
fwrite($csv, $file);
|
app/code/local/SevenLike/MailUp/Model/Lists.php
CHANGED
@@ -1,64 +1,55 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class SevenLike_MailUp_Model_Lists
|
4 |
-
{
|
5 |
|
6 |
/**
|
7 |
* Options getter
|
8 |
*
|
9 |
* @return array
|
10 |
*/
|
11 |
-
public function toOptionArray()
|
12 |
-
|
13 |
-
|
14 |
-
if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/user') && Mage::getStoreConfig('newsletter/mailup/password')){
|
15 |
-
|
16 |
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
17 |
$wsSend = new MailUpWsSend();
|
18 |
$login = $wsSend->login();
|
19 |
|
20 |
if ($login == 0) {
|
21 |
-
|
22 |
//chiamata attivazione web services su MailUp
|
23 |
$urlWSActivation = "http://".Mage::getStoreConfig('newsletter/mailup/url_console')."/frontend/WSActivation.aspx?usr=".Mage::getStoreConfig('newsletter/mailup/user')."&pwd=".Mage::getStoreConfig('newsletter/mailup/password')."&nl_url=".Mage::getStoreConfig('newsletter/mailup/url_console')."&ws_name=WSMailUpImport";
|
24 |
fopen($urlWSActivation, "r");
|
25 |
|
26 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
27 |
-
|
28 |
$wsImport = new MailUpWsImport();
|
29 |
|
30 |
$xmlString = $wsImport->GetNlList();
|
31 |
|
32 |
-
if ($xmlString){
|
33 |
-
|
34 |
$xmlString = html_entity_decode($xmlString);
|
35 |
|
36 |
$startLists = strpos($xmlString, '<Lists>');
|
37 |
$endPos = strpos($xmlString, '</Lists>');
|
38 |
$endLists = $endPos + strlen('</Lists>') - $startLists;
|
39 |
-
|
40 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
|
|
|
|
|
|
41 |
$xml = simplexml_load_string($xmlLists);
|
42 |
-
|
43 |
-
$magentoList = 0;
|
44 |
-
|
45 |
//genero la select per Magento
|
46 |
-
$selectLists = array();
|
47 |
$selectLists[0] = array('value' => 0, 'label'=>'-----');
|
48 |
$count = 1;
|
49 |
-
|
50 |
foreach($xml->List as $list) {
|
51 |
$selectLists[$count] = array('value' => $list['listGUID'], 'label'=> $list['listName']);
|
52 |
$count++;
|
53 |
}
|
54 |
-
|
55 |
-
return $selectLists;
|
56 |
-
|
57 |
}
|
58 |
-
|
59 |
}
|
60 |
-
|
61 |
}
|
|
|
|
|
62 |
}
|
63 |
|
64 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class SevenLike_MailUp_Model_Lists {
|
|
|
4 |
|
5 |
/**
|
6 |
* Options getter
|
7 |
*
|
8 |
* @return array
|
9 |
*/
|
10 |
+
public function toOptionArray() {
|
11 |
+
$selectLists = array();
|
12 |
+
|
13 |
+
if (Mage::getStoreConfig('newsletter/mailup/url_console') && Mage::getStoreConfig('newsletter/mailup/user') && Mage::getStoreConfig('newsletter/mailup/password')) {
|
|
|
14 |
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
15 |
$wsSend = new MailUpWsSend();
|
16 |
$login = $wsSend->login();
|
17 |
|
18 |
if ($login == 0) {
|
|
|
19 |
//chiamata attivazione web services su MailUp
|
20 |
$urlWSActivation = "http://".Mage::getStoreConfig('newsletter/mailup/url_console')."/frontend/WSActivation.aspx?usr=".Mage::getStoreConfig('newsletter/mailup/user')."&pwd=".Mage::getStoreConfig('newsletter/mailup/password')."&nl_url=".Mage::getStoreConfig('newsletter/mailup/url_console')."&ws_name=WSMailUpImport";
|
21 |
fopen($urlWSActivation, "r");
|
22 |
|
23 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
|
|
24 |
$wsImport = new MailUpWsImport();
|
25 |
|
26 |
$xmlString = $wsImport->GetNlList();
|
27 |
|
28 |
+
if ($xmlString) {
|
|
|
29 |
$xmlString = html_entity_decode($xmlString);
|
30 |
|
31 |
$startLists = strpos($xmlString, '<Lists>');
|
32 |
$endPos = strpos($xmlString, '</Lists>');
|
33 |
$endLists = $endPos + strlen('</Lists>') - $startLists;
|
34 |
+
|
35 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
36 |
+
|
37 |
+
$xmlLists = str_replace("&", "&", $xmlLists);
|
38 |
+
|
39 |
$xml = simplexml_load_string($xmlLists);
|
40 |
+
|
|
|
|
|
41 |
//genero la select per Magento
|
|
|
42 |
$selectLists[0] = array('value' => 0, 'label'=>'-----');
|
43 |
$count = 1;
|
|
|
44 |
foreach($xml->List as $list) {
|
45 |
$selectLists[$count] = array('value' => $list['listGUID'], 'label'=> $list['listName']);
|
46 |
$count++;
|
47 |
}
|
|
|
|
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
}
|
51 |
+
|
52 |
+
return $selectLists;
|
53 |
}
|
54 |
|
55 |
}
|
app/code/local/SevenLike/MailUp/Model/Ws.php
CHANGED
@@ -14,12 +14,12 @@ class MailUpWsImport {
|
|
14 |
|
15 |
function __construct() {
|
16 |
$urlConsole = Mage::getStoreConfig('newsletter/mailup/url_console');
|
17 |
-
$WSDLUrl =
|
18 |
$user = Mage::getStoreConfig('newsletter/mailup/user');
|
19 |
$password = Mage::getStoreConfig('newsletter/mailup/password');
|
20 |
-
$headers = array(
|
21 |
-
$this->header = new SOAPHeader($this->ns,
|
22 |
-
$this->soapClient = new SoapClient($WSDLUrl, array(
|
23 |
$this->soapClient->__setSoapHeaders($this->header);
|
24 |
}
|
25 |
|
@@ -49,7 +49,7 @@ class MailUpWsImport {
|
|
49 |
$this->printLastResponse();
|
50 |
return $this->soapClient->__getLastResponse();
|
51 |
} catch (SoapFault $soapFault) {
|
52 |
-
var_dump($soapFault);
|
53 |
}
|
54 |
}
|
55 |
|
@@ -452,17 +452,17 @@ class MailUpWsImport {
|
|
452 |
if ($filterStart && $filterEnd) {
|
453 |
//compreso tra start e end date
|
454 |
if ($createdAt >= $filterStart && $createdAt <= $filterEnd) {
|
455 |
-
|
456 |
}
|
457 |
} elseif ($filterStart) {
|
458 |
// >= di start date
|
459 |
if ($createdAt >= $filterStart) {
|
460 |
-
|
461 |
}
|
462 |
} else {
|
463 |
// <= di end date
|
464 |
if ($createdAt <= $filterEnd) {
|
465 |
-
|
466 |
}
|
467 |
}
|
468 |
|
@@ -524,4 +524,60 @@ class MailUpWsImport {
|
|
524 |
|
525 |
return $customersFiltered;
|
526 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
}
|
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 |
|
49 |
$this->printLastResponse();
|
50 |
return $this->soapClient->__getLastResponse();
|
51 |
} catch (SoapFault $soapFault) {
|
52 |
+
Mage::log(var_dump($soapFault), 0);
|
53 |
}
|
54 |
}
|
55 |
|
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 |
|
524 |
|
525 |
return $customersFiltered;
|
526 |
}
|
527 |
+
|
528 |
+
|
529 |
+
public function getFilterHints() {
|
530 |
+
$filter_hints = array();
|
531 |
+
try {
|
532 |
+
// fetch write database connection that is used in Mage_Core module
|
533 |
+
$connectionRead = Mage::getSingleton('core/resource')->getConnection('core_read');
|
534 |
+
|
535 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
536 |
+
$result = $connectionRead->query("select * from mailup_filter_hints");
|
537 |
+
|
538 |
+
while ($row = $result->fetch()) {
|
539 |
+
array_push($filter_hints, array('filter_name' => $row['filter_name'], 'hints' => $row['hints']));
|
540 |
+
}
|
541 |
+
} catch (Exception $e) {
|
542 |
+
die($e);
|
543 |
+
}
|
544 |
+
|
545 |
+
return $filter_hints;
|
546 |
+
}
|
547 |
+
|
548 |
+
public function saveFilterHint($filter_name, $post) {
|
549 |
+
try {
|
550 |
+
$hints = '';
|
551 |
+
//TODO: concateno le coppie filtri-valori selezionati in post
|
552 |
+
foreach ($post as $k => $v) {
|
553 |
+
if ($v!='' && $k!='form_key') {
|
554 |
+
if ($hints!='') {
|
555 |
+
$hints .= '|';
|
556 |
+
}
|
557 |
+
$hints .= $k.'='.$v;
|
558 |
+
}
|
559 |
+
}
|
560 |
+
//$hints = 'mailupCustomers=2|mailupSubscribed=1';
|
561 |
+
|
562 |
+
// fetch write database connection that is used in Mage_Core module
|
563 |
+
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
564 |
+
|
565 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
566 |
+
$connectionWrite->query("INSERT INTO mailup_filter_hints (filter_name, hints) VALUES ('".$filter_name."', '".$hints."')");
|
567 |
+
} catch (Exception $e) {
|
568 |
+
die($e);
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
public function deleteFilterHint($filter_name) {
|
573 |
+
try {
|
574 |
+
// fetch write database connection that is used in Mage_Core module
|
575 |
+
$connectionWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
|
576 |
+
|
577 |
+
// now $write is an instance of Zend_Db_Adapter_Abstract
|
578 |
+
$connectionWrite->query("DELETE FROM mailup_filter_hints WHERE filter_name LIKE '".$filter_name."'");
|
579 |
+
} catch (Exception $e) {
|
580 |
+
die($e);
|
581 |
+
}
|
582 |
+
}
|
583 |
}
|
app/code/local/SevenLike/MailUp/Model/Wssend.php
CHANGED
@@ -7,9 +7,7 @@ class MailUpWsSend {
|
|
7 |
protected $domResult;
|
8 |
|
9 |
function __construct() {
|
10 |
-
$this->soapClient = new SoapClient($this->WSDLUrl,
|
11 |
-
array("trace" => 1,
|
12 |
-
"exceptions" => 0));
|
13 |
}
|
14 |
|
15 |
function __destruct() {
|
@@ -21,18 +19,17 @@ class MailUpWsSend {
|
|
21 |
}
|
22 |
|
23 |
public function login() {
|
24 |
-
|
25 |
$loginData = array("user" => Mage::getStoreConfig('newsletter/mailup/user'),
|
26 |
"pwd" => Mage::getStoreConfig('newsletter/mailup/password'),
|
27 |
"url" => Mage::getStoreConfig('newsletter/mailup/url_console'));
|
28 |
|
29 |
$result = get_object_vars($this->soapClient->Login($loginData));
|
30 |
$xml = simplexml_load_string($result['LoginResult']);
|
31 |
-
|
32 |
-
|
33 |
-
//echo $xml['errorDescription'];
|
34 |
|
35 |
-
|
|
|
|
|
36 |
|
37 |
/* echo strlen($result['LoginResult']);
|
38 |
if (strlen($result['LoginResult']) == 295)
|
@@ -43,19 +40,17 @@ class MailUpWsSend {
|
|
43 |
}
|
44 |
|
45 |
public function loginTest() {
|
46 |
-
|
47 |
-
$loginData = array("user" => "a7410",
|
48 |
-
"pwd" => "GA6VAN0W",
|
49 |
-
"url" => "g4a0.s03.it");
|
50 |
|
51 |
$result = get_object_vars($this->soapClient->Login($loginData));
|
52 |
$xml = simplexml_load_string($result['LoginResult']);
|
53 |
-
|
54 |
|
55 |
-
if ($xml['errorCode'] > 0)
|
56 |
echo $xml['errorDescription'].'<br /><br />';
|
|
|
57 |
|
58 |
-
|
59 |
|
60 |
/* echo strlen($result['LoginResult']);
|
61 |
if (strlen($result['LoginResult']) == 295)
|
@@ -66,30 +61,32 @@ class MailUpWsSend {
|
|
66 |
}
|
67 |
|
68 |
public function testSoap() {
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
|
74 |
public function logout() {
|
75 |
try {
|
76 |
$this->soapClient->Logout(array("accessKey" => $this->accessKey));
|
77 |
-
if ($this->readReturnCode("Logout","errorCode") != 0)
|
78 |
echo "<br /><br />Errore Logout". $this->readReturnCode("Logout","errorDescription");
|
|
|
79 |
} catch (SoapFault $soapFault) {
|
80 |
-
|
81 |
}
|
82 |
}
|
83 |
|
84 |
public function getLists() {
|
85 |
try {
|
86 |
$this->soapClient->GetLists(array("accessKey" => $this->accessKey));
|
87 |
-
if ($this->readReturnCode("GetLists","errorCode") != 0)
|
88 |
echo "<br /><br />Errore GetLists: ". $this->readReturnCode("GetLists","errorDescription");
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
93 |
}
|
94 |
}
|
95 |
|
@@ -97,12 +94,13 @@ class MailUpWsSend {
|
|
97 |
try {
|
98 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
99 |
$this->soapClient->GetGroups($params);
|
100 |
-
if ($this->readReturnCode("GetGroups","errorCode") != 0)
|
101 |
echo "<br /><br />Errore GetGroups: ". $this->readReturnCode("GetGroups","errorDescription");
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
106 |
}
|
107 |
}
|
108 |
|
@@ -110,12 +108,13 @@ class MailUpWsSend {
|
|
110 |
try {
|
111 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
112 |
$this->soapClient->GetNewsletters($params);
|
113 |
-
if ($this->readReturnCode("GetNewsletters","errorCode") != 0)
|
114 |
echo "<br /><br />Errore GetNewsletters: ". $this->readReturnCode("GetNewsletters","errorDescription");
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
119 |
}
|
120 |
}
|
121 |
|
@@ -123,13 +122,15 @@ class MailUpWsSend {
|
|
123 |
try {
|
124 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
125 |
$this->soapClient->createNewsletter($params);
|
126 |
-
|
127 |
-
|
|
|
128 |
echo "<br /><br />Errore CreateNewsletter: ". $this->readReturnCode("CreateNewsletter","errorCode") ." - " . $this->readReturnCode("CreateNewsletter","errorDescription");
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
133 |
}
|
134 |
}
|
135 |
|
@@ -139,12 +140,13 @@ class MailUpWsSend {
|
|
139 |
$this->soapClient->SendNewsletter($params);
|
140 |
var_dump($params);
|
141 |
$this->printLastRequest();
|
142 |
-
if ($this->readReturnCode("SendNewsletter","errorCode") != 0)
|
143 |
echo "<br /><br />Errore SendNewsletter: ". $this->readReturnCode("SendNewsletter","errorCode") ." - " .$this->readReturnCode("SendNewsletter","errorDescription");
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
148 |
}
|
149 |
}
|
150 |
|
@@ -154,29 +156,31 @@ class MailUpWsSend {
|
|
154 |
$this->soapClient->SendNewsletterFast($params);
|
155 |
|
156 |
$this->printLastRequest();
|
157 |
-
if ($this->readReturnCode("SendNewsletterFast","errorCode") != 0)
|
158 |
echo "<br /><br />Errore SendNewsletterFast: ". $this->readReturnCode("SendNewsletterFast","errorCode") ." - " .$this->readReturnCode("SendNewsletterFast","errorDescription");
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
163 |
}
|
164 |
}
|
165 |
|
166 |
private function readReturnCode($func, $param) {
|
167 |
-
static $func_in =
|
168 |
-
if ($func_in != $func) {//(!isset($this->xmlResponse))
|
169 |
$func_in = $func;
|
170 |
-
//prendi l'XML di ritorno se non l'ho
|
171 |
$this->xmlResponse = $this->soapClient->__getLastResponse();
|
172 |
|
173 |
$dom = new DomDocument();
|
174 |
-
$dom->loadXML($this->xmlResponse) or die(
|
175 |
-
$xmlResult = $dom->getElementsByTagName($func.
|
176 |
|
177 |
$this->domResult = new DomDocument();
|
178 |
-
$this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die(
|
179 |
}
|
|
|
180 |
$rCode = $this->domResult->getElementsByTagName($param);
|
181 |
return $rCode->item(0)->nodeValue;
|
182 |
}
|
7 |
protected $domResult;
|
8 |
|
9 |
function __construct() {
|
10 |
+
$this->soapClient = new SoapClient($this->WSDLUrl, array("trace" => 1, "exceptions" => 0));
|
|
|
|
|
11 |
}
|
12 |
|
13 |
function __destruct() {
|
19 |
}
|
20 |
|
21 |
public function login() {
|
|
|
22 |
$loginData = array("user" => Mage::getStoreConfig('newsletter/mailup/user'),
|
23 |
"pwd" => Mage::getStoreConfig('newsletter/mailup/password'),
|
24 |
"url" => Mage::getStoreConfig('newsletter/mailup/url_console'));
|
25 |
|
26 |
$result = get_object_vars($this->soapClient->Login($loginData));
|
27 |
$xml = simplexml_load_string($result['LoginResult']);
|
28 |
+
$xml = get_object_vars($xml);
|
|
|
|
|
29 |
|
30 |
+
//echo $xml['errorDescription'];
|
31 |
+
|
32 |
+
return $xml['errorCode'];
|
33 |
|
34 |
/* echo strlen($result['LoginResult']);
|
35 |
if (strlen($result['LoginResult']) == 295)
|
40 |
}
|
41 |
|
42 |
public function loginTest() {
|
43 |
+
$loginData = array("user" => "a7410", "pwd" => "GA6VAN0W", "url" => "g4a0.s03.it");
|
|
|
|
|
|
|
44 |
|
45 |
$result = get_object_vars($this->soapClient->Login($loginData));
|
46 |
$xml = simplexml_load_string($result['LoginResult']);
|
47 |
+
$xml = get_object_vars($xml);
|
48 |
|
49 |
+
if ($xml['errorCode'] > 0) {
|
50 |
echo $xml['errorDescription'].'<br /><br />';
|
51 |
+
}
|
52 |
|
53 |
+
return $xml['errorCode'];
|
54 |
|
55 |
/* echo strlen($result['LoginResult']);
|
56 |
if (strlen($result['LoginResult']) == 295)
|
61 |
}
|
62 |
|
63 |
public function testSoap() {
|
64 |
+
$client = new SoapClient('http://soapclient.com/xml/soapresponder.wsdl');
|
65 |
+
//print_r($client->__getFunctions());
|
66 |
+
return $client->Method1('x12qaq','c56tf3');
|
67 |
+
}
|
68 |
|
69 |
public function logout() {
|
70 |
try {
|
71 |
$this->soapClient->Logout(array("accessKey" => $this->accessKey));
|
72 |
+
if ($this->readReturnCode("Logout","errorCode") != 0) {
|
73 |
echo "<br /><br />Errore Logout". $this->readReturnCode("Logout","errorDescription");
|
74 |
+
}
|
75 |
} catch (SoapFault $soapFault) {
|
76 |
+
var_dump($soapFault);
|
77 |
}
|
78 |
}
|
79 |
|
80 |
public function getLists() {
|
81 |
try {
|
82 |
$this->soapClient->GetLists(array("accessKey" => $this->accessKey));
|
83 |
+
if ($this->readReturnCode("GetLists","errorCode") != 0) {
|
84 |
echo "<br /><br />Errore GetLists: ". $this->readReturnCode("GetLists","errorDescription");
|
85 |
+
} else {
|
86 |
+
$this->printLastResponse();
|
87 |
+
}
|
88 |
+
} catch (SoapFault $soapFault) {
|
89 |
+
var_dump($soapFault);
|
90 |
}
|
91 |
}
|
92 |
|
94 |
try {
|
95 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
96 |
$this->soapClient->GetGroups($params);
|
97 |
+
if ($this->readReturnCode("GetGroups","errorCode") != 0) {
|
98 |
echo "<br /><br />Errore GetGroups: ". $this->readReturnCode("GetGroups","errorDescription");
|
99 |
+
} else {
|
100 |
+
$this->printLastResponse();
|
101 |
+
}
|
102 |
+
} catch (SoapFault $soapFault) {
|
103 |
+
var_dump($soapFault);
|
104 |
}
|
105 |
}
|
106 |
|
108 |
try {
|
109 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
110 |
$this->soapClient->GetNewsletters($params);
|
111 |
+
if ($this->readReturnCode("GetNewsletters","errorCode") != 0) {
|
112 |
echo "<br /><br />Errore GetNewsletters: ". $this->readReturnCode("GetNewsletters","errorDescription");
|
113 |
+
} else {
|
114 |
+
$this->printLastResponse();
|
115 |
+
}
|
116 |
+
} catch (SoapFault $soapFault) {
|
117 |
+
var_dump($soapFault);
|
118 |
}
|
119 |
}
|
120 |
|
122 |
try {
|
123 |
$params = array_merge((array)$params, array("accessKey" => $this->accessKey));
|
124 |
$this->soapClient->createNewsletter($params);
|
125 |
+
|
126 |
+
$this->printLastRequest();
|
127 |
+
if ($this->readReturnCode("CreateNewsletter","errorCode") != 0) {
|
128 |
echo "<br /><br />Errore CreateNewsletter: ". $this->readReturnCode("CreateNewsletter","errorCode") ." - " . $this->readReturnCode("CreateNewsletter","errorDescription");
|
129 |
+
} else {
|
130 |
+
$this->printLastResponse();
|
131 |
+
}
|
132 |
+
} catch (SoapFault $soapFault) {
|
133 |
+
var_dump($soapFault);
|
134 |
}
|
135 |
}
|
136 |
|
140 |
$this->soapClient->SendNewsletter($params);
|
141 |
var_dump($params);
|
142 |
$this->printLastRequest();
|
143 |
+
if ($this->readReturnCode("SendNewsletter","errorCode") != 0) {
|
144 |
echo "<br /><br />Errore SendNewsletter: ". $this->readReturnCode("SendNewsletter","errorCode") ." - " .$this->readReturnCode("SendNewsletter","errorDescription");
|
145 |
+
} else {
|
146 |
+
$this->printLastResponse();
|
147 |
+
}
|
148 |
+
} catch (SoapFault $soapFault) {
|
149 |
+
var_dump($soapFault);
|
150 |
}
|
151 |
}
|
152 |
|
156 |
$this->soapClient->SendNewsletterFast($params);
|
157 |
|
158 |
$this->printLastRequest();
|
159 |
+
if ($this->readReturnCode("SendNewsletterFast","errorCode") != 0) {
|
160 |
echo "<br /><br />Errore SendNewsletterFast: ". $this->readReturnCode("SendNewsletterFast","errorCode") ." - " .$this->readReturnCode("SendNewsletterFast","errorDescription");
|
161 |
+
} else {
|
162 |
+
$this->printLastResponse();
|
163 |
+
}
|
164 |
+
} catch (SoapFault $soapFault) {
|
165 |
+
var_dump($soapFault);
|
166 |
}
|
167 |
}
|
168 |
|
169 |
private function readReturnCode($func, $param) {
|
170 |
+
static $func_in = ''; //static variable to test xmlResponse update
|
171 |
+
if ($func_in != $func) { //(!isset($this->xmlResponse))
|
172 |
$func_in = $func;
|
173 |
+
//prendi l'XML di ritorno se non l'ho gia' preso
|
174 |
$this->xmlResponse = $this->soapClient->__getLastResponse();
|
175 |
|
176 |
$dom = new DomDocument();
|
177 |
+
$dom->loadXML($this->xmlResponse) or die('File XML non valido!');
|
178 |
+
$xmlResult = $dom->getElementsByTagName($func.'Result');
|
179 |
|
180 |
$this->domResult = new DomDocument();
|
181 |
+
$this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die('File XML non valido!');
|
182 |
}
|
183 |
+
|
184 |
$rCode = $this->domResult->getElementsByTagName($param);
|
185 |
return $rCode->item(0)->nodeValue;
|
186 |
}
|
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php
CHANGED
@@ -1,112 +1,101 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Controller_Action
|
4 |
-
|
5 |
-
public function indexAction()
|
6 |
-
{
|
7 |
$this->loadLayout()->renderLayout();
|
8 |
}
|
9 |
|
10 |
-
public function confirmAction()
|
11 |
-
|
12 |
-
$this->loadLayout()->renderLayout();
|
13 |
}
|
14 |
|
15 |
-
public function csvAction()
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
$file = '';
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
';
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
foreach ($subscribers as $subscriber) {
|
40 |
-
$file .= '"'.$subscriber['firstname'].'";"'.$subscriber['lastname'].'";"'.$subscriber['email'].'"
|
41 |
-
';
|
42 |
}
|
43 |
-
*/
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
//lancio il download del file
|
48 |
-
header("Content-Disposition: attachment;Filename=clienti_filtrati.csv");
|
49 |
-
echo $file;
|
50 |
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
-
public function postAction()
|
54 |
-
{
|
55 |
$post = $this->getRequest()->getPost();
|
56 |
-
|
|
|
57 |
try {
|
58 |
if (empty($post)) {
|
59 |
Mage::throwException($this->__('Invalid form data.'));
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
}
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
"listGUID" => $listGUID,
|
111 |
"idGroup" => $groupId,
|
112 |
"xmlDoc" => $xmlData,
|
@@ -120,28 +109,61 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
|
|
120 |
"replaceGroups" => "0",
|
121 |
"idConfirmNL" => "0");
|
122 |
|
123 |
-
|
124 |
-
|
125 |
|
126 |
-
|
127 |
-
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
|
133 |
-
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
138 |
|
139 |
$message = $this->__('Gli iscritti sono stati inviati correttamente');
|
140 |
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
141 |
} catch (Exception $e) {
|
142 |
-
|
143 |
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
144 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
$this->_redirect('*/*');
|
146 |
}
|
147 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Controller_Action {
|
4 |
+
|
5 |
+
public function indexAction() {
|
|
|
6 |
$this->loadLayout()->renderLayout();
|
7 |
}
|
8 |
|
9 |
+
public function confirmAction() {
|
10 |
+
$this->loadLayout()->renderLayout();
|
|
|
11 |
}
|
12 |
|
13 |
+
public function csvAction() {
|
14 |
+
$post = $this->getRequest()->getPost();
|
15 |
+
$mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
|
16 |
+
//$subscribers = array();
|
17 |
+
$file = '';
|
|
|
18 |
|
19 |
+
if ($post['countPost'] > 0) {
|
20 |
+
//preparo l'elenco degli iscritti da salvare nel csv
|
21 |
+
foreach ($mailupCustomerIds as $customerId) {
|
22 |
+
if ($customerId['entity_id'] > 0) {
|
23 |
+
$customer = Mage::getModel('customer/customer')->load($customerId['entity_id']);
|
24 |
+
$subscriber = $customer->toArray();
|
25 |
+
} else {
|
26 |
+
$subscriber = array('firstname'=>'','lastname'=>'','email'=>$customerId['email']);
|
27 |
+
}
|
28 |
+
$file .= '"'.$subscriber['firstname'].'";"'.$subscriber['lastname'].'";"'.$subscriber['email'].'"';
|
29 |
+
}
|
30 |
+
|
31 |
+
/*
|
32 |
+
foreach ($subscribers as $subscriber) {
|
33 |
+
$file .= '"'.$subscriber['firstname'].'";"'.$subscriber['lastname'].'";"'.$subscriber['email'].'"';
|
34 |
+
}
|
35 |
+
*/
|
|
|
|
|
|
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
//lancio il download del file
|
39 |
+
header("Content-Disposition: attachment;Filename=clienti_filtrati.csv");
|
40 |
+
echo $file;
|
41 |
}
|
42 |
|
43 |
+
public function postAction() {
|
|
|
44 |
$post = $this->getRequest()->getPost();
|
45 |
+
$mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
|
46 |
+
|
47 |
try {
|
48 |
if (empty($post)) {
|
49 |
Mage::throwException($this->__('Invalid form data.'));
|
50 |
}
|
51 |
|
52 |
+
//preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
|
53 |
+
$xmlData = '<subscribers>';
|
54 |
|
55 |
+
foreach ($mailupCustomerIds as $customerId) {
|
56 |
+
if ($customerId['entity_id'] > 0) {
|
57 |
+
$customer = Mage::getModel('customer/customer')->load($customerId['entity_id']);
|
58 |
+
$subscriber = $customer->toArray();
|
59 |
+
$xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name=""><campo1>'.$subscriber['firstname'].'</campo1><campo2>'.$subscriber['lastname'].'</campo2></subscriber>';
|
60 |
+
} else {
|
61 |
+
$subscriber = array('firstname'=>'','lastname'=>'','email'=>$customerId['email']);
|
62 |
+
$xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name=""><campo1>'.$subscriber['firstname'].'</campo1><campo2>'.$subscriber['lastname'].'</campo2></subscriber>';
|
63 |
+
}
|
64 |
+
}
|
|
|
65 |
|
66 |
+
/*foreach ($post['mailupCustomerIds'] as $customerId) {
|
67 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
68 |
+
$subscribers[] = $customer->toArray();
|
69 |
+
}*/
|
70 |
|
71 |
+
//$xmlData = '<subscribers>';
|
72 |
|
73 |
+
/*
|
74 |
+
foreach ($subscribers as $subscriber) {
|
75 |
+
$xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name=""><campo1>'.$subscriber['firstname'].'</campo1><campo2>'.$subscriber['lastname'].'</campo2></subscriber>';
|
76 |
+
}
|
77 |
+
*/
|
78 |
|
79 |
+
$xmlData .= '</subscribers>';
|
80 |
|
81 |
+
//invio a mailup gli iscritti da aggiungere al gruppo scelto
|
82 |
+
$MailUpWsImport = Mage::getModel('mailup/ws');
|
83 |
+
$wsImport = new MailUpWsImport();
|
84 |
|
85 |
+
//definisco il gruppo a cui aggiungere gli iscritti
|
86 |
+
$groupId = $post['mailupGroupId'];
|
87 |
+
$listGUID = $post['mailupListGUID'];
|
88 |
+
$idList = $post['mailupIdList'];
|
89 |
|
90 |
+
if ($post['mailupNewGroup'] == 1) {
|
91 |
+
$newGroup = array("idList" => $idList,
|
92 |
+
"listGUID" => $listGUID,
|
93 |
+
"newGroupName" => $post['mailupNewGroupName']);
|
94 |
|
95 |
+
$groupId = $wsImport->CreaGruppo($newGroup);
|
96 |
+
}
|
97 |
|
98 |
+
$importProcessData = array("idList" => $idList,
|
99 |
"listGUID" => $listGUID,
|
100 |
"idGroup" => $groupId,
|
101 |
"xmlDoc" => $xmlData,
|
109 |
"replaceGroups" => "0",
|
110 |
"idConfirmNL" => "0");
|
111 |
|
112 |
+
//echo '<br /><br />Subscribers: ';
|
113 |
+
//print_r($importProcessData);
|
114 |
|
115 |
+
//avvio l'importazione su mailup
|
116 |
+
$processID = $wsImport->newImportProcess($importProcessData);
|
117 |
|
118 |
+
$process = array("idList" => $post['mailupIdList'],
|
119 |
+
"listGUID" => $post['mailupListGUID'],
|
120 |
+
"idProcess" => $processID );
|
121 |
|
122 |
+
$wsImport->startProcess($process);
|
123 |
|
124 |
+
//echo $wsImport->getProcessDetail($process);
|
125 |
|
126 |
+
//fine processo
|
127 |
|
128 |
$message = $this->__('Gli iscritti sono stati inviati correttamente');
|
129 |
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
130 |
} catch (Exception $e) {
|
131 |
+
$errorMessage = $this->__('Attenzione: non hai inviato nessun iscritto');
|
132 |
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
133 |
}
|
134 |
+
|
135 |
+
$this->_redirect('*/*');
|
136 |
+
}
|
137 |
+
|
138 |
+
public function saveFilterHintAction() {
|
139 |
+
try {
|
140 |
+
$post = $this->getRequest()->getPost();
|
141 |
+
$filter_name = $post['filter_name'];
|
142 |
+
unset($post['filter_name']);
|
143 |
+
|
144 |
+
$MailUpWsImport = Mage::getModel('mailup/ws');
|
145 |
+
$wsImport = new MailUpWsImport();
|
146 |
+
$wsImport->saveFilterHint($filter_name, $post);
|
147 |
+
} catch (Exception $e) {
|
148 |
+
$errorMessage = $this->__('Errore: impossibile salvare il filtro corrente');
|
149 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
150 |
+
}
|
151 |
+
|
152 |
+
$this->_redirect('*/*');
|
153 |
+
}
|
154 |
+
|
155 |
+
public function deleteFilterHintAction() {
|
156 |
+
try {
|
157 |
+
$post = $this->getRequest()->getPost();
|
158 |
+
|
159 |
+
$MailUpWsImport = Mage::getModel('mailup/ws');
|
160 |
+
$wsImport = new MailUpWsImport();
|
161 |
+
$wsImport->deleteFilterHint($post['filter_name']);
|
162 |
+
} catch (Exception $e) {
|
163 |
+
$errorMessage = $this->__('Errore: impossibile eliminare il filtro selezionato');
|
164 |
+
Mage::getSingleton('adminhtml/session')->addError($errorMessage);
|
165 |
+
}
|
166 |
+
|
167 |
$this->_redirect('*/*');
|
168 |
}
|
169 |
}
|
app/code/local/SevenLike/MailUp/etc/config.xml
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
|
26 |
<modules>
|
27 |
<SevenLike_MailUp>
|
28 |
-
<version>0.
|
29 |
</SevenLike_MailUp>
|
30 |
</modules>
|
31 |
|
25 |
|
26 |
<modules>
|
27 |
<SevenLike_MailUp>
|
28 |
+
<version>1.0.0</version>
|
29 |
</SevenLike_MailUp>
|
30 |
</modules>
|
31 |
|
app/code/local/SevenLike/MailUp/etc/system.xml
CHANGED
@@ -26,26 +26,26 @@
|
|
26 |
<newsletter>
|
27 |
<groups>
|
28 |
<mailup translate="label">
|
29 |
-
<label>MailUp Settings</label>
|
30 |
<frontend_type>text</frontend_type>
|
31 |
<sort_order>0</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<fields>
|
34 |
<url_console translate="comment">
|
35 |
-
<label>
|
36 |
<frontend_type>text</frontend_type>
|
37 |
<sort_order>10</sort_order>
|
38 |
<show_in_default>1</show_in_default>
|
39 |
-
<comment>
|
40 |
</url_console>
|
41 |
<user translate="label">
|
42 |
-
<label>User
|
43 |
<frontend_type>text</frontend_type>
|
44 |
<sort_order>40</sort_order>
|
45 |
<show_in_default>1</show_in_default>
|
46 |
</user>
|
47 |
<password translate="label">
|
48 |
-
<label>Password
|
49 |
<frontend_type>password</frontend_type>
|
50 |
<sort_order>50</sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
@@ -56,14 +56,15 @@
|
|
56 |
<source_model>mailup/lists</source_model>
|
57 |
<sort_order>60</sort_order>
|
58 |
<show_in_default>1</show_in_default>
|
59 |
-
|
60 |
</list>
|
61 |
<enable_cron_export tranlate="label">
|
62 |
-
<label>Enable
|
63 |
<frontend_type>select</frontend_type>
|
64 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
65 |
<sort_order>70</sort_order>
|
66 |
<show_in_default>1</show_in_default>
|
|
|
67 |
</enable_cron_export>
|
68 |
</fields>
|
69 |
</mailup>
|
26 |
<newsletter>
|
27 |
<groups>
|
28 |
<mailup translate="label">
|
29 |
+
<label>MailUp Extension Settings</label>
|
30 |
<frontend_type>text</frontend_type>
|
31 |
<sort_order>0</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<fields>
|
34 |
<url_console translate="comment">
|
35 |
+
<label>Admin Console URL</label>
|
36 |
<frontend_type>text</frontend_type>
|
37 |
<sort_order>10</sort_order>
|
38 |
<show_in_default>1</show_in_default>
|
39 |
+
<comment>It’s the domain portion of the browser address field when you using the MailUp Admin console (e.g. g4a0.s03.it)</comment>
|
40 |
</url_console>
|
41 |
<user translate="label">
|
42 |
+
<label>API User Name</label>
|
43 |
<frontend_type>text</frontend_type>
|
44 |
<sort_order>40</sort_order>
|
45 |
<show_in_default>1</show_in_default>
|
46 |
</user>
|
47 |
<password translate="label">
|
48 |
+
<label>API Password</label>
|
49 |
<frontend_type>password</frontend_type>
|
50 |
<sort_order>50</sort_order>
|
51 |
<show_in_default>1</show_in_default>
|
56 |
<source_model>mailup/lists</source_model>
|
57 |
<sort_order>60</sort_order>
|
58 |
<show_in_default>1</show_in_default>
|
59 |
+
<!--comment>If you haven't yet, we suggest you to create a DEM list directly from your mailup console</comment-->
|
60 |
</list>
|
61 |
<enable_cron_export tranlate="label">
|
62 |
+
<label>Enable Automatic Data Export</label>
|
63 |
<frontend_type>select</frontend_type>
|
64 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
65 |
<sort_order>70</sort_order>
|
66 |
<show_in_default>1</show_in_default>
|
67 |
+
<comment>Contact your account MailUp account representative for more information about this feature.</comment>
|
68 |
</enable_cron_export>
|
69 |
</fields>
|
70 |
</mailup>
|
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-install-0.1.0.php
CHANGED
@@ -1,21 +1,4 @@
|
|
1 |
<?php
|
2 |
-
//
|
3 |
-
|
4 |
-
$this->startSetup();
|
5 |
-
$this->run("
|
6 |
-
|
7 |
-
-- DROP TABLE IF EXISTS {$this->getTable('mailup')};
|
8 |
-
CREATE TABLE {$this->getTable('mailup')} (
|
9 |
-
`mailup_id` int(11) unsigned NOT NULL auto_increment,
|
10 |
-
`title` varchar(255) NOT NULL default '',
|
11 |
-
`content` text NOT NULL default '',
|
12 |
-
`status` smallint(6) NOT NULL default '0',
|
13 |
-
`created_time` datetime NULL,
|
14 |
-
`update_time` datetime NULL,
|
15 |
-
PRIMARY KEY (`mailup_id`)
|
16 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
17 |
-
|
18 |
-
");
|
19 |
-
$this->endSetup();
|
20 |
-
*/
|
21 |
?>
|
1 |
<?php
|
2 |
+
// nothing to do
|
3 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
?>
|
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.1.0-1.0.0.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// nothing to do
|
3 |
+
?>
|
app/code/local/SevenLike/MailUp/sql/mailup_setup/mysql4-upgrade-0.3.0-1.0.0.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$this->startSetup();
|
3 |
+
|
4 |
+
$this->run("CREATE TABLE IF NOT EXISTS `mailup_filter_hints` (
|
5 |
+
`filter_name` varchar(255) collate utf8_unicode_ci NOT NULL,
|
6 |
+
`hints` varchar(255) collate utf8_unicode_ci NOT NULL,
|
7 |
+
PRIMARY KEY (`filter_name`)
|
8 |
+
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;");
|
9 |
+
|
10 |
+
$this->endSetup();
|
11 |
+
?>
|
app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml
CHANGED
@@ -4,8 +4,6 @@
|
|
4 |
*/
|
5 |
?>
|
6 |
<?php
|
7 |
-
|
8 |
-
|
9 |
//ottengo l'elenco delle liste e dei gruppi da mailup
|
10 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
11 |
$wsImport = new MailUpWsImport();
|
@@ -21,7 +19,6 @@ $endLists = $endPos + strlen('</Lists>') - $startLists;
|
|
21 |
|
22 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
23 |
$xml = simplexml_load_string($xmlLists);
|
24 |
-
|
25 |
?>
|
26 |
|
27 |
<?php //creo il form nascosto per passare i parametri al tasto back ?>
|
@@ -49,19 +46,21 @@ $xml = simplexml_load_string($xmlLists);
|
|
49 |
$countPost = 0;
|
50 |
$textArea = "";
|
51 |
$formParams = "";
|
|
|
52 |
//mi passo gli id di tutti i clienti filtrati
|
53 |
foreach ($customersFiltered as $customer) {
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
';
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
}
|
62 |
//salvo l'array nella sessione
|
63 |
-
if (
|
64 |
-
|
|
|
65 |
?>
|
66 |
<input name="countPost" type="hidden" value="<?php echo $countPost; ?>" />
|
67 |
</form>
|
@@ -90,108 +89,111 @@ $xml = simplexml_load_string($xmlLists);
|
|
90 |
?>
|
91 |
<form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/post')?>">
|
92 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
<fieldset id="my-fieldset">
|
98 |
<table cellspacing="0" class="form-list">
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
</table>
|
|
|
122 |
<table>
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
</tr>
|
128 |
-
<tr>
|
129 |
-
<td class="label"><p class="slgrp1"><?=$this->__('Select group')?> <input type="radio" name="mailupNewGroup" value="0" checked="checked" /></p></td>
|
130 |
-
</tr>
|
131 |
-
<tr>
|
132 |
-
<td class="input-ele">
|
133 |
-
<p class="istrz1"><?=$this->__('Select an existing group')?>:</p>
|
134 |
-
<select class="required-entry slctpg1" name="mailupGroupId">
|
135 |
-
<?php
|
136 |
-
foreach($xml->List as $list) {
|
137 |
-
if ($list['listGUID'] == Mage::getStoreConfig('newsletter/mailup/list')){
|
138 |
-
foreach($list->Groups->Group as $group) {
|
139 |
-
echo '<option value="'.$group['idGroup'].'">'.$group['groupName'].'</option>';
|
140 |
-
}
|
141 |
-
}
|
142 |
-
}
|
143 |
-
?>
|
144 |
-
</select><br /><br />
|
145 |
-
</td>
|
146 |
-
</tr>
|
147 |
-
|
148 |
-
<tr>
|
149 |
-
<td>
|
150 |
-
<p class="istrz2"><?=$this->__('or')?></p>
|
151 |
-
</td>
|
152 |
-
</tr>
|
153 |
-
<tr>
|
154 |
-
<td class="label"><p class="slgrp1"><?=$this->__('Create new customer group')?> <input type="radio" name="mailupNewGroup" value="1" /></p></td>
|
155 |
-
</tr>
|
156 |
-
<tr>
|
157 |
-
<td>
|
158 |
-
<p class="istrz1"><?=$this->__('Group name')?>:</p>
|
159 |
-
</td>
|
160 |
</tr>
|
161 |
<tr>
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
</fieldset>
|
168 |
</form>
|
169 |
|
170 |
<?php //form per la modifica manuale delle email ?>
|
171 |
<form id="manual_form" name="manual_form" method="post" action="<?=$this->getUrl('*/*/confirm')?>">
|
172 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
173 |
-
|
174 |
<fieldset id="my-fieldset">
|
175 |
<table cellspacing="5" class="form-list">
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
</table>
|
192 |
</fieldset>
|
193 |
</form>
|
194 |
-
|
195 |
</div>
|
196 |
<script type="text/javascript">
|
197 |
var editForm = new varienForm('edit_form');
|
4 |
*/
|
5 |
?>
|
6 |
<?php
|
|
|
|
|
7 |
//ottengo l'elenco delle liste e dei gruppi da mailup
|
8 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
9 |
$wsImport = new MailUpWsImport();
|
19 |
|
20 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
21 |
$xml = simplexml_load_string($xmlLists);
|
|
|
22 |
?>
|
23 |
|
24 |
<?php //creo il form nascosto per passare i parametri al tasto back ?>
|
46 |
$countPost = 0;
|
47 |
$textArea = "";
|
48 |
$formParams = "";
|
49 |
+
$mailupCustomerIds = array();
|
50 |
//mi passo gli id di tutti i clienti filtrati
|
51 |
foreach ($customersFiltered as $customer) {
|
52 |
+
//echo '<input name="mailupCustomerIds['.$countPost.'][entity_id]" type="hidden" value="'.$customer['entity_id'].'" />';
|
53 |
+
//echo '<input name="mailupCustomerIds['.$countPost.'][email]" type="hidden" value="'.$customer['email'].'" />';
|
54 |
+
$textArea .= $customer['email'].'
|
55 |
';
|
56 |
+
$mailupCustomerIds[$countPost]['entity_id'] = $customer['entity_id'];
|
57 |
+
$mailupCustomerIds[$countPost]['email'] = $customer['email'];
|
58 |
+
$countPost++;
|
59 |
}
|
60 |
//salvo l'array nella sessione
|
61 |
+
if ($countPost > 0) {
|
62 |
+
Mage::getSingleton('core/session')->setMailupCustomerIds($mailupCustomerIds);
|
63 |
+
}
|
64 |
?>
|
65 |
<input name="countPost" type="hidden" value="<?php echo $countPost; ?>" />
|
66 |
</form>
|
89 |
?>
|
90 |
<form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/post')?>">
|
91 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
92 |
+
<input name="mailupIdList" type="hidden" value="<?php echo $idList; ?>" />
|
93 |
+
<input name="mailupListGUID" type="hidden" value="<?php echo $listGUID; ?>" />
|
94 |
|
95 |
+
<h4><span id="spantitle3"><?=$this->__('Confirm filtered customers and select MailUp group')?></span></h4>
|
96 |
<fieldset id="my-fieldset">
|
97 |
<table cellspacing="0" class="form-list">
|
98 |
+
<tr>
|
99 |
+
<td colspan="2"><h4><?=$this->__('Were found')?> <strong><?php echo $countPost; ?></strong> <?=$this->__('records')?></h4></td>
|
100 |
+
</tr>
|
101 |
+
<tr>
|
102 |
+
<td><?=$this->__('Filtered customers')?>:</td>
|
103 |
+
</tr>
|
104 |
+
<tr>
|
105 |
+
<td>
|
106 |
+
<textarea name="mailupCustomerFilteredView" rows="5" cols="50" disabled="disabled" class="txtar1"><?php
|
107 |
+
/*foreach ($customersFiltered as $customer) {
|
108 |
+
echo $customer['email'].' ';
|
109 |
+
}*/
|
110 |
+
echo $textArea;
|
111 |
+
?></textarea>
|
112 |
+
</td>
|
113 |
+
</tr>
|
114 |
+
<tr>
|
115 |
+
<td colspan="2">
|
116 |
+
<?=$this->__('Selected list')?>: <strong>
|
117 |
+
<?php echo $listName; ?><br /><br /><br />
|
118 |
+
</strong></td>
|
119 |
+
</tr>
|
120 |
</table>
|
121 |
+
|
122 |
<table>
|
123 |
+
<tr>
|
124 |
+
<td>
|
125 |
+
<h4><?=$this->__('Next Step')?></h4>
|
126 |
+
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
</tr>
|
128 |
<tr>
|
129 |
+
<td class="label">
|
130 |
+
<p class="slgrp1"><?=$this->__('Select group')?> <input type="radio" name="mailupNewGroup" value="0" checked="checked" /></p>
|
131 |
+
</td>
|
132 |
+
</tr>
|
133 |
+
<tr>
|
134 |
+
<td class="input-ele">
|
135 |
+
<p class="istrz1"><?=$this->__('Select an existing group')?>:</p>
|
136 |
+
<select class="required-entry slctpg1" name="mailupGroupId">
|
137 |
+
<?php
|
138 |
+
foreach($xml->List as $list) {
|
139 |
+
if ($list['listGUID'] == Mage::getStoreConfig('newsletter/mailup/list')){
|
140 |
+
foreach($list->Groups->Group as $group) {
|
141 |
+
echo '<option value="'.$group['idGroup'].'">'.$group['groupName'].'</option>';
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
?>
|
146 |
+
</select>
|
147 |
+
<br /><br />
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
<tr>
|
151 |
+
<td>
|
152 |
+
<p class="istrz2"><?=$this->__('or')?></p>
|
153 |
+
</td>
|
154 |
+
</tr>
|
155 |
+
<tr>
|
156 |
+
<td class="label">
|
157 |
+
<p class="slgrp1"><?=$this->__('Create new customer group')?> <input type="radio" name="mailupNewGroup" value="1" /></p>
|
158 |
+
</td>
|
159 |
+
</tr>
|
160 |
+
<tr>
|
161 |
+
<td>
|
162 |
+
<p class="istrz1"><?=$this->__('Group name')?>:</p>
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
+
<tr>
|
166 |
+
<td>
|
167 |
+
<input type="text" name="mailupNewGroupName" size="60" class="inptptx2" />
|
168 |
+
</td>
|
169 |
+
</tr>
|
170 |
+
</table>
|
171 |
</fieldset>
|
172 |
</form>
|
173 |
|
174 |
<?php //form per la modifica manuale delle email ?>
|
175 |
<form id="manual_form" name="manual_form" method="post" action="<?=$this->getUrl('*/*/confirm')?>">
|
176 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
177 |
+
<h4><span id="spantitle4"><?=$this->__('Add a new e-mail address or select adresses to be removed from list')?></span></h4>
|
178 |
<fieldset id="my-fieldset">
|
179 |
<table cellspacing="5" class="form-list">
|
180 |
+
<tr>
|
181 |
+
<td>
|
182 |
+
<?=$this->__('Change members list: please add one email adress per row')?>
|
183 |
+
</td>
|
184 |
+
<td>
|
185 |
+
<textarea name="mailupCustomerFilteredMod" rows="20" cols="50" class="txtar1"><?php echo $textArea;?></textarea>
|
186 |
+
</td>
|
187 |
+
</tr>
|
188 |
+
<tr>
|
189 |
+
<td> </td>
|
190 |
+
<td>
|
191 |
+
<button onclick="manual_form.submit()" class="scalable save" type="button"><span><?=$this->__('Save changes')?></span></button><!-- <input type="submit" value="Applica modifiche"> -->
|
192 |
+
</td>
|
193 |
+
</tr>
|
194 |
+
</table>
|
|
|
195 |
</fieldset>
|
196 |
</form>
|
|
|
197 |
</div>
|
198 |
<script type="text/javascript">
|
199 |
var editForm = new varienForm('edit_form');
|
app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
Author:
|
4 |
-
*/
|
5 |
-
?>
|
6 |
-
|
7 |
-
<?php
|
8 |
|
9 |
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
10 |
$wsSend = new MailUpWsSend();
|
@@ -32,10 +29,11 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
32 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
33 |
$wsImport = new MailUpWsImport();
|
34 |
$mailupLists = $wsImport->GetNlList();
|
35 |
-
|
|
|
36 |
//chiamata attivazione web services su MailUp
|
37 |
-
$urlWSActivation =
|
38 |
-
fopen($urlWSActivation,
|
39 |
|
40 |
//salvo i parametri in variabili
|
41 |
$mailupCustomers = $this->getRequest()->getParam('mailupCustomers');
|
@@ -57,10 +55,12 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
57 |
<div class="content-header">
|
58 |
<table cellspacing="0" class="grid-header">
|
59 |
<tr>
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
64 |
</tr>
|
65 |
</table>
|
66 |
</div>
|
@@ -68,6 +68,9 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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')?> ⇒</a></span></h4>
|
72 |
<div style="clear: both;"></div>
|
73 |
<fieldset id="my-fieldset">
|
@@ -75,7 +78,7 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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 |
-
|
79 |
<td colspan="3"> </td>
|
80 |
</tr>
|
81 |
<tr>
|
@@ -83,7 +86,6 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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">
|
@@ -95,12 +97,20 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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);" /> <label for="mailupCustomersWhoHaventBought"><?=$this->__("Customers who
|
99 |
</td>
|
100 |
-
</tr>
|
101 |
-
|
102 |
<td colspan="3">
|
103 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</td>
|
105 |
</tr>
|
106 |
</table>
|
@@ -142,7 +152,7 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
142 |
|
143 |
<tr>
|
144 |
<td colspan="2">
|
145 |
-
<br /><br /><strong><?=$this->__('
|
146 |
</td>
|
147 |
</tr>
|
148 |
<tr>
|
@@ -175,7 +185,7 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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>
|
@@ -183,7 +193,7 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
183 |
<table cellspacing="0" class="form-list" id="customerDependentContainer">
|
184 |
<tr>
|
185 |
<td colspan="2">
|
186 |
-
<br /><br /><strong><?=$this->__('
|
187 |
</td>
|
188 |
</tr>
|
189 |
|
@@ -191,7 +201,7 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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="
|
195 |
</td>
|
196 |
</tr>
|
197 |
<?php //select con tutte le categorie ?>
|
@@ -226,19 +236,19 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
226 |
|
227 |
<tr>
|
228 |
<td colspan="2">
|
229 |
-
<br /><br /><strong><?=$this->__('
|
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>
|
@@ -264,8 +274,8 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
264 |
<option value="eq"> <?=$this->__('same as')?> </option>
|
265 |
</select>
|
266 |
|
267 |
-
|
268 |
-
<input type="text" class="inptptx1 customerDependent" id="mailupTotalAmountValue" name="mailupTotalAmountValue" size="20" value="<?php echo $mailupTotalAmountValue; ?>" />
|
269 |
</td>
|
270 |
</tr>
|
271 |
|
@@ -289,47 +299,53 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
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")?> »</p>
|
326 |
-
<input type="submit" value="<?=$this->__('Set
|
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 |
-
|
332 |
-
|
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() ?>" />
|
@@ -337,33 +353,62 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
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')?> »</p>
|
340 |
-
<input type="submit" value="<?=$this->__('Set
|
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 |
-
|
346 |
-
|
347 |
<td>
|
348 |
-
<form action="*/*/" id="filtro3" name="
|
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'); ?> »</p>
|
354 |
-
<input type="submit" value="<?=$this->__('Set
|
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 |
-
|
360 |
-
|
361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
</div>
|
363 |
<script type="text/javascript">
|
364 |
var editForm = new varienForm('edit_form');
|
365 |
-
|
366 |
-
<script type="text/javascript">
|
367 |
document.getElementsByClassName = function(className) {
|
368 |
var retnode = [];
|
369 |
var myclass = new RegExp('\\b'+className+'\\b');
|
@@ -390,6 +435,17 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
390 |
}
|
391 |
}
|
392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
window.onload = function() {
|
394 |
var isDisabled = document.getElementById('mailupCustomersWhoHaventBought').checked;
|
395 |
customerDependentFilters(isDisabled);
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Author: Sevenlike (www.sevenlike.com)
|
4 |
+
*/
|
|
|
|
|
|
|
5 |
|
6 |
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
7 |
$wsSend = new MailUpWsSend();
|
29 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
30 |
$wsImport = new MailUpWsImport();
|
31 |
$mailupLists = $wsImport->GetNlList();
|
32 |
+
$filterHints = $wsImport->getFilterHints();
|
33 |
+
|
34 |
//chiamata attivazione web services su MailUp
|
35 |
+
$urlWSActivation = 'http://'.Mage::getStoreConfig('newsletter/mailup/url_console').'/frontend/WSActivation.aspx?usr='.Mage::getStoreConfig('newsletter/mailup/user').'&pwd='.Mage::getStoreConfig('newsletter/mailup/password').'&nl_url='.Mage::getStoreConfig('newsletter/mailup/url_console').'&ws_name=WSMailUpImport';
|
36 |
+
fopen($urlWSActivation, 'r');
|
37 |
|
38 |
//salvo i parametri in variabili
|
39 |
$mailupCustomers = $this->getRequest()->getParam('mailupCustomers');
|
55 |
<div class="content-header">
|
56 |
<table cellspacing="0" class="grid-header">
|
57 |
<tr>
|
58 |
+
<td>
|
59 |
+
<h3><?=$this->__('MailUp')?></h3>
|
60 |
+
</td>
|
61 |
+
<td class="a-right">
|
62 |
+
<button onclick="editForm.submit()" class="scalable save" type="button"><span><?=$this->__('Apply filter')?></span></button>
|
63 |
+
</td>
|
64 |
</tr>
|
65 |
</table>
|
66 |
</div>
|
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 |
+
|
72 |
+
<input name="filter_name" id="filter_name" type="hidden" value="" />
|
73 |
+
|
74 |
<h4><span id="spantitle2"><?=$this->__('Filter customers')?></span><span id="spansugger"><a href="#ottsugg"><?=$this->__('Get hints')?> ⇒</a></span></h4>
|
75 |
<div style="clear: both;"></div>
|
76 |
<fieldset id="my-fieldset">
|
78 |
<tr>
|
79 |
<td colspan="3"><?=$this->__('By this plugin you can import contacts registered in your eCommerce in the MailUp platform.')?></td>
|
80 |
</tr>
|
81 |
+
<tr>
|
82 |
<td colspan="3"> </td>
|
83 |
</tr>
|
84 |
<tr>
|
86 |
<strong><?=$this->__('Sold products')?></strong>
|
87 |
</td>
|
88 |
</tr>
|
|
|
89 |
<?php //imposto il filtro per clienti: 0 = tutti, 1 = che hanno acquistato, 2 = che non hanno mai acquistato ?>
|
90 |
<tr>
|
91 |
<td class="input-ele spdnpg1">
|
97 |
</td>
|
98 |
|
99 |
<td class="input-ele spdnpg1">
|
100 |
+
<input type="radio" name="mailupCustomers" id="mailupCustomersWhoHaventBought" value="2" <?php if (isset($mailupCustomers) && $mailupCustomers == 2) { echo 'checked="checked"'; } ?> onclick="customerDependentFilters(true);" /> <label for="mailupCustomersWhoHaventBought"><?=$this->__("Customers who have not purchased")?></label>
|
101 |
</td>
|
102 |
+
</tr>
|
103 |
+
<tr>
|
104 |
<td colspan="3">
|
105 |
+
<strong><?=$this->__('Opt-in Status')?></strong>
|
106 |
+
</td>
|
107 |
+
</tr>
|
108 |
+
<tr>
|
109 |
+
<td>
|
110 |
+
<input type="radio" name="mailupSubscribed" id="mailupSubscribedOptIn" value="1" <?php if (isset($mailupSubscribed) && $mailupSubscribed == 1) { echo 'checked="checked"'; } ?> /> <label for="mailupSubscribedOptIn"><?php echo $this->__("Opted-in Only"); ?></label>
|
111 |
+
</td>
|
112 |
+
<td colspan="2">
|
113 |
+
<input type="radio" name="mailupSubscribed" id="mailupSubscribedAllCustomers" value="0" <?php if (isset($mailupCustomers) && $mailupCustomers == 0) { echo 'checked="checked"'; } ?> /> <label for="mailupSubscribedAllCustomers"><?=$this->__("All customers")?></label>
|
114 |
</td>
|
115 |
</tr>
|
116 |
</table>
|
152 |
|
153 |
<tr>
|
154 |
<td colspan="2">
|
155 |
+
<br /><br /><strong><?=$this->__('Location')?></strong>
|
156 |
</td>
|
157 |
</tr>
|
158 |
<tr>
|
185 |
<tr>
|
186 |
<td class="labelpg1"><?=$this->__('Zip code')?></td>
|
187 |
<td class="input-ele">
|
188 |
+
<input type="text" class="inptptx1" name="mailupPostCode" size="10" value="<?php echo $mailupPostCode; ?>" /> <span class="tip">(<?=$this->__('e.g.')?> 12345)</span>
|
189 |
</td>
|
190 |
</tr>
|
191 |
</table>
|
193 |
<table cellspacing="0" class="form-list" id="customerDependentContainer">
|
194 |
<tr>
|
195 |
<td colspan="2">
|
196 |
+
<br /><br /><strong><?=$this->__('Products and categories')?></strong>
|
197 |
</td>
|
198 |
</tr>
|
199 |
|
201 |
<tr>
|
202 |
<td class="labelpg1"><?=$this->__('Insert product SKU')?></td>
|
203 |
<td class="input-ele">
|
204 |
+
<input type="text" class="inptptx1 customerDependent" name="mailupProductSku" size="20" value="<?php echo $mailupProductSku; ?>" /> <span class="tip">(<?=$this->__('e.g.')?> MYSKU123)</span>
|
205 |
</td>
|
206 |
</tr>
|
207 |
<?php //select con tutte le categorie ?>
|
236 |
|
237 |
<tr>
|
238 |
<td colspan="2">
|
239 |
+
<br /><br /><strong><?=$this->__('Subscription date')?></strong>
|
240 |
</td>
|
241 |
</tr>
|
242 |
<tr>
|
243 |
<td class="labelpg1"><?=$this->__('From')?></td>
|
244 |
<td class="input-ele">
|
245 |
+
<input type="text" class="inptptx1 customerDependent" name="mailupCustomerStartDate" size="20" value="<?php echo $mailupCustomerStartDate; ?>" /> <span class="tip">(<?=$this->__('dd/mm/yyyy')?>)</span>
|
246 |
</td>
|
247 |
</tr>
|
248 |
<tr>
|
249 |
<td class="labelpg1"><?=$this->__('To')?></td>
|
250 |
<td class="input-ele">
|
251 |
+
<input type="text" class="inptptx1 customerDependent" name="mailupCustomerEndDate" size="20" value="<?php echo $mailupCustomerEndDate; ?>" /> <span class="tip">(<?=$this->__('dd/mm/yyyy')?>)</span>
|
252 |
</td>
|
253 |
</tr>
|
254 |
<tr>
|
274 |
<option value="eq"> <?=$this->__('same as')?> </option>
|
275 |
</select>
|
276 |
|
277 |
+
<!--label for="mailupTotalAmountValue" class="lbl1"><?=$this->__('Specify amount')?></label-->
|
278 |
+
<input type="text" class="inptptx1 customerDependent" id="mailupTotalAmountValue" name="mailupTotalAmountValue" size="20" value="<?php echo $mailupTotalAmountValue; ?>" /> <span class="tip">(<?=$this->__('e.g.')?> 50)</span>
|
279 |
</td>
|
280 |
</tr>
|
281 |
|
299 |
</select>
|
300 |
</td>
|
301 |
</tr>
|
|
|
|
|
|
|
302 |
|
303 |
<tr>
|
304 |
<td class="labelpg1"><?=$this->__('From')?></td>
|
305 |
<td class="input-ele">
|
306 |
+
<input type="text" class="inptptx1 customerDependent" name="mailupOrderStartDate" size="20" value="<?php echo $mailupOrderStartDate; ?>" /> <span class="tip">(<?=$this->__('dd/mm/yyyy')?>)</span>
|
307 |
</td>
|
308 |
</tr>
|
309 |
<tr>
|
310 |
<td class="labelpg1"><?=$this->__('To')?></td>
|
311 |
<td class="input-ele">
|
312 |
+
<input type="text" class="inptptx1 customerDependent" name="mailupOrderEndDate" size="20" value="<?php echo $mailupOrderEndDate; ?>" /> <span class="tip">(<?=$this->__('dd/mm/yyyy')?>)</span>
|
313 |
</td>
|
314 |
</tr>
|
315 |
</table>
|
316 |
</fieldset>
|
317 |
</form>
|
318 |
+
|
319 |
+
<h4><span id="spantitle3"><a name="saveFilter"><?=$this->__('Save current filters as hint')?></a></span></h4>
|
320 |
+
<fieldset id="my-fieldset3">
|
321 |
+
<table>
|
322 |
+
<tr>
|
323 |
+
<td>
|
324 |
+
<input name="filter_name_text" id="filter_name_text" type="text" value="" maxlength="100" size="50" />
|
325 |
+
<input type="submit" onclick="saveFilterHint();return false;" value="<?=$this->__('Save hint')?>" />
|
326 |
+
</td>
|
327 |
+
</tr>
|
328 |
+
</table>
|
329 |
+
</fieldset>
|
330 |
+
|
331 |
<h4><span id="spantitle1"><a name="ottsugg"><?=$this->__('Filter hints')?></a></span></h4>
|
332 |
<fieldset id="my-fieldset2">
|
333 |
<table cellspacing="0" class="form-list">
|
334 |
<tr>
|
335 |
<td><?=$this->__('Set and customize one of the following filters:')?></td>
|
336 |
</tr>
|
337 |
+
<tr>
|
338 |
<td>
|
339 |
<form action="*/*/" id="filtro1" name="filtro1" method="post">
|
340 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
341 |
<input name="mailupCustomers" type="hidden" value="2" />
|
342 |
<input name="mailupCustomerGroupId" type="hidden" value="2" />
|
343 |
<p class="parscefil"><?=$this->__("All wholesale customers who haven't purchased yet")?> »</p>
|
344 |
+
<input type="submit" value="<?=$this->__('Set hint')?>" />
|
|
|
|
|
345 |
</form>
|
346 |
</td>
|
347 |
+
</tr>
|
348 |
+
<tr>
|
349 |
<td>
|
350 |
<form action="*/*/" id="filtro2" name="filtro2" method="post">
|
351 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
353 |
<input name="mailupTotalAmountCond" type="hidden" value="gt" />
|
354 |
<input name="mailupTotalAmountValue" type="hidden" value="50" />
|
355 |
<p class="parscefil"><?=$this->__('More than 50 Euros orders')?> »</p>
|
356 |
+
<input type="submit" value="<?=$this->__('Set hint')?>" />
|
|
|
|
|
357 |
</form>
|
358 |
</td>
|
359 |
+
</tr>
|
360 |
+
<tr>
|
361 |
<td>
|
362 |
+
<form action="*/*/" id="filtro3" name="filtro3" method="post">
|
363 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
364 |
<input name="mailupCustomers" type="hidden" value="0" />
|
365 |
<input name="mailupOrderYesNo" type="hidden" value="no" />
|
366 |
<input name="mailupOrderStartDate" type="hidden" value="01/01/<?php echo date('Y'); ?>" />
|
367 |
<p class="parscefil"><?=$this->__('Members with no purchase in')?> <?php echo date('Y'); ?> »</p>
|
368 |
+
<input type="submit" value="<?=$this->__('Set hint')?>" />
|
|
|
|
|
369 |
</form>
|
370 |
+
|
371 |
</td>
|
372 |
+
</tr>
|
373 |
+
|
374 |
+
<?php if (!empty($filterHints)) { ?>
|
375 |
+
<tr>
|
376 |
+
<td> </td>
|
377 |
+
</tr>
|
378 |
+
<tr>
|
379 |
+
<td><?=$this->__('Or choose one of those you saved:')?></td>
|
380 |
+
</tr>
|
381 |
+
<?php } ?>
|
382 |
+
|
383 |
+
<?php
|
384 |
+
foreach ($filterHints as $fh) {
|
385 |
+
$filter_name = $fh['filter_name'];
|
386 |
+
echo '<tr><td>';
|
387 |
+
echo '<form action="*/*/" id="'.$filter_name.'" name="'.$filter_name.'" method="post">';
|
388 |
+
echo '<input name="form_key" type="hidden" value="'. Mage::getSingleton('core/session')->getFormKey() .'" />';
|
389 |
+
$hints = explode('|', $fh['hints']);
|
390 |
+
foreach ($hints as $h) {
|
391 |
+
$array = explode('=', $h);
|
392 |
+
echo '<input name="'.$array[0].'" type="hidden" value="'.$array[1].'" />';
|
393 |
+
}
|
394 |
+
echo '<p class="parscefil">'.$filter_name.' »</p>';
|
395 |
+
echo '<input type="submit" value="'.$this->__('Set hint').'" />';
|
396 |
+
echo '</form>';
|
397 |
+
echo ' ';
|
398 |
+
echo '<form name="deleteForm_'.$filter_name.'" action="'.$this->getUrl('*/*/deleteFilterHint').'" method="post">';
|
399 |
+
echo '<input name="form_key" type="hidden" value="'. Mage::getSingleton('core/session')->getFormKey() .'" />';
|
400 |
+
echo '<input name="filter_name" type="hidden" value="'. $filter_name .'" />';
|
401 |
+
echo '<input type="submit" name="delete" onclick="if(confirm(\''.$this->__('Do you really want to delete this filter hint?').'\')==true){this.submit();}return false;" value="'.$this->__('Delete hint').'" />';
|
402 |
+
echo '</form>';
|
403 |
+
echo '</td></tr>';
|
404 |
+
} ?>
|
405 |
+
|
406 |
+
</table>
|
407 |
+
</fieldset>
|
408 |
</div>
|
409 |
<script type="text/javascript">
|
410 |
var editForm = new varienForm('edit_form');
|
411 |
+
|
|
|
412 |
document.getElementsByClassName = function(className) {
|
413 |
var retnode = [];
|
414 |
var myclass = new RegExp('\\b'+className+'\\b');
|
435 |
}
|
436 |
}
|
437 |
|
438 |
+
function saveFilterHint() {
|
439 |
+
if (document.getElementById('filter_name_text').value=='') {
|
440 |
+
alert('<?=$this->__('Please, give your new hint a name.')?>');
|
441 |
+
} else {
|
442 |
+
document.getElementById('filter_name').value = document.getElementById('filter_name_text').value;
|
443 |
+
document.getElementById('edit_form').action = '<?=$this->getUrl('*/*/saveFilterHint')?>';
|
444 |
+
document.getElementById('edit_form').submit();
|
445 |
+
}
|
446 |
+
return false;
|
447 |
+
}
|
448 |
+
|
449 |
window.onload = function() {
|
450 |
var isDisabled = document.getElementById('mailupCustomersWhoHaventBought').checked;
|
451 |
customerDependentFilters(isDisabled);
|
app/locale/en_US/SevenLike_MailUp.csv
CHANGED
@@ -3,31 +3,30 @@
|
|
3 |
"WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp","WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp"
|
4 |
"Apply filter","Apply filter"
|
5 |
"Get hints","Get hints"
|
6 |
-
"Sold products","
|
7 |
"All customers","All customers"
|
8 |
"Customers who have purchased","Customers who have purchased"
|
9 |
-
"Customers who
|
10 |
"Select product","Select product"
|
11 |
"Any","Any"
|
12 |
-
"Select category","
|
13 |
"Groups","Groups"
|
14 |
"Select customer group","Select customer group"
|
15 |
-
"
|
16 |
"Select country","Select country"
|
17 |
"Zip code","Zip code"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"To","To"
|
21 |
"Total purchased amount","Total purchased amount"
|
22 |
-
"Order total","
|
23 |
"less than","less than"
|
24 |
-
"same as","
|
25 |
"more than","more than"
|
26 |
"Specify amount","Specify amount"
|
27 |
-
"Date of purchase","
|
28 |
"Show customers who","Show customers who"
|
29 |
-
"Haven't purchased","
|
30 |
-
"Have purchased","
|
31 |
"In this period","In this period"
|
32 |
"Filter hints","Filter hints"
|
33 |
"All wholesale customers who haven't purchased yet","All wholesale customers who haven't purchased yet"
|
@@ -51,10 +50,24 @@
|
|
51 |
"Add a new e-mail address or select adresses to be removed from list","Add a new e-mail address or select adresses to be removed from list"
|
52 |
"Change members list: please add one email adress per row","Change members list: please add one email address per row"
|
53 |
"Save changes","Save changes"
|
54 |
-
"By this plugin you can import contacts registered in your eCommerce to the MailUp platform.","
|
55 |
"Set and customize one of the following filters:","Set and customize one of the following filters:"
|
56 |
"Filter customers","Filter customers"
|
57 |
"You can find it on your browser url bar (e.g. g4a0.s03.it)","You can find it on your browser url bar (e.g. g4a0.s03.it)"
|
58 |
"If you haven't yet, we suggest you to create a DEM list directly from your mailup console","If you haven't yet, we suggest you to create a DEM list directly from your mailup console"
|
59 |
-
"Insert product SKU","
|
60 |
-
"Enable Cron Export","Enable Cron Export"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
"WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp","WARNING: before proceeding you must correctly configure the settings of MailUp access in System->Configuration->Newsletter->MailUp"
|
4 |
"Apply filter","Apply filter"
|
5 |
"Get hints","Get hints"
|
6 |
+
"Sold products","Purchase History"
|
7 |
"All customers","All customers"
|
8 |
"Customers who have purchased","Customers who have purchased"
|
9 |
+
"Customers who have not purchased","Customers who have not purchased"
|
10 |
"Select product","Select product"
|
11 |
"Any","Any"
|
12 |
+
"Select category","Products that belong to this category..."
|
13 |
"Groups","Groups"
|
14 |
"Select customer group","Select customer group"
|
15 |
+
"Location","Location"
|
16 |
"Select country","Select country"
|
17 |
"Zip code","Zip code"
|
18 |
+
"From","Between"
|
19 |
+
"To","And"
|
|
|
20 |
"Total purchased amount","Total purchased amount"
|
21 |
+
"Order total","Customers who have ordered"
|
22 |
"less than","less than"
|
23 |
+
"same as","exactly"
|
24 |
"more than","more than"
|
25 |
"Specify amount","Specify amount"
|
26 |
+
"Date of purchase","Purchase timeframe"
|
27 |
"Show customers who","Show customers who"
|
28 |
+
"Haven't purchased","did not purchase"
|
29 |
+
"Have purchased","purchased"
|
30 |
"In this period","In this period"
|
31 |
"Filter hints","Filter hints"
|
32 |
"All wholesale customers who haven't purchased yet","All wholesale customers who haven't purchased yet"
|
50 |
"Add a new e-mail address or select adresses to be removed from list","Add a new e-mail address or select adresses to be removed from list"
|
51 |
"Change members list: please add one email adress per row","Change members list: please add one email address per row"
|
52 |
"Save changes","Save changes"
|
53 |
+
"By this plugin you can import contacts registered in your eCommerce to the MailUp platform.","Filter customers and send them a targeted message through MailUp."
|
54 |
"Set and customize one of the following filters:","Set and customize one of the following filters:"
|
55 |
"Filter customers","Filter customers"
|
56 |
"You can find it on your browser url bar (e.g. g4a0.s03.it)","You can find it on your browser url bar (e.g. g4a0.s03.it)"
|
57 |
"If you haven't yet, we suggest you to create a DEM list directly from your mailup console","If you haven't yet, we suggest you to create a DEM list directly from your mailup console"
|
58 |
+
"Insert product SKU","Products whose SKU contains..."
|
59 |
+
"Enable Cron Export","Enable Cron Export"
|
60 |
+
"Subscription date","Subscription date"
|
61 |
+
"Save hint","Save hint"
|
62 |
+
"Delete hint","Delete hint"
|
63 |
+
"Set hint","Set hint"
|
64 |
+
"Or choose one of those you saved:","Or choose one of those you saved:"
|
65 |
+
"Do you really want to delete this hint?","Do you really want to delete this hint?"
|
66 |
+
"Please, give your new hint a name.","Please, give your new hint a name."
|
67 |
+
"Save current filters as hint","Save current filters as hint"
|
68 |
+
"Opted-in Only","Opted-in Only"
|
69 |
+
"All customers","All customers"
|
70 |
+
"Products and categories","Products and categories"
|
71 |
+
"dd/mm/yyyy","dd/mm/yyyy"
|
72 |
+
"e.g.","e.g."
|
73 |
+
"Opt-in Status","Opt-in Status"
|
app/locale/it_IT/SevenLike_MailUp.csv
CHANGED
@@ -6,16 +6,15 @@
|
|
6 |
"Sold products","Prodotti venduti"
|
7 |
"All customers","Tutti i clienti"
|
8 |
"Customers who have purchased","I clienti che hanno acquistato"
|
9 |
-
"Customers who
|
10 |
"Select product","Seleziona un prodotto"
|
11 |
"Any","Qualsiasi"
|
12 |
"Select category","Seleziona una categoria"
|
13 |
"Groups","Tipo di cliente"
|
14 |
"Select customer group","Seleziona gruppo di clienti"
|
15 |
-
"
|
16 |
"Select country","Seleziona paese"
|
17 |
"Zip code","CAP"
|
18 |
-
"Subscritpion date","Data registrazione cliente"
|
19 |
"From","Data inizio"
|
20 |
"To","Data fine"
|
21 |
"Total purchased amount","Somma totale ordinata"
|
@@ -57,5 +56,18 @@
|
|
57 |
"You can find it on your browser url bar (e.g. g4a0.s03.it)","Si trova nella barra degli indirizzi del tuo browser (es. g4a0.s03.it)"
|
58 |
"If you haven't yet, we suggest you to create a DEM list directly from your mailup console","Se non è stato ancora fatto è consigliabile creare una lista dedicata alle DEM direttamente dalla console di MailUp"
|
59 |
"Insert product SKU","Inserisci lo SKU del prodotto"
|
60 |
-
"
|
61 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
"Sold products","Prodotti venduti"
|
7 |
"All customers","Tutti i clienti"
|
8 |
"Customers who have purchased","I clienti che hanno acquistato"
|
9 |
+
"Customers who have not purchased","I clienti che non hanno mai acquistato"
|
10 |
"Select product","Seleziona un prodotto"
|
11 |
"Any","Qualsiasi"
|
12 |
"Select category","Seleziona una categoria"
|
13 |
"Groups","Tipo di cliente"
|
14 |
"Select customer group","Seleziona gruppo di clienti"
|
15 |
+
"Location","Provenienza cliente"
|
16 |
"Select country","Seleziona paese"
|
17 |
"Zip code","CAP"
|
|
|
18 |
"From","Data inizio"
|
19 |
"To","Data fine"
|
20 |
"Total purchased amount","Somma totale ordinata"
|
56 |
"You can find it on your browser url bar (e.g. g4a0.s03.it)","Si trova nella barra degli indirizzi del tuo browser (es. g4a0.s03.it)"
|
57 |
"If you haven't yet, we suggest you to create a DEM list directly from your mailup console","Se non è stato ancora fatto è consigliabile creare una lista dedicata alle DEM direttamente dalla console di MailUp"
|
58 |
"Insert product SKU","Inserisci lo SKU del prodotto"
|
59 |
+
"Enable Cron Export","Abilita Export Automatico"
|
60 |
+
"Subscription date","Data di iscrizione"
|
61 |
+
"Save hint","Salva il suggerimento"
|
62 |
+
"Delete hint","Cancella il suggerimento"
|
63 |
+
"Set hint","Applica il suggerimento"
|
64 |
+
"Or choose one of those you saved:","O scegline uno tra quelli che hai salvato:"
|
65 |
+
"Do you really want to delete this hint?","Vuoi davvero cancellare questo suggerimento?"
|
66 |
+
"Please, give your new hint a name.","Per favore, dai un nome al tuo nuovo suggerimento."
|
67 |
+
"Save current filters as hint","Salva i filtri correnti come suggerimento"
|
68 |
+
"Opted-in Only","Clienti iscritti alla newsletter"
|
69 |
+
"All customers","Tutti i clienti"
|
70 |
+
"Products and categories","Prodotti e categorie"
|
71 |
+
"dd/mm/yyyy","gg/mm/aaaa"
|
72 |
+
"e.g.","es."
|
73 |
+
"Opt-in Status","Iscrizione alla newsletter"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MailUp</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
@@ -45,11 +45,11 @@
|
|
45 |
<li>gestire e configurare automatismi tramite una intuitiva interfaccia web.</li>
|
46 |
</ul>
|
47 |
<p><br />Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.</p></description>
|
48 |
-
<notes>
|
49 |
<authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
|
50 |
-
<date>2012-
|
51 |
-
<time>2012-
|
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="
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MailUp</name>
|
4 |
+
<version>1.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>
|
45 |
<li>gestire e configurare automatismi tramite una intuitiva interfaccia web.</li>
|
46 |
</ul>
|
47 |
<p><br />Ad esempio un sito di ecommerce potrebbe alimentare il DB di MailUp con informazioni sugli acquisti e MailUp potr&agrave; quindi inviare, ad esempio dopo 7 giorni dall'acquisto, un messaggio di costumer satisfaction oppure l'invito ad acquistare un prodotto correlato.</p></description>
|
48 |
+
<notes>Introduced custom filters, refactoring and fixes</notes>
|
49 |
<authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
|
50 |
+
<date>2012-02-22</date>
|
51 |
+
<time>2012-02-22</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="bbb7621a16c155fe59623c42a552f506"/><file name="Lists.php" hash="4db6d95430fc63074d925486b5b0d6e9"/><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="1703a0c065d3e11232d9fd49333b074f"/><file name="Wssend.php" hash="67bc37afc8eb8f996f26c3d4fc12340e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FilterController.php" hash="b9c33b9767c621603e556ec855359c22"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="d52144d2368d6eca199abca26bce68ae"/><file name="system.xml" hash="dddfb4b3468512bb9cd47371ed5e4409"/><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"/></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="4e32fe11bbb6a611bec0692ef2c1146d"/><file name="filter.phtml" hash="63b8ac9924353a2d7618118151941b1e"/></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="37febcfd87a78148d5962da507c62ecc"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="SevenLike_MailUp.csv" hash="a42830138b9c0010c5c42586f7d5a9c4"/></dir><dir name="it_IT"><file name="SevenLike_MailUp.csv" hash="3e76646c08892c7f35ec19bea44bd3f5"/></dir></target></contents>
|
53 |
<compatible/>
|
54 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
55 |
</package>
|
skin/adminhtml/default/default/sevenlike/mailup/mailup.css
CHANGED
@@ -1,76 +1,19 @@
|
|
1 |
-
h4{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
}
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
color: #fff;
|
21 |
-
}
|
22 |
-
#spansugger{
|
23 |
-
display: block;
|
24 |
-
padding: 7px 0 0 0;
|
25 |
-
}
|
26 |
-
.parscefil{
|
27 |
-
float: left;
|
28 |
-
width: 310px;
|
29 |
-
}
|
30 |
-
.spdnpg1{
|
31 |
-
height: 50px;
|
32 |
-
padding: 0 25px 0 0;
|
33 |
-
}
|
34 |
-
td.labelpg1{
|
35 |
-
width: 170px;
|
36 |
-
}
|
37 |
-
.slctpg1{
|
38 |
-
width: 350px;
|
39 |
-
padding: 4px;
|
40 |
-
}
|
41 |
-
.slctpg2{
|
42 |
-
width: 200px;
|
43 |
-
padding: 4px;
|
44 |
-
}
|
45 |
-
.lbl1{
|
46 |
-
padding: 0 4px 0 30px;
|
47 |
-
}
|
48 |
-
.inptptx1{
|
49 |
-
padding: 4px;
|
50 |
-
}
|
51 |
-
.inptptx2{
|
52 |
-
width: 340px;
|
53 |
-
padding: 4px;
|
54 |
-
}
|
55 |
-
.txtar1{
|
56 |
-
padding: 4px;
|
57 |
-
width: 340px;
|
58 |
-
}
|
59 |
-
.slgrp1{
|
60 |
-
margin: 0 0 10px 0;
|
61 |
-
}
|
62 |
-
.slgrp2{
|
63 |
-
margin: 10px 0 20px 0;
|
64 |
-
}
|
65 |
-
.istrz1{
|
66 |
-
font: 12px Verdana, Geneva, sans-serif;
|
67 |
-
font-style: italic;
|
68 |
-
}
|
69 |
-
.istrz2{
|
70 |
-
font: 12px Verdana, Geneva, sans-serif;
|
71 |
-
font-style: italic;
|
72 |
-
margin: 0 0 20px 0;
|
73 |
-
}
|
74 |
-
mailupmessage {
|
75 |
-
display: none;
|
76 |
-
}
|
1 |
+
h4 { font-size: 1.05em; margin-bottom: 0.6em; overflow: hidden; }
|
2 |
+
#spantitle1, #spantitle2, #spantitle3, #spantitle4 { height: 31px; padding: 0 0 0 15px; line-height: 31px; font-size: 18px; display: block; background: #025B63; color: #fff; width: 100%; }
|
3 |
+
#spantitle1 a, #spantitle3 a { text-decoration: none; font-weight: bold; color: #fff; }
|
4 |
+
#spansugger { display: block; padding: 7px 0 0 0; }
|
5 |
+
.parscefil { float: left; width: 310px; }
|
6 |
+
.spdnpg1 { height: 50px; padding: 0 25px 0 0; }
|
7 |
+
td.labelpg1 { width: 170px; }
|
8 |
+
.slctpg1 { width: 350px; padding: 4px; }
|
9 |
+
.slctpg2 { width: 200px; padding: 4px; }
|
10 |
+
.lbl1 { padding: 0 4px 0 30px; }
|
11 |
+
.inptptx1 { padding: 4px; }
|
12 |
+
.inptptx2 { width: 340px; padding: 4px; }
|
13 |
+
.txtar1 { padding: 4px; width: 340px; }
|
14 |
+
.slgrp1 { margin: 0 0 10px 0; }
|
15 |
+
.slgrp2 { margin: 10px 0 20px 0; }
|
16 |
+
.istrz1 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; }
|
17 |
+
.istrz2 { font: 12px Verdana, Geneva, sans-serif; font-style: italic; margin: 0 0 20px 0; }
|
18 |
+
input, select { margin-bottom: 5px; }
|
19 |
+
span.tip { font-style: italic; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|