Version Notes
Introduced the ability to send ecommerce data in related fields for user with ecommerce account enabled.
Download this release
Release Info
Developer | Sevenlike |
Extension | MailUp |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.5.0
- app/code/local/SevenLike/MailUp/Helper/Data.php +192 -1
- app/code/local/SevenLike/MailUp/Model/Cron.php +16 -117
- app/code/local/SevenLike/MailUp/Model/Ws.php +23 -12
- app/code/local/SevenLike/MailUp/Model/Wssend.php +176 -70
- app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php +206 -84
- app/code/local/SevenLike/MailUp/etc/config.xml +119 -123
- app/code/local/SevenLike/MailUp/etc/system.xml +68 -46
- app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml +4 -3
- app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml +3 -0
- app/locale/en_US/SevenLike_MailUp.csv +7 -7
- package.xml +5 -5
app/code/local/SevenLike/MailUp/Helper/Data.php
CHANGED
@@ -1,5 +1,196 @@
|
|
1 |
<?php
|
2 |
class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
5 |
-
?>
|
1 |
<?php
|
2 |
class SevenLike_MailUp_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
|
4 |
+
public static function getCustomersData() {
|
5 |
+
Mage::log('Getting customers data', 0);
|
6 |
+
$dateFormat = 'm/d/y h:i:s';
|
7 |
+
$lastDateTime = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-7*3600*24);
|
8 |
+
$thirtyDaysAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-30*3600*24);
|
9 |
+
$twelveMonthsAgo = date($dateFormat, Mage::getModel('core/date')->timestamp(time())-365*3600*24);
|
10 |
+
|
11 |
+
$toSend = array();
|
12 |
+
$i = 0;
|
13 |
+
|
14 |
+
//ottengo la collection con tutti i clienti
|
15 |
+
$customerCollection = Mage::getModel('customer/customer')->getCollection();
|
16 |
+
foreach ($customerCollection as $customer) {
|
17 |
+
$currentCustomerId = $customer->getId();
|
18 |
+
Mage::log('Customer with id '.$currentCustomerId, 0);
|
19 |
+
$customer = Mage::getModel('customer/customer')->load($currentCustomerId);
|
20 |
+
|
21 |
+
//recupero gli ordini del cliente corrente
|
22 |
+
$totalOrders = 0;
|
23 |
+
$allOrderDateTimes = array();
|
24 |
+
$allOrderTotals = array();
|
25 |
+
$allOrderIds = array();
|
26 |
+
$allProductIds = array();
|
27 |
+
$orderLast30daysAmount = 0;
|
28 |
+
$orderLast12monthsAmount = 0;
|
29 |
+
|
30 |
+
Mage::log('Parsing orders of customer with id '.$currentCustomerId, 0);
|
31 |
+
$orders = Mage::getModel('sales/order')
|
32 |
+
->getCollection()
|
33 |
+
->addAttributeToFilter('customer_id', $currentCustomerId);
|
34 |
+
foreach ($orders as $order) {
|
35 |
+
$currentOrderTotal = floatval($order->getGrandTotal());
|
36 |
+
$totalOrders += $currentOrderTotal;
|
37 |
+
|
38 |
+
$currentOrderCreationDate = $order->getCreatedAt();
|
39 |
+
if ($currentOrderCreationDate > $thirtyDaysAgo) {
|
40 |
+
$orderLast30daysAmount += $currentOrderTotal;
|
41 |
+
|
42 |
+
}
|
43 |
+
if ($currentOrderCreationDate > $twelveMonthsAgo) {
|
44 |
+
$orderLast12monthsAmount += $currentOrderTotal;
|
45 |
+
}
|
46 |
+
|
47 |
+
$currentOrderTotal = number_format($currentOrderTotal, 2, ',', '');
|
48 |
+
|
49 |
+
$currentOrderId = $order->getIncrementId();
|
50 |
+
$allOrderTotals[$currentOrderId] = $currentOrderTotal;
|
51 |
+
$allOrderDateTimes[$currentOrderId] = $currentOrderCreationDate;
|
52 |
+
$allOrderIds[$currentOrderId] = $currentOrderId;
|
53 |
+
|
54 |
+
$items = $order->getAllItems();
|
55 |
+
|
56 |
+
foreach ($items as $item) {
|
57 |
+
$allProductIds[] = $item->getProductId();
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
$toSend[$i]['TotaleFatturatoUltimi30gg'] = number_format($orderLast30daysAmount, 2, ',', '');
|
62 |
+
$toSend[$i]['TotaleFatturatoUltimi12Mesi'] = number_format($orderLast12monthsAmount, 2, ',', '');
|
63 |
+
$toSend[$i]['IDTuttiProdottiAcquistati'] = implode(',', $allProductIds);
|
64 |
+
|
65 |
+
ksort($allOrderDateTimes);
|
66 |
+
ksort($allOrderTotals);
|
67 |
+
ksort($allOrderIds);
|
68 |
+
|
69 |
+
//recupero i carrelli abbandonati del cliente
|
70 |
+
Mage::log('Parsing abandoned carts of customer with id '.$currentCustomerId, 0);
|
71 |
+
$cartCollection = Mage::getResourceModel('reports/quote_collection');
|
72 |
+
$cartCollection->prepareForAbandonedReport(array(1));
|
73 |
+
$cartCollection->addFieldToFilter('customer_id', $currentCustomerId);
|
74 |
+
$cartCollection->load();
|
75 |
+
|
76 |
+
$datetimeCart = null;
|
77 |
+
if (! empty($cartCollection)) {
|
78 |
+
$lastCart = end($cartCollection);
|
79 |
+
|
80 |
+
$toSend[$i]['TotaleCarrelloAbbandonato'] = '';
|
81 |
+
$toSend[$i]['DataCarrelloAbbandonato'] = '';
|
82 |
+
$toSend[$i]['IDCarrelloAbbandonato'] = '';
|
83 |
+
|
84 |
+
if (! empty($lastCart)) {
|
85 |
+
Mage::log('Customer with id '.$currentCustomerId .' has abandoned cart', 0);
|
86 |
+
$datetimeCart = $lastCart->getUpdatedAt();
|
87 |
+
$toSend[$i]['TotaleCarrelloAbbandonato'] = number_format($lastCart->getGrandTotal(), 2, ',', '');
|
88 |
+
$toSend[$i]['DataCarrelloAbbandonato'] = self::_retriveDateFromDatetime($datetimeCart);
|
89 |
+
$toSend[$i]['IDCarrelloAbbandonato'] = $lastCart->getId();
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
//TODO: ultimo ordine spedito
|
94 |
+
$toSend[$i]['IDUltimoOrdineSpedito'] = '';
|
95 |
+
$toSend[$i]['DataUltimoOrdineSpedito'] = '';
|
96 |
+
|
97 |
+
$lastOrderDateTime = end($allOrderDateTimes);
|
98 |
+
|
99 |
+
if ($customer->getUpdatedAt() > $lastDateTime
|
100 |
+
|| $lastOrderDateTime > $lastDateTime
|
101 |
+
|| ($datetimeCart && $datetimeCart > $lastDateTime))
|
102 |
+
{
|
103 |
+
Mage::log('Adding customer with id '.$currentCustomerId, 0);
|
104 |
+
|
105 |
+
$toSend[$i]['nome'] = $customer->getFirstname();
|
106 |
+
$toSend[$i]['cognome'] = $customer->getLastname();
|
107 |
+
$toSend[$i]['email'] = $customer->getEmail();
|
108 |
+
$toSend[$i]['IDCliente'] = $currentCustomerId;
|
109 |
+
|
110 |
+
$toSend[$i]['registeredDate'] = self::_retriveDateFromDatetime($customer->getCreatedAt());
|
111 |
+
|
112 |
+
//controllo se iscritto o meno alla newsletter
|
113 |
+
if (Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed()) {
|
114 |
+
$toSend[$i]['subscribed'] = 'yes';
|
115 |
+
} else {
|
116 |
+
$toSend[$i]['subscribed'] = 'no';
|
117 |
+
}
|
118 |
+
|
119 |
+
//recupero i dati dal default billing address
|
120 |
+
$customerAddressId = $customer->getDefaultBilling();
|
121 |
+
if ($customerAddressId) {
|
122 |
+
$address = Mage::getModel('customer/address')->load($customerAddressId);
|
123 |
+
$toSend[$i]['azienda'] = $address->getData('company');
|
124 |
+
$toSend[$i]['paese'] = $address->getCountry();
|
125 |
+
$toSend[$i]['città'] = $address->getData('city');
|
126 |
+
$toSend[$i]['regione'] = $address->getData('region');
|
127 |
+
$regionId = $address->getData('region_id');
|
128 |
+
$regionModel = Mage::getModel('directory/region')->load($regionId);
|
129 |
+
$regionCode = $regionModel->getCode();
|
130 |
+
$toSend[$i]['provincia'] = $regionCode;
|
131 |
+
$toSend[$i]['cap'] = $address->getData('postcode');
|
132 |
+
$toSend[$i]['indirizzo'] = $address->getData('street');
|
133 |
+
$toSend[$i]['fax'] = $address->getData('fax');
|
134 |
+
$toSend[$i]['telefono'] = $address->getData('telephone');
|
135 |
+
}
|
136 |
+
|
137 |
+
$toSend[$i]['DataUltimoOrdine'] = self::_retriveDateFromDatetime($lastOrderDateTime);
|
138 |
+
$toSend[$i]['TotaleUltimoOrdine'] = end($allOrderTotals);
|
139 |
+
$toSend[$i]['IDUltimoOrdine'] = end($allOrderIds);
|
140 |
+
|
141 |
+
$toSend[$i]['TotaleFatturato'] = number_format($totalOrders, 2, ',', '');
|
142 |
+
|
143 |
+
//ottengo gli id di prodotti e categorie (dell'ultimo ordine)
|
144 |
+
$lastOrder = Mage::getModel('sales/order')->loadByIncrementId(end($allOrderIds));
|
145 |
+
$items = $lastOrder->getAllItems();
|
146 |
+
$productIds = array();
|
147 |
+
$categoryIds = array();
|
148 |
+
foreach ($items as $item) {
|
149 |
+
$productId = $item->getProductId();
|
150 |
+
$productIds[] = $productId;
|
151 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
152 |
+
if ($product->getCategoryIds()) {
|
153 |
+
$categoryIds[] = implode(',', $product->getCategoryIds());
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
$toSend[$i]['IDProdottiUltimoOrdine'] = implode(',', $productIds);
|
158 |
+
$toSend[$i]['IDCategorieUltimoOrdine'] = implode(',', $categoryIds);
|
159 |
+
|
160 |
+
$i++;
|
161 |
+
}
|
162 |
+
|
163 |
+
//unsetto la variabile
|
164 |
+
unset($customer);
|
165 |
+
}
|
166 |
+
|
167 |
+
Mage::log('Parsing subscribers', 0);
|
168 |
+
$subscriberCollection = Mage::getModel('newsletter/subscriber')
|
169 |
+
->getCollection()
|
170 |
+
->useOnlySubscribed()
|
171 |
+
->addFieldToFilter('customer_id', 0);
|
172 |
+
|
173 |
+
foreach ($subscriberCollection as $subscriber) {
|
174 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->load($subscriber->getId());
|
175 |
+
$toSend[$i]['nome'] = '';
|
176 |
+
$toSend[$i]['cognome'] = '';
|
177 |
+
$toSend[$i]['email'] = $subscriber->getEmail();
|
178 |
+
$toSend[$i]['subscribed'] = 'yes';
|
179 |
+
|
180 |
+
$i++;
|
181 |
+
}
|
182 |
+
|
183 |
+
Mage::log('End getting customers data', 0);
|
184 |
+
|
185 |
+
return $toSend;
|
186 |
+
}
|
187 |
+
|
188 |
+
private static function _retriveDateFromDatetime($datetime) {
|
189 |
+
if ($datetime && !empty($datetime)) {
|
190 |
+
$exploded = explode(' ', $datetime);
|
191 |
+
return $exploded[0];
|
192 |
+
}
|
193 |
+
return '';
|
194 |
+
}
|
195 |
}
|
196 |
+
?>
|
app/code/local/SevenLike/MailUp/Model/Cron.php
CHANGED
@@ -1,135 +1,34 @@
|
|
1 |
<?php
|
2 |
-
//ini_set(
|
3 |
|
4 |
class SevenLike_MailUp_Model_Cron {
|
5 |
|
6 |
public function run() {
|
7 |
//echo 'lanciato';
|
8 |
-
|
9 |
-
|
|
|
10 |
|
11 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
12 |
$wsImport = new MailUpWsImport();
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
public function getCustomersCron() {
|
21 |
-
//ottengo la collection con tutti i clienti
|
22 |
-
$customerCollection = Mage::getModel('customer/customer')->getCollection();
|
23 |
-
$i = 0;
|
24 |
-
$lastDate = date('m/d/y h:i:s', Mage::getModel('core/date')->timestamp(time())-7*3600*24);
|
25 |
-
$toSend = array();
|
26 |
-
|
27 |
-
foreach ($customerCollection as $customer):
|
28 |
-
$customer = Mage::getModel('customer/customer')->load($customer->getId());
|
29 |
-
|
30 |
-
//recupero gli ordini del cliente
|
31 |
-
$totalOrders = 0;
|
32 |
-
$allOrderDates = array();
|
33 |
-
$allOrderTotals = array();
|
34 |
-
$allOrderIds = array();
|
35 |
|
36 |
-
|
37 |
-
->addAttributeToFilter('customer_id', $customer->getId());
|
38 |
-
foreach ($orders as $order):
|
39 |
-
$totalOrders += number_format($order->getGrandTotal(), 2, ',', '');
|
40 |
-
$allOrderDates[$order->getIncrementId()] = $order->getCreatedAt();
|
41 |
-
$allOrderTotals[$order->getIncrementId()] = number_format($order->getGrandTotal(), 2, ',', '');
|
42 |
-
$allOrderIds[$order->getIncrementId()] = $order->getIncrementId();
|
43 |
-
endforeach;
|
44 |
-
|
45 |
-
ksort($allOrderDates);
|
46 |
-
ksort($allOrderTotals);
|
47 |
-
ksort($allOrderIds);
|
48 |
-
|
49 |
-
//recupero i carrelli abbandonati del cliente
|
50 |
-
$cartCollection = Mage::getResourceModel('reports/quote_collection');
|
51 |
-
$cartCollection->prepareForAbandonedReport(array(1));
|
52 |
-
$cartCollection->addFieldToFilter('customer_id', $customer->getId());
|
53 |
-
$cartCollection->load();
|
54 |
-
foreach ($cartCollection as $cart):
|
55 |
-
$dateCart = $cart->getUpdatedAt();
|
56 |
-
$totalCart = number_format($cart->getGrandTotal(), 2, ',', '');
|
57 |
-
endforeach;
|
58 |
-
|
59 |
-
if ($customer->getUpdatedAt() > $lastDate || end($allOrderDates) > $lastDate || $dateCart > $lastDate):
|
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()):
|
68 |
-
$toSend[$i]['subscribed'] = 'yes';
|
69 |
-
else:
|
70 |
-
$toSend[$i]['subscribed'] = 'no';
|
71 |
-
endif;
|
72 |
-
|
73 |
-
//recupero i dati dal default billing address
|
74 |
-
$customerAddressId = $customer->getDefaultBilling();
|
75 |
-
if ($customerAddressId):
|
76 |
-
$address = Mage::getModel('customer/address')->load($customerAddressId);
|
77 |
-
$toSend[$i]['company'] = $address->getCompany();
|
78 |
-
$toSend[$i]['countryCode'] = $address->getCountry();
|
79 |
-
endif;
|
80 |
-
|
81 |
-
$dateLastOrder = explode(' ', end($allOrderDates));
|
82 |
-
$toSend[$i]['dateLastOrder'] = $dateLastOrder[0];
|
83 |
-
$toSend[$i]['totalLastOrder'] = end($allOrderTotals);
|
84 |
-
$toSend[$i]['totalOrders'] = number_format($totalOrders, 2, ',', '');
|
85 |
-
|
86 |
-
$toSend[$i]['totalCart'] = $totalCart;
|
87 |
-
$dateCartTemp = explode(' ', $dateCart);
|
88 |
-
$toSend[$i]['dateCart'] = $dateCartTemp[0];
|
89 |
-
|
90 |
-
//ottengo gli id di prodotti e categorie
|
91 |
-
$lastOrder = Mage::getModel('sales/order')->loadByIncrementId(end($allOrderIds));
|
92 |
-
$items = $lastOrder->getAllItems();
|
93 |
-
$productIds = array();
|
94 |
-
$categoryIds = array();
|
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);
|
104 |
-
$toSend[$i]['categoryIds'] = implode(",", $categoryIds);
|
105 |
-
|
106 |
-
$i++;
|
107 |
-
endif;
|
108 |
-
|
109 |
-
//unsetto la variabile
|
110 |
-
$customer->setData(array());
|
111 |
-
endforeach;
|
112 |
-
|
113 |
-
$subscriberCollection = Mage::getModel('newsletter/subscriber')->getCollection()->useOnlySubscribed()->addFieldToFilter('customer_id', 0);
|
114 |
-
|
115 |
-
foreach ($subscriberCollection as $subscriber):
|
116 |
-
$subscriber = Mage::getModel('newsletter/subscriber')->load($subscriber->getId());
|
117 |
-
$toSend[$i]['firstname'] = '';
|
118 |
-
$toSend[$i]['lastname'] = '';
|
119 |
-
$toSend[$i]['email'] = $subscriber->getEmail();
|
120 |
-
$toSend[$i]['subscribed'] = 'yes';
|
121 |
-
$i++;
|
122 |
-
endforeach;
|
123 |
-
|
124 |
-
//Mage::log($toSend, null, 'danieleCustomersCron.log');
|
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 |
-
|
132 |
-
|
|
|
|
|
133 |
|
134 |
//Mage::log(Mage::getBaseDir('base').'/slMailupSubscribers.csv', null, 'danielePath.log');
|
135 |
$csv = fopen(Mage::getBaseDir('media').'/slMailupSubscribers.csv', 'w');
|
1 |
<?php
|
2 |
+
//ini_set('soap.wsdl_cache_enabled', '0');
|
3 |
|
4 |
class SevenLike_MailUp_Model_Cron {
|
5 |
|
6 |
public function run() {
|
7 |
//echo 'lanciato';
|
8 |
+
Mage::log('Cron mailup', 0);
|
9 |
+
if (Mage::getStoreConfig('newsletter/mailup/enable_cron_export') == 1) {
|
10 |
+
Mage::log('Cron export enabled', 0);
|
11 |
|
12 |
$MailUpWsImport = Mage::getModel('mailup/ws');
|
13 |
$wsImport = new MailUpWsImport();
|
14 |
|
15 |
+
require_once(dirname(__FILE__) . '/../Helper/Data.php');
|
16 |
+
self::saveToCsv(SevenLike_MailUp_Helper_Data::getCustomersData());
|
17 |
+
} else {
|
18 |
+
Mage::log('Cron export enabled', 0);
|
19 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
Mage::log('Cron mailup terminato', 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
23 |
|
24 |
public function saveToCsv($toSave) {
|
25 |
+
Mage::log('Cron: saving csv', 0);
|
26 |
$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"';
|
27 |
+
foreach ($toSave as $subscriber) {
|
28 |
+
Mage::log($subscriber, 0);
|
29 |
+
$file .= "\n";
|
30 |
+
$file .= '"'.$subscriber['nome'].'";"'.$subscriber['cognome'].'";"'.$subscriber['email'].'";"'.$subscriber['registeredDate'].'";"'.$subscriber['subscribed'].'";"'.$subscriber['azienda'].'";"'.$subscriber['paese'].'";"'.$subscriber['dateLastOrder'].'";"'.$subscriber['totalLastOrder'].'";"'.$subscriber['productIds'].'";"'.$subscriber['categoryIds'].'";"'.$subscriber['totalOrders'].'";"'.$subscriber['dateCart'].'";"'.$subscriber['totalCart'].'"';
|
31 |
+
}
|
32 |
|
33 |
//Mage::log(Mage::getBaseDir('base').'/slMailupSubscribers.csv', null, 'danielePath.log');
|
34 |
$csv = fopen(Mage::getBaseDir('media').'/slMailupSubscribers.csv', 'w');
|
app/code/local/SevenLike/MailUp/Model/Ws.php
CHANGED
@@ -36,9 +36,10 @@ class MailUpWsImport {
|
|
36 |
$this->soapClient->CreateGroup($newGroup);
|
37 |
$this-> printLastRequest();
|
38 |
$this->printLastResponse();
|
39 |
-
return $this->readReturnCode("CreateGroup","ReturnCode");
|
40 |
} catch (SoapFault $soapFault) {
|
41 |
-
|
|
|
42 |
}
|
43 |
}
|
44 |
|
@@ -47,18 +48,22 @@ class MailUpWsImport {
|
|
47 |
$this->soapClient->GetNlLists();
|
48 |
$this->printLastRequest();
|
49 |
$this->printLastResponse();
|
50 |
-
|
|
|
|
|
51 |
} catch (SoapFault $soapFault) {
|
52 |
-
|
|
|
53 |
}
|
54 |
}
|
55 |
|
56 |
public function newImportProcess($importProcessData) {
|
57 |
try {
|
58 |
$this->soapClient->NewImportProcess($importProcessData);
|
59 |
-
return $this->readReturnCode(
|
60 |
-
} catch (SoapFault $soapFault) {
|
61 |
-
|
|
|
62 |
}
|
63 |
}
|
64 |
|
@@ -67,18 +72,20 @@ class MailUpWsImport {
|
|
67 |
$this->soapClient->StartProcess($processData);
|
68 |
//echo "<br />ReturnCode: ". $this->readReturnCode("StartProcess","ReturnCode")."<br />";
|
69 |
} catch (SoapFault $soapFault) {
|
70 |
-
|
|
|
71 |
}
|
72 |
}
|
73 |
|
74 |
public function getProcessDetail($processData) {
|
75 |
try {
|
76 |
-
$this->soapClient->GetProcessDetails($processData);
|
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 |
-
|
|
|
82 |
}
|
83 |
}
|
84 |
|
@@ -89,7 +96,8 @@ class MailUpWsImport {
|
|
89 |
$this->printLastResponse();
|
90 |
//echo "<br />ReturnCode: ". $this->readReturnCode("StartImportProcesses","ReturnCode")."<br />";
|
91 |
} catch (SoapFault $soapFault) {
|
92 |
-
|
|
|
93 |
}
|
94 |
}
|
95 |
|
@@ -105,7 +113,7 @@ class MailUpWsImport {
|
|
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
|
109 |
}
|
110 |
$rCode = $this->domResult->getElementsByTagName($param);
|
111 |
return $rCode->item(0)->nodeValue;
|
@@ -539,6 +547,7 @@ class MailUpWsImport {
|
|
539 |
array_push($filter_hints, array('filter_name' => $row['filter_name'], 'hints' => $row['hints']));
|
540 |
}
|
541 |
} catch (Exception $e) {
|
|
|
542 |
die($e);
|
543 |
}
|
544 |
|
@@ -565,6 +574,7 @@ class MailUpWsImport {
|
|
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 |
}
|
@@ -577,6 +587,7 @@ class MailUpWsImport {
|
|
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 |
}
|
36 |
$this->soapClient->CreateGroup($newGroup);
|
37 |
$this-> printLastRequest();
|
38 |
$this->printLastResponse();
|
39 |
+
return $this->readReturnCode("CreateGroup", "ReturnCode");
|
40 |
} catch (SoapFault $soapFault) {
|
41 |
+
Mage::log('SOAP error', 0);
|
42 |
+
Mage::log($soapFault, 0);
|
43 |
}
|
44 |
}
|
45 |
|
48 |
$this->soapClient->GetNlLists();
|
49 |
$this->printLastRequest();
|
50 |
$this->printLastResponse();
|
51 |
+
$result = $this->soapClient->__getLastResponse();
|
52 |
+
Mage::log($result, 0);
|
53 |
+
return $result;
|
54 |
} catch (SoapFault $soapFault) {
|
55 |
+
Mage::log('SOAP error', 0);
|
56 |
+
Mage::log($soapFault, 0);
|
57 |
}
|
58 |
}
|
59 |
|
60 |
public function newImportProcess($importProcessData) {
|
61 |
try {
|
62 |
$this->soapClient->NewImportProcess($importProcessData);
|
63 |
+
return $this->readReturnCode('NewImportProcess', 'ReturnCode');
|
64 |
+
} catch (SoapFault $soapFault) {
|
65 |
+
Mage::log('SOAP error', 0);
|
66 |
+
Mage::log($soapFault, 0);
|
67 |
}
|
68 |
}
|
69 |
|
72 |
$this->soapClient->StartProcess($processData);
|
73 |
//echo "<br />ReturnCode: ". $this->readReturnCode("StartProcess","ReturnCode")."<br />";
|
74 |
} catch (SoapFault $soapFault) {
|
75 |
+
Mage::log('SOAP error', 0);
|
76 |
+
Mage::log($soapFault, 0);
|
77 |
}
|
78 |
}
|
79 |
|
80 |
public function getProcessDetail($processData) {
|
81 |
try {
|
82 |
+
Mage::log($this->soapClient->GetProcessDetails($processData), 0);
|
83 |
//echo "<br />ReturnCode: ". $this->readReturnCode("GetProcessDetails","ReturnCode")."<br />";
|
84 |
//echo "<br />IsRunning: ". $this->readReturnCode("GetProcessDetails","IsRunning")."<br />";
|
85 |
//echo "<br />StartDate: ". $this->readReturnCode("GetProcessDetails","StartDate")."<br />";
|
86 |
} catch (SoapFault $soapFault) {
|
87 |
+
Mage::log('SOAP error', 0);
|
88 |
+
Mage::log($soapFault, 0);
|
89 |
}
|
90 |
}
|
91 |
|
96 |
$this->printLastResponse();
|
97 |
//echo "<br />ReturnCode: ". $this->readReturnCode("StartImportProcesses","ReturnCode")."<br />";
|
98 |
} catch (SoapFault $soapFault) {
|
99 |
+
Mage::log('SOAP error', 0);
|
100 |
+
Mage::log($soapFault, 0);
|
101 |
}
|
102 |
}
|
103 |
|
113 |
$xmlResult = $dom->getElementsByTagName($func.'Result');
|
114 |
|
115 |
$this->domResult = new DomDocument();
|
116 |
+
$this->domResult->LoadXML(html_entity_decode($xmlResult->item(0)->nodeValue)) or die('File XML non valido!');
|
117 |
}
|
118 |
$rCode = $this->domResult->getElementsByTagName($param);
|
119 |
return $rCode->item(0)->nodeValue;
|
547 |
array_push($filter_hints, array('filter_name' => $row['filter_name'], 'hints' => $row['hints']));
|
548 |
}
|
549 |
} catch (Exception $e) {
|
550 |
+
Mage::log('Exception: '.$e->getMessage(), 0);
|
551 |
die($e);
|
552 |
}
|
553 |
|
574 |
// now $write is an instance of Zend_Db_Adapter_Abstract
|
575 |
$connectionWrite->query("INSERT INTO mailup_filter_hints (filter_name, hints) VALUES ('".$filter_name."', '".$hints."')");
|
576 |
} catch (Exception $e) {
|
577 |
+
Mage::log('Exception: '.$e->getMessage(), 0);
|
578 |
die($e);
|
579 |
}
|
580 |
}
|
587 |
// now $write is an instance of Zend_Db_Adapter_Abstract
|
588 |
$connectionWrite->query("DELETE FROM mailup_filter_hints WHERE filter_name LIKE '".$filter_name."'");
|
589 |
} catch (Exception $e) {
|
590 |
+
Mage::log('Exception: '.$e->getMessage(), 0);
|
591 |
die($e);
|
592 |
}
|
593 |
}
|
app/code/local/SevenLike/MailUp/Model/Wssend.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
<?php
|
2 |
class MailUpWsSend {
|
3 |
|
4 |
-
protected $WSDLUrl =
|
5 |
private $soapClient;
|
6 |
private $xmlResponse;
|
7 |
protected $domResult;
|
8 |
|
9 |
function __construct() {
|
10 |
-
$this->soapClient = new SoapClient($this->WSDLUrl, array(
|
11 |
}
|
12 |
|
13 |
function __destruct() {
|
@@ -19,9 +19,9 @@ class MailUpWsSend {
|
|
19 |
}
|
20 |
|
21 |
public function login() {
|
22 |
-
$loginData = array(
|
23 |
-
|
24 |
-
|
25 |
|
26 |
$result = get_object_vars($this->soapClient->Login($loginData));
|
27 |
$xml = simplexml_load_string($result['LoginResult']);
|
@@ -30,139 +30,223 @@ class MailUpWsSend {
|
|
30 |
//echo $xml['errorDescription'];
|
31 |
|
32 |
return $xml['errorCode'];
|
33 |
-
|
34 |
-
/* echo strlen($result['LoginResult']);
|
35 |
-
if (strlen($result['LoginResult']) == 295)
|
36 |
-
return 0;
|
37 |
-
else
|
38 |
-
return 1;
|
39 |
-
*/
|
40 |
}
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
-
|
53 |
-
return $xml['errorCode'];
|
54 |
-
|
55 |
-
/* echo strlen($result['LoginResult']);
|
56 |
-
if (strlen($result['LoginResult']) == 295)
|
57 |
-
return 0;
|
58 |
-
else
|
59 |
-
return 1;
|
60 |
-
*/
|
61 |
}
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
public function logout() {
|
70 |
try {
|
71 |
-
$this->soapClient->Logout(array(
|
72 |
-
if ($this->readReturnCode(
|
73 |
-
echo
|
74 |
}
|
75 |
-
} catch (SoapFault $soapFault) {
|
76 |
-
|
|
|
77 |
}
|
78 |
}
|
79 |
|
80 |
public function getLists() {
|
81 |
try {
|
82 |
-
$this->soapClient->GetLists(array(
|
83 |
-
if ($this->readReturnCode(
|
84 |
-
echo
|
85 |
} else {
|
86 |
$this->printLastResponse();
|
87 |
}
|
88 |
} catch (SoapFault $soapFault) {
|
89 |
-
|
|
|
90 |
}
|
91 |
}
|
92 |
|
93 |
public function getGroups($params) {
|
94 |
try {
|
95 |
-
$params = array_merge((array)$params, array(
|
96 |
$this->soapClient->GetGroups($params);
|
97 |
-
if ($this->readReturnCode(
|
98 |
-
echo
|
99 |
} else {
|
100 |
$this->printLastResponse();
|
101 |
}
|
102 |
} catch (SoapFault $soapFault) {
|
103 |
-
|
|
|
104 |
}
|
105 |
}
|
106 |
|
107 |
public function getNewsletters($params) {
|
108 |
try {
|
109 |
-
$params = array_merge((array)$params, array(
|
110 |
$this->soapClient->GetNewsletters($params);
|
111 |
-
if ($this->readReturnCode(
|
112 |
-
echo
|
113 |
} else {
|
114 |
$this->printLastResponse();
|
115 |
}
|
116 |
} catch (SoapFault $soapFault) {
|
117 |
-
|
|
|
118 |
}
|
119 |
}
|
120 |
|
121 |
public function createNewsletter($params) {
|
122 |
try {
|
123 |
-
$params = array_merge((array)$params, array(
|
124 |
$this->soapClient->createNewsletter($params);
|
125 |
|
126 |
$this->printLastRequest();
|
127 |
-
if ($this->readReturnCode(
|
128 |
-
echo
|
129 |
} else {
|
130 |
$this->printLastResponse();
|
131 |
}
|
132 |
} catch (SoapFault $soapFault) {
|
133 |
-
|
|
|
134 |
}
|
135 |
}
|
136 |
|
137 |
public function sendNewsletter($params) {
|
138 |
try {
|
139 |
-
$params = array_merge((array)$params, array(
|
140 |
$this->soapClient->SendNewsletter($params);
|
141 |
var_dump($params);
|
142 |
$this->printLastRequest();
|
143 |
-
if ($this->readReturnCode(
|
144 |
-
echo
|
145 |
} else {
|
146 |
$this->printLastResponse();
|
147 |
}
|
148 |
} catch (SoapFault $soapFault) {
|
149 |
-
|
|
|
150 |
}
|
151 |
}
|
152 |
|
153 |
public function sendNewsletterFast($params) {
|
154 |
try {
|
155 |
-
$params = array_merge((array)$params, array(
|
156 |
$this->soapClient->SendNewsletterFast($params);
|
157 |
|
158 |
$this->printLastRequest();
|
159 |
-
if ($this->readReturnCode(
|
160 |
-
echo
|
161 |
} else {
|
162 |
$this->printLastResponse();
|
163 |
}
|
164 |
} catch (SoapFault $soapFault) {
|
165 |
-
|
|
|
166 |
}
|
167 |
}
|
168 |
|
@@ -186,20 +270,42 @@ class MailUpWsSend {
|
|
186 |
}
|
187 |
|
188 |
private function printLastRequest() {
|
189 |
-
echo
|
190 |
}
|
191 |
|
192 |
private function printLastResponse() {
|
193 |
-
echo
|
194 |
}
|
195 |
-
|
196 |
-
|
|
|
197 |
return $this->accessKey;
|
198 |
}
|
199 |
|
200 |
public function option($key, $value) {
|
201 |
-
return array(
|
202 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
}
|
205 |
?>
|
1 |
<?php
|
2 |
class MailUpWsSend {
|
3 |
|
4 |
+
protected $WSDLUrl = 'http://services.mailupnet.it/MailupSend.asmx?WSDL';
|
5 |
private $soapClient;
|
6 |
private $xmlResponse;
|
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']);
|
30 |
//echo $xml['errorDescription'];
|
31 |
|
32 |
return $xml['errorCode'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @return $accessKey | false
|
37 |
+
*/
|
38 |
+
public function loginFromId() {
|
39 |
+
try {
|
40 |
+
//TODO: selezionare i dati di login opportuni
|
41 |
+
|
42 |
+
//login with web user
|
43 |
+
$loginData = array ('user' => Mage::getStoreConfig('newsletter/mailup/user'),
|
44 |
+
'pwd' => Mage::getStoreConfig('newsletter/mailup/password'),
|
45 |
+
'consoleId' => Mage::getStoreConfig('newsletter/mailup/id_console'));
|
46 |
+
|
47 |
+
//login with webservice user
|
48 |
+
$loginData = array ('user' => 'a'.Mage::getStoreConfig('newsletter/mailup/id_console'),
|
49 |
+
'pwd' => Mage::getStoreConfig('newsletter/mailup/password_ws'),
|
50 |
+
'consoleId' => Mage::getStoreConfig('newsletter/mailup/id_console'));
|
51 |
+
|
52 |
+
$result = get_object_vars($this->soapClient->LoginFromId($loginData));
|
53 |
+
$xml = simplexml_load_string($result['LoginFromIdResult']);
|
54 |
+
$errorCode = $xml->errorCode->__toString();
|
55 |
+
$errorDescription = $xml->errorDescription->__toString();
|
56 |
+
$accessKey = $xml->accessKey->__toString();
|
57 |
+
|
58 |
+
if ($errorCode !== '0') {
|
59 |
+
throw new Exception($errorDescription);
|
60 |
+
}
|
61 |
+
|
62 |
+
return $accessKey;
|
63 |
+
} catch (SoapFault $soapFault) {
|
64 |
+
Mage::log('SOAP error', 0);
|
65 |
+
Mage::log($soapFault, 0);
|
66 |
+
return false;
|
67 |
+
} catch (Exception $e) {
|
68 |
+
Mage::log($e->getMessage(), 0);
|
69 |
+
return false;
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
+
|
73 |
+
|
74 |
+
public function GetFields($accessKey) {
|
75 |
+
$fields = null;
|
76 |
+
|
77 |
+
try {
|
78 |
+
$result = get_object_vars($this->soapClient->GetFields(array('accessKey' => $accessKey)));
|
79 |
+
$xml = simplexml_load_string($result['GetFieldsResult']);
|
80 |
+
$fields = $this->_parseGetFieldsXmlResponse($xml);
|
81 |
+
} catch (SoapFault $soapFault) {
|
82 |
+
Mage::log('SOAP error', 0);
|
83 |
+
Mage::log($soapFault, 0);
|
84 |
+
}
|
85 |
+
|
86 |
+
return $fields;
|
87 |
+
}
|
88 |
+
|
89 |
+
private function _parseGetFieldsXmlResponse($xmlSimpleElement) {
|
90 |
+
$fields = $this->_getFieldsDefaultConfiguration();
|
91 |
+
|
92 |
+
//TODO: verificare condizione
|
93 |
+
if ($xmlSimpleElement->Error) {
|
94 |
+
Mage::log($xmlSimpleElement->Error, 0);
|
95 |
+
|
96 |
+
//TODO: ritornare messaggio di errore ??
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
|
100 |
+
//TODO: verificare condizione
|
101 |
+
if ($xmlSimpleElement->Fields && sizeof($xmlSimpleElement->Fields->Field) > 0) {
|
102 |
+
Mage::log('Fields returned, overwriting default configuration', 0);
|
103 |
+
foreach ($xmlSimpleElement->Fields->Field as $fieldSimpleElement) {
|
104 |
+
//Mage::log($fieldSimpleElement['Name'] . ''. $fieldSimpleElement['Id'], 0);
|
105 |
+
$fields[$fieldSimpleElement['Name']->__toString()] = $fieldSimpleElement['Id']->__toString();
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
return $fields;
|
110 |
}
|
111 |
+
|
112 |
+
private function _getFieldsDefaultConfiguration() {
|
113 |
+
$fields = array();
|
114 |
+
|
115 |
+
$fields['nome'] = '1';
|
116 |
+
$fields['cognome'] = '2';
|
117 |
+
$fields['azienda'] = '3';
|
118 |
+
$fields['città'] = '4';
|
119 |
+
$fields['provincia'] = '5';
|
120 |
+
$fields['cap'] = '6';
|
121 |
+
$fields['regione'] = '7';
|
122 |
+
$fields['paese'] = '8';
|
123 |
+
$fields['indirizzo'] = '9';
|
124 |
+
$fields['fax'] = '10';
|
125 |
+
$fields['telefono'] = '11';
|
126 |
+
$fields['IDCliente'] = '12';
|
127 |
+
$fields['IDUltimoOrdine'] = '13';
|
128 |
+
$fields['DataUltimoOrdine'] = '14';
|
129 |
+
$fields['TotaleUltimoOrdine'] = '15';
|
130 |
+
$fields['IDProdottiUltimoOrdine'] = '16';
|
131 |
+
$fields['IDCategorieUltimoOrdine'] = '17';
|
132 |
+
$fields['DataUltimoOrdineSpedito'] = '18';
|
133 |
+
$fields['IDUltimoOrdineSpedito'] = '19';
|
134 |
+
$fields['DataCarrelloAbbandonato'] = '20';
|
135 |
+
$fields['TotaleCarrelloAbbandonato'] = '21';
|
136 |
+
$fields['IDCarrelloAbbandonato'] = '22';
|
137 |
+
$fields['TotaleFatturato'] = '23';
|
138 |
+
$fields['TotaleFatturatoUltimi12Mesi'] = '24';
|
139 |
+
$fields['TotaleFatturatoUltimi30gg'] = '25';
|
140 |
+
$fields['IDTuttiProdottiAcquistati'] = '26';
|
141 |
+
|
142 |
+
return $fields;
|
143 |
+
}
|
144 |
+
|
145 |
|
146 |
public function logout() {
|
147 |
try {
|
148 |
+
$this->soapClient->Logout(array('accessKey' => $this->accessKey));
|
149 |
+
if ($this->readReturnCode('Logout', 'errorCode') != 0) {
|
150 |
+
echo '<br /><br />Errore Logout'. $this->readReturnCode('Logout', 'errorDescription');
|
151 |
}
|
152 |
+
} catch (SoapFault $soapFault) {
|
153 |
+
Mage::log('SOAP error', 0);
|
154 |
+
Mage::log($soapFault, 0);
|
155 |
}
|
156 |
}
|
157 |
|
158 |
public function getLists() {
|
159 |
try {
|
160 |
+
$this->soapClient->GetLists(array('accessKey' => $this->accessKey));
|
161 |
+
if ($this->readReturnCode('GetLists', 'errorCode') != 0) {
|
162 |
+
echo '<br /><br />Errore GetLists: '. $this->readReturnCode('GetLists', 'errorDescription');
|
163 |
} else {
|
164 |
$this->printLastResponse();
|
165 |
}
|
166 |
} catch (SoapFault $soapFault) {
|
167 |
+
Mage::log('SOAP error', 0);
|
168 |
+
Mage::log($soapFault, 0);
|
169 |
}
|
170 |
}
|
171 |
|
172 |
public function getGroups($params) {
|
173 |
try {
|
174 |
+
$params = array_merge((array)$params, array('accessKey' => $this->accessKey));
|
175 |
$this->soapClient->GetGroups($params);
|
176 |
+
if ($this->readReturnCode('GetGroups', 'errorCode') != 0) {
|
177 |
+
echo '<br /><br />Errore GetGroups: '. $this->readReturnCode('GetGroups', 'errorDescription');
|
178 |
} else {
|
179 |
$this->printLastResponse();
|
180 |
}
|
181 |
} catch (SoapFault $soapFault) {
|
182 |
+
Mage::log('SOAP error', 0);
|
183 |
+
Mage::log($soapFault, 0);
|
184 |
}
|
185 |
}
|
186 |
|
187 |
public function getNewsletters($params) {
|
188 |
try {
|
189 |
+
$params = array_merge((array)$params, array('accessKey' => $this->accessKey));
|
190 |
$this->soapClient->GetNewsletters($params);
|
191 |
+
if ($this->readReturnCode('GetNewsletters', 'errorCode') != 0) {
|
192 |
+
echo '<br /><br />Errore GetNewsletters: '. $this->readReturnCode('GetNewsletters', 'errorDescription');
|
193 |
} else {
|
194 |
$this->printLastResponse();
|
195 |
}
|
196 |
} catch (SoapFault $soapFault) {
|
197 |
+
Mage::log('SOAP error', 0);
|
198 |
+
Mage::log($soapFault, 0);
|
199 |
}
|
200 |
}
|
201 |
|
202 |
public function createNewsletter($params) {
|
203 |
try {
|
204 |
+
$params = array_merge((array)$params, array('accessKey' => $this->accessKey));
|
205 |
$this->soapClient->createNewsletter($params);
|
206 |
|
207 |
$this->printLastRequest();
|
208 |
+
if ($this->readReturnCode('CreateNewsletter', 'errorCode') != 0) {
|
209 |
+
echo '<br /><br />Errore CreateNewsletter: '. $this->readReturnCode('CreateNewsletter', 'errorCode') .' - '. $this->readReturnCode('CreateNewsletter', 'errorDescription');
|
210 |
} else {
|
211 |
$this->printLastResponse();
|
212 |
}
|
213 |
} catch (SoapFault $soapFault) {
|
214 |
+
Mage::log('SOAP error', 0);
|
215 |
+
Mage::log($soapFault, 0);
|
216 |
}
|
217 |
}
|
218 |
|
219 |
public function sendNewsletter($params) {
|
220 |
try {
|
221 |
+
$params = array_merge((array)$params, array('accessKey' => $this->accessKey));
|
222 |
$this->soapClient->SendNewsletter($params);
|
223 |
var_dump($params);
|
224 |
$this->printLastRequest();
|
225 |
+
if ($this->readReturnCode('SendNewsletter', 'errorCode') != 0) {
|
226 |
+
echo '<br /><br />Errore SendNewsletter: '. $this->readReturnCode('SendNewsletter', 'errorCode') .' - '. $this->readReturnCode('SendNewsletter', 'errorDescription');
|
227 |
} else {
|
228 |
$this->printLastResponse();
|
229 |
}
|
230 |
} catch (SoapFault $soapFault) {
|
231 |
+
Mage::log('SOAP error', 0);
|
232 |
+
Mage::log($soapFault, 0);
|
233 |
}
|
234 |
}
|
235 |
|
236 |
public function sendNewsletterFast($params) {
|
237 |
try {
|
238 |
+
$params = array_merge((array)$params, array('accessKey' => $this->accessKey));
|
239 |
$this->soapClient->SendNewsletterFast($params);
|
240 |
|
241 |
$this->printLastRequest();
|
242 |
+
if ($this->readReturnCode('SendNewsletterFast', 'errorCode') != 0) {
|
243 |
+
echo '<br /><br />Errore SendNewsletterFast: '. $this->readReturnCode('SendNewsletterFast', 'errorCode') .' - '. $this->readReturnCode('SendNewsletterFast', 'errorDescription');
|
244 |
} else {
|
245 |
$this->printLastResponse();
|
246 |
}
|
247 |
} catch (SoapFault $soapFault) {
|
248 |
+
Mage::log('SOAP error', 0);
|
249 |
+
Mage::log($soapFault, 0);
|
250 |
}
|
251 |
}
|
252 |
|
270 |
}
|
271 |
|
272 |
private function printLastRequest() {
|
273 |
+
echo '<br />Request :<br />'. htmlentities($this->soapClient->__getLastRequest()) .'<br />';
|
274 |
}
|
275 |
|
276 |
private function printLastResponse() {
|
277 |
+
echo '<br />XMLResponse: '. $this->soapClient->__getLastResponse() .'<br />'; //htmlentities();
|
278 |
}
|
279 |
+
|
280 |
+
//TODO: seems unused, remove if so
|
281 |
+
public function getAccessKey() {
|
282 |
return $this->accessKey;
|
283 |
}
|
284 |
|
285 |
public function option($key, $value) {
|
286 |
+
return array('Key' => $key, 'Value' => $value);
|
287 |
}
|
288 |
+
|
289 |
+
//TODO: TEST stuff (this shouldn't be here)
|
290 |
+
public function loginTest() {
|
291 |
+
$loginData = array('user' => 'a7410', 'pwd' => 'GA6VAN0W', 'url' => 'g4a0.s03.it');
|
292 |
+
|
293 |
+
$result = get_object_vars($this->soapClient->Login($loginData));
|
294 |
+
$xml = simplexml_load_string($result['LoginResult']);
|
295 |
+
$xml = get_object_vars($xml);
|
296 |
+
|
297 |
+
if ($xml['errorCode'] > 0) {
|
298 |
+
echo $xml['errorDescription'].'<br /><br />';
|
299 |
+
}
|
300 |
+
|
301 |
+
return $xml['errorCode'];
|
302 |
+
}
|
303 |
+
|
304 |
+
public function testSoap() {
|
305 |
+
$client = new SoapClient('http://soapclient.com/xml/soapresponder.wsdl');
|
306 |
+
//print_r($client->__getFunctions());
|
307 |
+
return $client->Method1('x12qaq','c56tf3');
|
308 |
+
}
|
309 |
|
310 |
}
|
311 |
?>
|
app/code/local/SevenLike/MailUp/controllers/Adminhtml/FilterController.php
CHANGED
@@ -12,119 +12,192 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
|
|
12 |
|
13 |
public function csvAction() {
|
14 |
$post = $this->getRequest()->getPost();
|
15 |
-
|
16 |
-
|
17 |
-
$file = '';
|
18 |
-
|
19 |
if ($post['countPost'] > 0) {
|
20 |
//preparo l'elenco degli iscritti da salvare nel csv
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
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,
|
102 |
-
"idGroups" => $groupId,
|
103 |
-
"importType" => "3",
|
104 |
-
"mobileInputType" => "2",
|
105 |
-
"asPending" => "0",
|
106 |
-
"ConfirmEmail" => "0",
|
107 |
-
"asOptOut" => "0",
|
108 |
-
"forceOptIn" => "0",
|
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(
|
119 |
-
|
120 |
-
|
|
|
|
|
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) {
|
@@ -166,5 +239,54 @@ class SevenLike_MailUp_Adminhtml_FilterController extends Mage_Adminhtml_Control
|
|
166 |
|
167 |
$this->_redirect('*/*');
|
168 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
?>
|
12 |
|
13 |
public function csvAction() {
|
14 |
$post = $this->getRequest()->getPost();
|
15 |
+
$file = '';
|
16 |
+
|
|
|
|
|
17 |
if ($post['countPost'] > 0) {
|
18 |
//preparo l'elenco degli iscritti da salvare nel csv
|
19 |
+
$mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
|
20 |
+
|
21 |
+
//require_once(dirname(__FILE__) . '/../Helper/Data.php');
|
22 |
+
$customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
|
23 |
+
|
24 |
+
//CSV Column names
|
25 |
+
$file = '"Email","First Name","Last Name"';
|
26 |
+
if (Mage::getStoreConfig('newsletter/mailup/enable_mailup_synchro') == 1) {
|
27 |
+
$file .= ',"Company","City","Province","Zip code","Region","Country code","Address","Fax","Phone","Customer id"';
|
28 |
+
$file .= ',"Last Order id","Last Order date","Last Order total","Last order product ids","Last order category ids"';
|
29 |
+
$file .= ',"Last sent order date","Last sent order id"';
|
30 |
+
$file .= ',"Last abandoned cart date","Last abandoned cart total","Last abandoned cart id"';
|
31 |
+
$file .= ',"Total orders amount","Last 12 months amount","Last 30 days amount","All products ids"';
|
32 |
}
|
33 |
+
$file .= ';';
|
34 |
+
|
35 |
|
36 |
+
foreach ($mailupCustomerIds as $customerId) {
|
37 |
+
foreach ($customersData as $subscriber) {
|
38 |
+
if ($subscriber['email'] == $customerId['email']) {
|
39 |
+
$file .= "\n";
|
40 |
+
$file .= '"'.$subscriber['email'].'"';
|
41 |
+
$file .= ',"'.((!empty($subscriber['nome'])) ? $subscriber['nome'] : '') .'"';
|
42 |
+
$file .= ',"'.((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'"';
|
43 |
+
|
44 |
+
$synchroConfig = Mage::getStoreConfig('newsletter/mailup/enable_mailup_synchro') == 1;
|
45 |
+
|
46 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['azienda'])) ? $subscriber['azienda'] : '') .'"';
|
47 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['città'])) ? $subscriber['città'] : '') .'"';
|
48 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['provincia'])) ? $subscriber['provincia'] : '') .'"';
|
49 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['cap'])) ? $subscriber['cap'] : '') .'"';
|
50 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['regione'])) ? $subscriber['regione'] : '') .'"';
|
51 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['paese'])) ? $subscriber['paese'] : '') .'"';
|
52 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['indirizzo'])) ? $subscriber['indirizzo'] : '') .'"';
|
53 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['fax'])) ? $subscriber['fax'] : '') .'"';
|
54 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['telefono'])) ? $subscriber['telefono'] : '') .'"';
|
55 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDCliente'])) ? $subscriber['IDCliente'] : '') .'"';
|
56 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDUltimoOrdine'])) ? $subscriber['IDUltimoOrdine'] : '') .'"';
|
57 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['DataUltimoOrdine'])) ? $subscriber['DataUltimoOrdine'] : '') .'"';
|
58 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['TotaleUltimoOrdine'])) ? $subscriber['TotaleUltimoOrdine'] : '') .'"';
|
59 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDProdottiUltimoOrdine'])) ? $subscriber['IDProdottiUltimoOrdine'] : '') .'"';
|
60 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDCategorieUltimoOrdine'])) ? $subscriber['IDCategorieUltimoOrdine'] : '') .'"';
|
61 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['DataUltimoOrdineSpedito'])) ? $subscriber['DataUltimoOrdineSpedito'] : '') .'"';
|
62 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDUltimoOrdineSpedito'])) ? $subscriber['IDUltimoOrdineSpedito'] : '') .'"';
|
63 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['DataCarrelloAbbandonato'])) ? $subscriber['DataCarrelloAbbandonato'] : '') .'"';
|
64 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['TotaleCarrelloAbbandonato'])) ? $subscriber['TotaleCarrelloAbbandonato'] : '') .'"';
|
65 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDCarrelloAbbandonato'])) ? $subscriber['IDCarrelloAbbandonato'] : '') .'"';
|
66 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['TotaleFatturato'])) ? $subscriber['TotaleFatturato'] : '') .'"';
|
67 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['TotaleFatturatoUltimi12Mesi'])) ? $subscriber['TotaleFatturatoUltimi12Mesi'] : '') .'"';
|
68 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['TotaleFatturatoUltimi30gg'])) ? $subscriber['TotaleFatturatoUltimi30gg'] : '') .'"';
|
69 |
+
$file .= ',"'. ($synchroConfig && (!empty($subscriber['IDTuttiProdottiAcquistati'])) ? $subscriber['IDTuttiProdottiAcquistati'] : '') .'"';
|
70 |
+
$file .= ';';
|
71 |
+
|
72 |
+
continue 2;
|
73 |
+
}
|
74 |
+
}
|
75 |
}
|
|
|
76 |
}
|
77 |
|
78 |
//lancio il download del file
|
79 |
+
header("Content-type: application/csv");
|
80 |
header("Content-Disposition: attachment;Filename=clienti_filtrati.csv");
|
81 |
echo $file;
|
82 |
}
|
83 |
|
84 |
public function postAction() {
|
85 |
$post = $this->getRequest()->getPost();
|
|
|
86 |
|
87 |
try {
|
88 |
if (empty($post)) {
|
89 |
Mage::throwException($this->__('Invalid form data.'));
|
90 |
}
|
91 |
+
|
92 |
+
$mailupCustomerIds = Mage::getSingleton('core/session')->getMailupCustomerIds();
|
93 |
+
|
94 |
+
//require_once(dirname(__FILE__) . '/../Helper/Data.php');
|
95 |
+
$customersData = SevenLike_MailUp_Helper_Data::getCustomersData();
|
96 |
+
|
97 |
+
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
98 |
+
$wsSend = new MailUpWsSend();
|
99 |
+
$accessKey = $wsSend->loginFromId();
|
100 |
+
|
101 |
+
if ($accessKey === false) {
|
102 |
+
Mage::throwException('no access key returned');
|
103 |
+
}
|
104 |
+
$fields = $wsSend->GetFields($accessKey);
|
105 |
+
|
106 |
//preparo l'xml degli iscritti da inviare a mailup (da gestire in base ai filtri)
|
107 |
$xmlData = '<subscribers>';
|
108 |
+
foreach ($mailupCustomerIds as $customerId) {
|
109 |
+
foreach ($customersData as $subscriber) {
|
110 |
+
if ($subscriber['email'] == $customerId['email']) {
|
111 |
+
$xmlData .= '<subscriber email="'.$subscriber['email'].'" Number="" Name="">';
|
112 |
+
|
113 |
+
$xmlData .= '<campo'.$fields['nome'].'>'. ((!empty($subscriber['nome'])) ? $subscriber['nome'] : '') .'</campo'.$fields['nome'].'>';
|
114 |
+
$xmlData .= '<campo'.$fields['cognome'].'>'. ((!empty($subscriber['cognome'])) ? $subscriber['cognome'] : '') .'</campo'.$fields['cognome'].'>';
|
115 |
+
|
116 |
+
$synchroConfig = Mage::getStoreConfig('newsletter/mailup/enable_mailup_synchro') == 1;
|
117 |
+
|
118 |
+
$xmlData .= '<campo'.$fields['azienda'].'>'. ($synchroConfig && (!empty($subscriber['azienda'])) ? $subscriber['azienda'] : '-') .'</campo'.$fields['azienda'].'>';
|
119 |
+
$xmlData .= '<campo'.$fields['città'].'>'. ($synchroConfig && (!empty($subscriber['città'])) ? $subscriber['città'] : '-') .'</campo'.$fields['città'].'>';
|
120 |
+
$xmlData .= '<campo'.$fields['provincia'].'>'. ($synchroConfig && (!empty($subscriber['provincia'])) ? $subscriber['provincia'] : '-') .'</campo'.$fields['provincia'].'>';
|
121 |
+
$xmlData .= '<campo'.$fields['cap'].'>'. ($synchroConfig && (!empty($subscriber['cap'])) ? $subscriber['cap'] : '-') .'</campo'.$fields['cap'].'>';
|
122 |
+
$xmlData .= '<campo'.$fields['regione'].'>'. ($synchroConfig && (!empty($subscriber['regione'])) ? $subscriber['regione'] : '-') .'</campo'.$fields['regione'].'>';
|
123 |
+
$xmlData .= '<campo'.$fields['paese'].'>'. ($synchroConfig && (!empty($subscriber['paese'])) ? $subscriber['paese'] : '-') .'</campo'.$fields['paese'].'>';
|
124 |
+
$xmlData .= '<campo'.$fields['indirizzo'].'>'. ($synchroConfig && (!empty($subscriber['indirizzo'])) ? $subscriber['indirizzo'] : '-') .'</campo'.$fields['indirizzo'].'>';
|
125 |
+
$xmlData .= '<campo'.$fields['fax'].'>'. ($synchroConfig && (!empty($subscriber['fax'])) ? $subscriber['fax'] : '-') .'</campo'.$fields['fax'].'>';
|
126 |
+
$xmlData .= '<campo'.$fields['telefono'].'>'. ($synchroConfig && (!empty($subscriber['telefono'])) ? $subscriber['telefono'] : '-') .'</campo'.$fields['telefono'].'>';
|
127 |
+
$xmlData .= '<campo'.$fields['IDCliente'].'>'. ($synchroConfig && (!empty($subscriber['IDCliente'])) ? $subscriber['IDCliente'] : '') .'</campo'.$fields['IDCliente'].'>';
|
128 |
+
$xmlData .= '<campo'.$fields['IDUltimoOrdine'].'>'. ($synchroConfig && (!empty($subscriber['IDUltimoOrdine'])) ? $subscriber['IDUltimoOrdine'] : '') .'</campo'.$fields['IDUltimoOrdine'].'>';
|
129 |
+
$xmlData .= '<campo'.$fields['DataUltimoOrdine'].'>'. ($synchroConfig && (!empty($subscriber['DataUltimoOrdine'])) ? $subscriber['DataUltimoOrdine'] : '') .'</campo'.$fields['DataUltimoOrdine'].'>';
|
130 |
+
$xmlData .= '<campo'.$fields['TotaleUltimoOrdine'].'>'. ($synchroConfig && (!empty($subscriber['TotaleUltimoOrdine'])) ? $subscriber['TotaleUltimoOrdine'] : '') .'</campo'.$fields['TotaleUltimoOrdine'].'>';
|
131 |
+
$xmlData .= '<campo'.$fields['IDProdottiUltimoOrdine'].'>'. ($synchroConfig && (!empty($subscriber['IDProdottiUltimoOrdine'])) ? $subscriber['IDProdottiUltimoOrdine'] : '') .'</campo'.$fields['IDProdottiUltimoOrdine'].'>';
|
132 |
+
$xmlData .= '<campo'.$fields['IDCategorieUltimoOrdine'].'>'. ($synchroConfig && (!empty($subscriber['IDCategorieUltimoOrdine'])) ? $subscriber['IDCategorieUltimoOrdine'] : '') .'</campo'.$fields['IDCategorieUltimoOrdine'].'>';
|
133 |
+
$xmlData .= '<campo'.$fields['DataUltimoOrdineSpedito'].'>'. ($synchroConfig && (!empty($subscriber['DataUltimoOrdineSpedito'])) ? $subscriber['DataUltimoOrdineSpedito'] : '') .'</campo'.$fields['DataUltimoOrdineSpedito'].'>';
|
134 |
+
$xmlData .= '<campo'.$fields['IDUltimoOrdineSpedito'].'>'. ($synchroConfig && (!empty($subscriber['IDUltimoOrdineSpedito'])) ? $subscriber['IDUltimoOrdineSpedito'] : '') .'</campo'.$fields['IDUltimoOrdineSpedito'].'>';
|
135 |
+
$xmlData .= '<campo'.$fields['DataCarrelloAbbandonato'].'>'. ($synchroConfig && (!empty($subscriber['DataCarrelloAbbandonato'])) ? $subscriber['DataCarrelloAbbandonato'] : '') .'</campo'.$fields['DataCarrelloAbbandonato'].'>';
|
136 |
+
$xmlData .= '<campo'.$fields['TotaleCarrelloAbbandonato'].'>'. ($synchroConfig && (!empty($subscriber['TotaleCarrelloAbbandonato'])) ? $subscriber['TotaleCarrelloAbbandonato'] : '') .'</campo'.$fields['TotaleCarrelloAbbandonato'].'>';
|
137 |
+
$xmlData .= '<campo'.$fields['IDCarrelloAbbandonato'].'>'. ($synchroConfig && (!empty($subscriber['IDCarrelloAbbandonato'])) ? $subscriber['IDCarrelloAbbandonato'] : '') .'</campo'.$fields['IDCarrelloAbbandonato'].'>';
|
138 |
+
$xmlData .= '<campo'.$fields['TotaleFatturato'].'>'. ($synchroConfig && (!empty($subscriber['TotaleFatturato'])) ? $subscriber['TotaleFatturato'] : '') .'</campo'.$fields['TotaleFatturato'].'>';
|
139 |
+
$xmlData .= '<campo'.$fields['TotaleFatturatoUltimi12Mesi'].'>'. ($synchroConfig && (!empty($subscriber['TotaleFatturatoUltimi12Mesi'])) ? $subscriber['TotaleFatturatoUltimi12Mesi'] : '') .'</campo'.$fields['TotaleFatturatoUltimi12Mesi'].'>';
|
140 |
+
$xmlData .= '<campo'.$fields['TotaleFatturatoUltimi30gg'].'>'. ($synchroConfig && (!empty($subscriber['TotaleFatturatoUltimi30gg'])) ? $subscriber['TotaleFatturatoUltimi30gg'] : '') .'</campo'.$fields['TotaleFatturatoUltimi30gg'].'>';
|
141 |
+
$xmlData .= '<campo'.$fields['IDTuttiProdottiAcquistati'].'>'. ($synchroConfig && (!empty($subscriber['IDTuttiProdottiAcquistati'])) ? $subscriber['IDTuttiProdottiAcquistati'] : '') .'</campo'.$fields['IDTuttiProdottiAcquistati'].'>';
|
142 |
+
|
143 |
+
$xmlData .= '</subscriber>';
|
144 |
+
|
145 |
+
continue 2;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
$xmlData .= '</subscribers>';
|
150 |
+
|
151 |
+
Mage::log($xmlData, 0);
|
152 |
+
|
153 |
+
//invio a mailup gli iscritti da aggiungere al gruppo scelto
|
154 |
+
$MailUpWsImport = Mage::getModel('mailup/ws');
|
155 |
+
$wsImport = new MailUpWsImport();
|
156 |
+
|
157 |
+
//definisco il gruppo a cui aggiungere gli iscritti
|
158 |
+
$groupId = $post['mailupGroupId'];
|
159 |
+
$listGUID = $post['mailupListGUID'];
|
160 |
+
$idList = $post['mailupIdList'];
|
161 |
+
|
162 |
+
if ($post['mailupNewGroup'] == 1) {
|
163 |
+
$newGroup = array(
|
164 |
+
"idList" => $idList,
|
165 |
+
"listGUID" => $listGUID,
|
166 |
+
"newGroupName" => $post['mailupNewGroupName']
|
167 |
+
);
|
168 |
+
|
169 |
+
$groupId = $wsImport->CreaGruppo($newGroup);
|
170 |
+
}
|
171 |
|
172 |
+
$importProcessData = array(
|
173 |
+
"idList" => $idList,
|
174 |
+
"listGUID" => $listGUID,
|
175 |
+
"idGroup" => $groupId,
|
176 |
+
"xmlDoc" => $xmlData,
|
177 |
+
"idGroups" => $groupId,
|
178 |
+
"importType" => "3",
|
179 |
+
"mobileInputType" => "2",
|
180 |
+
"asPending" => "0",
|
181 |
+
"ConfirmEmail" => "0",
|
182 |
+
"asOptOut" => "0",
|
183 |
+
"forceOptIn" => "0",
|
184 |
+
"replaceGroups" => "0",
|
185 |
+
"idConfirmNL" => "0"
|
186 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
//avvio l'importazione su mailup
|
189 |
$processID = $wsImport->newImportProcess($importProcessData);
|
190 |
|
191 |
+
$process = array(
|
192 |
+
"idList" => $post['mailupIdList'],
|
193 |
+
"listGUID" => $post['mailupListGUID'],
|
194 |
+
"idProcess" => $processID
|
195 |
+
);
|
196 |
|
197 |
$wsImport->startProcess($process);
|
198 |
+
|
199 |
//echo $wsImport->getProcessDetail($process);
|
200 |
+
|
|
|
|
|
201 |
$message = $this->__('Gli iscritti sono stati inviati correttamente');
|
202 |
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
203 |
} catch (Exception $e) {
|
239 |
|
240 |
$this->_redirect('*/*');
|
241 |
}
|
242 |
+
|
243 |
+
public function testCronAction() {
|
244 |
+
$cron = new SevenLike_MailUp_Model_Cron();
|
245 |
+
$cron->run();
|
246 |
+
}
|
247 |
+
|
248 |
+
public function testFieldsAction() {
|
249 |
+
$MailUpWsSend = Mage::getModel('mailup/wssend');
|
250 |
+
$wsSend = new MailUpWsSend();
|
251 |
+
$accessKey = $wsSend->loginFromId();
|
252 |
+
|
253 |
+
if ($accessKey !== false) {
|
254 |
+
$fields = $wsSend->GetFields($accessKey);
|
255 |
+
|
256 |
+
print_r($fields);
|
257 |
+
die('success');
|
258 |
+
} else {
|
259 |
+
die('no access key returned');
|
260 |
+
}
|
261 |
+
}
|
262 |
}
|
263 |
+
|
264 |
+
/*
|
265 |
+
// mapping campi dell'XML
|
266 |
+
CAMPO1 -> NOME
|
267 |
+
CAMPO2 -> COGNOME
|
268 |
+
CAMPO3 -> AZIENDA
|
269 |
+
CAMPO4 -> CITTÀ
|
270 |
+
CAMPO5 -> PROVINCIA
|
271 |
+
CAMPO6 -> CAP
|
272 |
+
CAMPO7 -> REGIONE
|
273 |
+
CAMPO8 -> PAESE
|
274 |
+
CAMPO9 -> INDIRIZZO
|
275 |
+
CAMPO10 -> FAX
|
276 |
+
CAMPO11 -> TELEFONO
|
277 |
+
CAMPO12 -> IDCLIENTE
|
278 |
+
CAMPO13 -> IDULTIMOORDINE
|
279 |
+
CAMPO14 -> DATAULTIMOORDINE
|
280 |
+
CAMPO15 -> TOTALEULTIMOORDINE
|
281 |
+
CAMPO16 -> IDPRODOTTIULTIMOORDINE
|
282 |
+
CAMPO17 -> IDCATEGORIEULTIMOORDINE
|
283 |
+
CAMPO18 -> DATAULTIMOORDINESPEDITO
|
284 |
+
CAMPO19 -> IDULTIMOORDINESPEDITO
|
285 |
+
CAMPO20 -> DATACARRELLOABBANDONATO
|
286 |
+
CAMPO21 -> TOTALECARRELLOABBANDONATO
|
287 |
+
CAMPO22 -> IDCARRELLOABBANDONATO
|
288 |
+
CAMPO23 -> TOTALEFATTURATO
|
289 |
+
CAMPO24 -> TOTALEFATTURATOULTIMI12MESI
|
290 |
+
CAMPO25 -> TOTALEFATTURATOULTIMI30GG
|
291 |
+
CAMPO26 -> IDTUTTIPRODOTTIACQUISTATI*/
|
292 |
?>
|
app/code/local/SevenLike/MailUp/etc/config.xml
CHANGED
@@ -22,128 +22,124 @@
|
|
22 |
*/
|
23 |
-->
|
24 |
<config>
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
</
|
43 |
-
|
44 |
-
|
45 |
-
<
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
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 |
-
</mailup_groups>
|
110 |
-
</children>
|
111 |
-
</catalog>
|
112 |
-
</children>
|
113 |
-
</admin>
|
114 |
-
</resources>
|
115 |
-
</acl>
|
116 |
-
|
117 |
-
<layout>
|
118 |
-
<updates>
|
119 |
-
<mailup>
|
120 |
-
<file>mailup.xml</file>
|
121 |
-
</mailup>
|
122 |
-
</updates>
|
123 |
-
</layout>
|
124 |
-
|
125 |
-
<translate>
|
126 |
-
<modules>
|
127 |
-
<mailup>
|
128 |
-
<files>
|
129 |
-
<default>SevenLike_MailUp.csv</default>
|
130 |
-
</files>
|
131 |
-
</mailup>
|
132 |
-
</modules>
|
133 |
-
</translate>
|
134 |
-
</adminhtml>
|
135 |
-
|
136 |
-
<crontab>
|
137 |
-
<jobs>
|
138 |
-
<sevenlike_mailup>
|
139 |
-
<schedule>
|
140 |
-
<cron_expr>* 3 * * *</cron_expr>
|
141 |
-
</schedule>
|
142 |
-
<run>
|
143 |
-
<model>mailup/Cron::run</model>
|
144 |
-
</run>
|
145 |
-
</sevenlike_mailup>
|
146 |
-
</jobs>
|
147 |
-
</crontab>
|
148 |
-
|
149 |
-
</config>
|
22 |
*/
|
23 |
-->
|
24 |
<config>
|
25 |
+
<modules>
|
26 |
+
<SevenLike_MailUp>
|
27 |
+
<version>1.0.0</version>
|
28 |
+
</SevenLike_MailUp>
|
29 |
+
</modules>
|
30 |
|
31 |
+
<global>
|
32 |
+
<models>
|
33 |
+
<mailup>
|
34 |
+
<class>SevenLike_MailUp_Model</class>
|
35 |
+
</mailup>
|
36 |
+
</models>
|
37 |
+
<blocks>
|
38 |
+
<mailup>
|
39 |
+
<class>SevenLike_MailUp_Block</class>
|
40 |
+
</mailup>
|
41 |
+
</blocks>
|
42 |
+
<helpers>
|
43 |
+
<sintax>
|
44 |
+
<class>SevenLike_MailUp_Helper</class>
|
45 |
+
</sintax>
|
46 |
+
</helpers>
|
47 |
+
<resources>
|
48 |
+
<mailup_setup>
|
49 |
+
<setup>
|
50 |
+
<module>SevenLike_MailUp</module>
|
51 |
+
</setup>
|
52 |
+
<connection>
|
53 |
+
<use>core_setup</use>
|
54 |
+
</connection>
|
55 |
+
</mailup_setup>
|
56 |
+
<mailup_write>
|
57 |
+
<connection>
|
58 |
+
<use>core_write</use>
|
59 |
+
</connection>
|
60 |
+
</mailup_write>
|
61 |
+
<mailup_read>
|
62 |
+
<connection>
|
63 |
+
<use>core_read</use>
|
64 |
+
</connection>
|
65 |
+
</mailup_read>
|
66 |
+
</resources>
|
67 |
+
</global>
|
68 |
|
69 |
+
<admin>
|
70 |
+
<routers>
|
71 |
+
<mailup>
|
72 |
+
<use>admin</use>
|
73 |
+
<args>
|
74 |
+
<module>SevenLike_MailUp</module>
|
75 |
+
<frontName>mailup</frontName>
|
76 |
+
</args>
|
77 |
+
</mailup>
|
78 |
+
</routers>
|
79 |
+
</admin>
|
80 |
+
|
81 |
+
<default>
|
82 |
+
<newsletter>
|
83 |
+
<mailup>
|
84 |
+
<model>mailup/ws</model>
|
85 |
+
</mailup>
|
86 |
+
</newsletter>
|
87 |
+
</default>
|
88 |
+
|
89 |
+
<adminhtml>
|
90 |
+
<menu>
|
91 |
+
<newsletter>
|
92 |
+
<children>
|
93 |
+
<mailup_groups translate="title" module="newsletter">
|
94 |
+
<title>MailUp</title>
|
95 |
+
<action>mailup/adminhtml_filter</action>
|
96 |
+
</mailup_groups>
|
97 |
+
</children>
|
98 |
+
</newsletter>
|
99 |
+
</menu>
|
100 |
+
<acl>
|
101 |
+
<resources>
|
102 |
+
<admin>
|
103 |
+
<children>
|
104 |
+
<catalog>
|
105 |
+
<children>
|
106 |
+
<mailup_groups>
|
107 |
+
<title>Mailup</title>
|
108 |
+
</mailup_groups>
|
109 |
+
</children>
|
110 |
+
</catalog>
|
111 |
+
</children>
|
112 |
+
</admin>
|
113 |
+
</resources>
|
114 |
+
</acl>
|
115 |
+
<layout>
|
116 |
+
<updates>
|
117 |
+
<mailup>
|
118 |
+
<file>mailup.xml</file>
|
119 |
+
</mailup>
|
120 |
+
</updates>
|
121 |
+
</layout>
|
122 |
+
<translate>
|
123 |
+
<modules>
|
124 |
+
<mailup>
|
125 |
+
<files>
|
126 |
+
<default>SevenLike_MailUp.csv</default>
|
127 |
+
</files>
|
128 |
+
</mailup>
|
129 |
+
</modules>
|
130 |
+
</translate>
|
131 |
+
</adminhtml>
|
132 |
+
|
133 |
+
<crontab>
|
134 |
+
<jobs>
|
135 |
+
<sevenlike_mailup>
|
136 |
+
<schedule>
|
137 |
+
<cron_expr>0 3 * * *</cron_expr>
|
138 |
+
</schedule>
|
139 |
+
<run>
|
140 |
+
<model>mailup/Cron::run</model>
|
141 |
+
</run>
|
142 |
+
</sevenlike_mailup>
|
143 |
+
</jobs>
|
144 |
+
</crontab>
|
145 |
+
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/SevenLike/MailUp/etc/system.xml
CHANGED
@@ -24,51 +24,73 @@
|
|
24 |
<config>
|
25 |
<sections>
|
26 |
<newsletter>
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
<
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
</newsletter>
|
73 |
</sections>
|
74 |
-
</config>
|
24 |
<config>
|
25 |
<sections>
|
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>30</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>40</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
</password>
|
53 |
+
<id_console translate="comment">
|
54 |
+
<label>Console ID</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>20</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<comment>You can retrieve it in your console (Manage->Web Services), using the numeric portion of the user field (e.g. 'a1234' -> '1234')</comment>
|
59 |
+
</id_console>
|
60 |
+
<password_ws translate="comment">
|
61 |
+
<label>Webservice password</label>
|
62 |
+
<frontend_type>password</frontend_type>
|
63 |
+
<sort_order>60</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<comment>You can set it in your console (Manage->Web Services), then type it here</comment>
|
66 |
+
</password_ws>
|
67 |
+
<list translate="comment">
|
68 |
+
<label>List</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>mailup/lists</source_model>
|
71 |
+
<sort_order>60</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<!--comment>If you haven't yet, we suggest you to create a DEM list directly from your mailup console</comment-->
|
74 |
+
</list>
|
75 |
+
<enable_cron_export tranlate="label">
|
76 |
+
<label>Enable Automatic Data Export</label>
|
77 |
+
<frontend_type>select</frontend_type>
|
78 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
79 |
+
<sort_order>70</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<comment>Contact your account MailUp account representative for more information about this feature.</comment>
|
82 |
+
</enable_cron_export>
|
83 |
+
<enable_mailup_synchro tranlate="label">
|
84 |
+
<label>Enable Automatic Synchronization with your Mailup account</label>
|
85 |
+
<frontend_type>select</frontend_type>
|
86 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
87 |
+
<sort_order>80</sort_order>
|
88 |
+
<show_in_default>1</show_in_default>
|
89 |
+
<comment>Contact your account MailUp account representative for more information about this feature.</comment>
|
90 |
+
</enable_mailup_synchro>
|
91 |
+
</fields>
|
92 |
+
</mailup>
|
93 |
+
</groups>
|
94 |
</newsletter>
|
95 |
</sections>
|
96 |
+
</config>
|
app/design/adminhtml/default/default/template/sevenlike/mailup/confirm.phtml
CHANGED
@@ -18,6 +18,7 @@ $endPos = strpos($xmlString, '</Lists>');
|
|
18 |
$endLists = $endPos + strlen('</Lists>') - $startLists;
|
19 |
|
20 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
|
|
21 |
$xml = simplexml_load_string($xmlLists);
|
22 |
?>
|
23 |
|
@@ -44,8 +45,8 @@ $xml = simplexml_load_string($xmlLists);
|
|
44 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
45 |
<?php
|
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) {
|
@@ -80,7 +81,7 @@ $xml = simplexml_load_string($xmlLists);
|
|
80 |
<?php
|
81 |
//gestisco la lista selezionata in configurazione
|
82 |
foreach($xml->List as $list) {
|
83 |
-
if ($list['listGUID'] == Mage::getStoreConfig('newsletter/mailup/list')){
|
84 |
$listName = $list['listName'];
|
85 |
$idList = $list['idList'];
|
86 |
$listGUID = $list['listGUID'];
|
18 |
$endLists = $endPos + strlen('</Lists>') - $startLists;
|
19 |
|
20 |
$xmlLists = substr($xmlString, $startLists, $endLists);
|
21 |
+
$xmlLists = str_replace("&", "&", $xmlLists);
|
22 |
$xml = simplexml_load_string($xmlLists);
|
23 |
?>
|
24 |
|
45 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
46 |
<?php
|
47 |
$countPost = 0;
|
48 |
+
$textArea = '';
|
49 |
+
$formParams = '';
|
50 |
$mailupCustomerIds = array();
|
51 |
//mi passo gli id di tutti i clienti filtrati
|
52 |
foreach ($customersFiltered as $customer) {
|
81 |
<?php
|
82 |
//gestisco la lista selezionata in configurazione
|
83 |
foreach($xml->List as $list) {
|
84 |
+
if ($list['listGUID'] == Mage::getStoreConfig('newsletter/mailup/list')) {
|
85 |
$listName = $list['listName'];
|
86 |
$idList = $list['idList'];
|
87 |
$listGUID = $list['listGUID'];
|
app/design/adminhtml/default/default/template/sevenlike/mailup/filter.phtml
CHANGED
@@ -405,6 +405,9 @@ if ($login > 0 || strlen(Mage::getStoreConfig('newsletter/mailup/list')) < 2) {
|
|
405 |
|
406 |
</table>
|
407 |
</fieldset>
|
|
|
|
|
|
|
408 |
</div>
|
409 |
<script type="text/javascript">
|
410 |
var editForm = new varienForm('edit_form');
|
405 |
|
406 |
</table>
|
407 |
</fieldset>
|
408 |
+
|
409 |
+
<a href="<?=$this->getUrl('*/*/testCron')?>">TEST CRON</a>
|
410 |
+
<a href="<?=$this->getUrl('*/*/testFields')?>">TEST GETFIELDS</a>
|
411 |
</div>
|
412 |
<script type="text/javascript">
|
413 |
var editForm = new varienForm('edit_form');
|
app/locale/en_US/SevenLike_MailUp.csv
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"Warning: no member has been selected","Warning: no member has been selected"
|
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","
|
6 |
"Sold products","Purchase History"
|
7 |
"All customers","All customers"
|
8 |
"Customers who have purchased","Customers who have purchased"
|
@@ -28,7 +28,7 @@
|
|
28 |
"Haven't purchased","did not purchase"
|
29 |
"Have purchased","purchased"
|
30 |
"In this period","In this period"
|
31 |
-
"Filter hints","
|
32 |
"All wholesale customers who haven't purchased yet","All wholesale customers who haven't purchased yet"
|
33 |
"Set filter","Set filter"
|
34 |
"More than 50 Euros orders","More than 50 Euros orders"
|
@@ -50,7 +50,7 @@
|
|
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.","
|
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)"
|
@@ -58,13 +58,13 @@
|
|
58 |
"Insert product SKU","Products whose SKU contains..."
|
59 |
"Enable Cron Export","Enable Cron Export"
|
60 |
"Subscription date","Subscription date"
|
61 |
-
"Save hint","Save
|
62 |
-
"Delete hint","Delete
|
63 |
-
"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
|
68 |
"Opted-in Only","Opted-in Only"
|
69 |
"All customers","All customers"
|
70 |
"Products and categories","Products and categories"
|
2 |
"Warning: no member has been selected","Warning: no member has been selected"
|
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","View saved filters"
|
6 |
"Sold products","Purchase History"
|
7 |
"All customers","All customers"
|
8 |
"Customers who have purchased","Customers who have purchased"
|
28 |
"Haven't purchased","did not purchase"
|
29 |
"Have purchased","purchased"
|
30 |
"In this period","In this period"
|
31 |
+
"Filter hints","Saved Filters"
|
32 |
"All wholesale customers who haven't purchased yet","All wholesale customers who haven't purchased yet"
|
33 |
"Set filter","Set filter"
|
34 |
"More than 50 Euros orders","More than 50 Euros orders"
|
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.","By using this tool, you can export targeted groups of customers to MailUp and send them a message from within your MailUp account."
|
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)"
|
58 |
"Insert product SKU","Products whose SKU contains..."
|
59 |
"Enable Cron Export","Enable Cron Export"
|
60 |
"Subscription date","Subscription date"
|
61 |
+
"Save hint","Save filter"
|
62 |
+
"Delete hint","Delete"
|
63 |
+
"Set hint","Use this filter"
|
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 this filter"
|
68 |
"Opted-in Only","Opted-in Only"
|
69 |
"All customers","All customers"
|
70 |
"Products and categories","Products and categories"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MailUp</name>
|
4 |
-
<version>1.
|
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>Introduced
|
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="
|
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.5.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 the ability to send ecommerce data in related fields for user with ecommerce account enabled.</notes>
|
49 |
<authors><author><name>Sevenlike</name><user>sevenlike</user><email>moduli-magento@sevenlike.com</email></author></authors>
|
50 |
+
<date>2012-05-18</date>
|
51 |
+
<time>2012-05-18</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="ee16b57200066c749a96bf44dc0130ae"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Model"><file name="Cron.php" hash="aec83f729707dccaad34af97b99d62ed"/><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="94debc8e5a03f6281b2ba07b871d215b"/><file name="Wssend.php" hash="a4527e978990a8a0be997165d959eb80"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FilterController.php" hash="c5088696a9af69e9e07b80f3ef601828"/><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="etc"><file name="config.xml" hash="117c724188bc028548a5a82c614f3cbc"/><file name="system.xml" hash="979585859aabbd185407f40aa799207e"/><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="8223bf1219e5cf7924d8881f1861f5e3"/><file name="filter.phtml" hash="ab06b175b3655cad6a84efeafb3002f5"/></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="7388cfb49cf963f78f59c24633027f67"/></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>
|