Sarbacane_Sarbacanedesktop - Version 1.0.0.6

Version Notes

We removed the limitation on customer synchronization.

Download this release

Release Info

Developer Sarbacane Software
Extension Sarbacane_Sarbacanedesktop
Version 1.0.0.6
Comparing to
See all releases


Code changes from version 1.0.0.5 to 1.0.0.6

app/code/community/Sarbacane/Sarbacanedesktop/Helper/Data.php CHANGED
@@ -68,15 +68,18 @@ class Sarbacane_Sarbacanedesktop_Helper_Data extends Mage_Core_Helper_Abstract
68
  }
69
  }
70
 
71
- public function resetList($list_type, $store_id, $sd_id = '')
72
  {
 
 
 
73
  $resource = Mage::getSingleton('core/resource');
74
  $db_write = $resource->getConnection('core_write');
75
  $sarbacanedesktop = $resource->getTableName('sarbacanedesktop_users');
76
  $rq_sql = '
77
  DELETE FROM `' . $sarbacanedesktop . '`
78
  WHERE `sd_type` = "sd_id"
79
- AND `sd_id` = ' . $db_write->quote($sd_id);
80
  $db_write->query($rq_sql);
81
  }
82
 
68
  }
69
  }
70
 
71
+ public function resetList($list_id = '')
72
  {
73
+ $id_shop = $this->getStoreidFromList($list_id);
74
+ $list_type = $this->getListTypeFromList($list_id);
75
+
76
  $resource = Mage::getSingleton('core/resource');
77
  $db_write = $resource->getConnection('core_write');
78
  $sarbacanedesktop = $resource->getTableName('sarbacanedesktop_users');
79
  $rq_sql = '
80
  DELETE FROM `' . $sarbacanedesktop . '`
81
  WHERE `sd_type` = "sd_id"
82
+ AND `list_id` = ' . $db_write->quote($id_shop.$list_type);
83
  $db_write->query($rq_sql);
84
  }
85
 
app/code/community/Sarbacane/Sarbacanedesktop/controllers/Adminhtml/SarbacanedesktopController.php CHANGED
@@ -78,9 +78,7 @@ class Sarbacane_Sarbacanedesktop_Adminhtml_SarbacanedesktopController extends Ma
78
  {
79
  if (!in_array($sd_list, $old_sd_list_array))
80
  {
81
- $id_shop = Mage::helper('sarbacanedesktop')->getStoreidFromList($sd_list);
82
- $list_type = Mage::helper('sarbacanedesktop')->getListTypeFromList($sd_list);
83
- Mage::helper('sarbacanedesktop')->resetList($list_type, $id_shop);
84
  }
85
  }
86
  }
78
  {
79
  if (!in_array($sd_list, $old_sd_list_array))
80
  {
81
+ Mage::helper('sarbacanedesktop')->resetList($sd_list);
 
 
82
  }
83
  }
84
  }
app/code/community/Sarbacane/Sarbacanedesktop/controllers/IndexController.php CHANGED
@@ -1,306 +1,323 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * @category Sarbacane
16
- * @package Sarbacane_Sarbacanedesktop
17
- * @author Sarbacane Software <contact@sarbacane.com>
18
- * @copyright 2015 Sarbacane Software
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- class Sarbacane_Sarbacanedesktop_IndexController extends Mage_Core_Controller_Front_Action {
22
- private function saveSdid($sdid, $list) {
23
- $resource = Mage::getSingleton ( 'core/resource' );
24
- $db_write = $resource->getConnection ( 'core_write' );
25
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
26
-
27
- $rq_sql = 'DELETE FROM `' . $sarbacanedesktop_users . '` WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sdid . '\' AND list_id=\'' . $list . '\'';
28
- $rq = $db_write->query ( $rq_sql );
29
- $rq_sql = '
30
- INSERT INTO `' . $sarbacanedesktop_users . '` (`sd_type`, `sd_value`, `list_id`, `last_call_date` ) VALUES
31
- (\'sd_id\', ' . $db_write->quote ( $sdid ) . ', \'' . $list . '\', \'' . date ( 'Y-m-d H:i:s' ) . '\')';
32
- $rq = $db_write->query ( $rq_sql );
33
- return;
34
- }
35
- public function indexAction() {
36
- if (Mage::app ()->getRequest ()->getParam ( 'stk' ) && Mage::app ()->getRequest ()->getParam ( 'sdid' )) {
37
- $sdid = Mage::app ()->getRequest ()->getParam ( 'sdid' );
38
- if (Mage::app ()->getRequest ()->getParam ( 'stk' ) == Mage::helper ( 'sarbacanedesktop' )->getToken () && $sdid != '') {
39
- $identifier = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'identifier' );
40
- $sd_id = "";
41
- $configuration = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'all' );
42
- if ($configuration ['sd_token'] != '' && $configuration ['sd_list'] != '') {
43
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
44
- if ($sd_list_array != '') {
45
- if (Mage::app ()->getRequest ()->getParam ( 'list' )) {
46
- $list = Mage::app ()->getRequest ()->getParam ( 'list' );
47
- $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
48
- $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
49
- $list_type_array = Mage::helper ( 'sarbacanedesktop' )->getListTypeArray ();
50
- if (in_array ( $list_type, $list_type_array )) {
51
- $id_and_list = $store_id . $list_type;
52
- if (($list_type == 'N' && in_array ( $id_and_list . '0', $sd_list_array )) || ($list_type == 'C' && (in_array ( $id_and_list . '0', $sd_list_array ) || in_array ( $id_and_list . '1', $sd_list_array )))) {
53
- $this->processNewUnsubcribersAndSubscribers ( $list_type, $store_id, $sdid );
54
- $sd_id = $this->saveSdid ( $sdid, $list );
55
- }else{
56
- header ( 'HTTP/1.1 404 Not found' );
57
- header ( "Content-type: application/json ; charset=utf-8" );
58
- die ( 'FAILED_ID' );
59
- }
60
- } else {
61
- header ( 'HTTP/1.1 404 Not found' );
62
- header ( "Content-type: application/json ; charset=utf-8" );
63
- die ( 'FAILED_ID' );
64
- }
65
- } else {
66
- if ('delete' == Mage::app ()->getRequest ()->getParam ( 'action' )) {
67
- Mage::helper ( 'sarbacanedesktop' )->deleteSdid ( $sd_id );
68
- } else {
69
- $this->getFormattedContentShops ( $sdid );
70
- }
71
- }
72
- }
73
- }
74
- } else {
75
- header ( "HTTP/1.1 403 Unauthorized" );
76
- header ( "Content-type: application/json; charset=utf-8" );
77
- die ( 'FAILED_SDTOKEN' );
78
- }
79
- } else {
80
- echo "Param&egrave;tre[s] manquant[s]";
81
- }
82
- }
83
- private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id) {
84
- $resource = Mage::getSingleton ( 'core/resource' );
85
- $db_read = $resource->getConnection ( 'core_read' );
86
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
87
- $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
88
- $last_call_date = $db_read->fetchOne ( $rq_sql );
89
-
90
- $line = 'email;lastname;firstname';
91
- if ($list_type == 'C') {
92
- if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
93
- $line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders';
94
- }
95
- }
96
- $line .= ';action';
97
- echo $line;
98
- $this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
99
- $this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
100
- }
101
- private function getListTypeArray() {
102
- return array (
103
- 'N',
104
- 'C'
105
- );
106
- }
107
- private function checkIfListWithCustomerData($list_type, $store_id) {
108
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
109
- if (in_array ( $store_id . $list_type . '1', $sd_list_array )) {
110
- return true;
111
- }
112
- return false;
113
- }
114
- private function getFormattedContentShops($sd_id) {
115
- $stores = Mage::helper ( 'sarbacanedesktop' )->getStoresArray ();
116
- echo 'list_id;name;reset;is_updated;type;version' . "\n";
117
- $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
118
- $list_array = array ();
119
- foreach ( $sd_list_array as $list ) {
120
- $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
121
- $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
122
- array_push ( $list_array, array (
123
- 'store_id' => $store_id,
124
- 'list_type' => $list_type,
125
- 'list_id' => $list
126
- ) );
127
- }
128
- foreach ( $stores as $store ) {
129
- foreach ( $list_array as $list ) {
130
- if ($store ['store_id'] == $list ['store_id']) {
131
- $store_list = "" . $store ['store_id'] . $list ['list_type'] . ';' . $this->dQuote ( $store ['store_name'] ) . ';'; // TEST
132
- $store_list .= $this->listIsResetted ( $store ['store_id'] . $list ['list_type'], $sd_id ) . ';';
133
- $store_list .= $this->listIsUpdated ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
134
- $store_list .= 'Magento;1.0.0.4' . "\n";
135
- echo $store_list;
136
- }
137
- }
138
- }
139
- }
140
- private function listIsResetted($list_id, $sd_id) {
141
- $resource = Mage::getSingleton ( 'core/resource' );
142
- $db_read = $resource->getConnection ( 'core_read' );
143
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
144
- $rq_sql = '
145
- SELECT count(*) AS `nb_in_table`
146
- FROM ' . $sarbacanedesktop_users . '
147
- WHERE `sd_type` = "sd_id"
148
- AND `sd_value` = ' . $db_read->quote ( $sd_id ) . ' AND list_id="' . $list_id . '"';
149
- $nb_in_table = $db_read->fetchOne ( $rq_sql );
150
- if ($nb_in_table == 0)
151
- return 'Y';
152
- return 'N';
153
- }
154
- private function listIsUpdated($store_id, $list_type, $sd_id) {
155
- $resource = Mage::getSingleton ( 'core/resource' );
156
- $db_read = $resource->getConnection ( 'core_read' );
157
- $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
158
- $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
159
- $last_call_date = $db_read->fetchOne ( $rq_sql );
160
-
161
- $is_updated_list = 'N';
162
- if ($this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
163
- $is_updated_list = 'Y';
164
- }
165
- if ($this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
166
- $is_updated_list = 'Y';
167
- }
168
- return $is_updated_list;
169
- }
170
- private function dQuote($value) {
171
- $value = str_replace ( '"', '""', $value );
172
- if (strpos ( $value, ' ' ) || strpos ( $value, ';' )) {
173
- $value = '"' . $value . '"';
174
- }
175
- return $value;
176
- }
177
- private function processNewSubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
178
- $resource = Mage::getSingleton ( 'core/resource' );
179
- $db_read = $resource->getConnection ( 'core_read' );
180
- $db_write = $resource->getConnection ( 'core_write' );
181
- $sd_updates = $resource->getTableName ( 'sd_updates' );
182
- $newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
183
- $sales_flat_order = $resource->getTableName ( 'sales_flat_order' );
184
- $customer_entity = $resource->getTableName ( 'customer_entity' );
185
- $customer_entity_varchar = $resource->getTableName ( 'customer_entity_varchar' );
186
- $core_store = $resource->getTableName ( 'core_store' ); // core store
187
- $attr_firstname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'firstname' )->getAttributeId ();
188
- $attr_lastname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'lastname' )->getAttributeId ();
189
- $rq_sql_limit = '2500';
190
- if ($type_action == 'is_updated')
191
- $rq_sql_limit = '1';
192
- if ($list_type == 'N') {
193
- if ($last_call_date != null && $last_call_date != '') {
194
- $rq_sql = 'SELECT sdu.`email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
195
- FROM `' . $sd_updates . '` AS `sdu`
196
- LEFT JOIN ' . $newsletter_subscriber . ' ns ON ns.subscriber_email = sdu.email
197
- LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
198
- LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
199
- WHERE ns.`subscriber_status` = 1 AND sdu.update_time > "' . $last_call_date . '" AND sdu.list_type="N" AND sdu.action="S"
200
- AND ns.`store_id` = ' . ( int ) $store_id . '
201
- LIMIT 0, ' . $rq_sql_limit;
202
- } else {
203
- $rq_sql = '
204
- SELECT ns.`subscriber_email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
205
- FROM `' . $newsletter_subscriber . '` AS `ns`
206
- LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
207
- LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
208
- WHERE ns.`subscriber_status` = 1
209
- AND ns.`store_id` = ' . ( int ) $store_id . '
210
- LIMIT 0, ' . $rq_sql_limit;
211
- }
212
- } else if ($list_type == 'C') {
213
- $add_customer_data = $this->checkIfListWithCustomerData ( $list_type, $store_id );
214
- $rq_sql = "
215
- SELECT c.email AS email ,cevln.value as lastname , cevfn.value as firstname";
216
- if ($add_customer_data) {
217
- $rq_sql .= ", MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders";
218
- }
 
 
 
 
 
219
  $rq_sql .= " FROM $customer_entity c LEFT JOIN $customer_entity_varchar cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7
220
- LEFT JOIN $customer_entity_varchar cevfn ON cevfn.entity_id = c.entity_id AND cevfn.attribute_id = 5";
221
- if ($add_customer_data) {
222
- $rq_sql .= " LEFT JOIN $sales_flat_order sfo ON sfo.customer_id = c.entity_id ";
223
- }
224
- $rq_sql .= " WHERE c.store_id = " . $store_id;
225
- if ($last_call_date != null && $last_call_date != '') {
226
- $rq_sql .= " AND (c.created_at > '" . $last_call_date . "' OR c.updated_at > '" . $last_call_date . "' OR sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
227
- }
 
 
 
 
228
  $rq_sql .= " GROUP BY c.email
229
  UNION
230
- SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname, sfo.customer_firstname as firstname";
231
- if ($add_customer_data) {
232
- $rq_sql .= ", MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders";
233
- }
234
- $rq_sql .= "
235
- FROM $sales_flat_order sfo
236
- WHERE sfo.customer_id IS NULL AND sfo.store_id = " . $store_id;
237
- if ($last_call_date != null && $last_call_date != '') {
238
- $rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
239
- }
240
- $rq_sql .= " GROUP BY sfo.customer_email ";
241
-
242
- $rq_sql .= " LIMIT 0, " . $rq_sql_limit;
243
- } else {
244
- return;
245
- }
246
- if ($type_action == 'is_updated') {
247
- $rq = $db_read->fetchAll ( $rq_sql );
248
- return count ( $rq );
249
- } else {
250
- $rq = $db_read->query ( $rq_sql );
251
- while ( $r = $rq->fetch () ) {
252
- $line = "\r\n" . $this->dQuote ( $r ['email'] ) . ';'; // TEST
253
- $line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
254
- $orders_data = '';
255
- if ($list_type == 'C') {
256
- if ($add_customer_data) {
257
- $line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
258
- $line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
259
- $line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'];
260
- $orders_data = $r ['amount_min_order'] . $r ['amount_max_order'];
261
- $orders_data .= $r ['nb_orders'] . $r ['amount_all_orders'];
262
- }
263
- }
264
- $line .= ';S';
265
- echo $line;
266
- }
267
- }
268
- }
269
- private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
270
- $resource = Mage::getSingleton ( 'core/resource' );
271
- $db_read = $resource->getConnection ( 'core_read' );
272
-
273
- $sd_updates = $resource->getTableName ( 'sd_updates' );
274
-
275
- $rq_sql_limit = '2500';
276
- if ($type_action == 'is_updated')
277
- $rq_sql_limit = '1';
278
- switch ($list_type) {
279
- case 'N' :
280
- case 'C' :
281
- $rq_sql = 'SELECT email FROM ' . $sd_updates . ' WHERE list_type="' . $list_type . '" AND action = "U"';
282
- if ($last_call_date != null && $last_call_date != '') {
283
- $rq_sql .= ' AND update_time > "' . $last_call_date . '"';
284
- }
285
- break;
286
- default :
287
- return;
288
- }
289
- if ($type_action == 'is_updated') {
290
- $rq = $db_read->fetchAll ( $rq_sql );
291
- return count ( $rq );
292
- } else {
293
- $rq = $db_read->query ( $rq_sql );
294
- while ( $r = $rq->fetch () ) {
295
- $line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
296
- if ($list_type == 'C') {
297
- if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
298
- $line .= ';;;;;';
299
- }
300
- }
301
- $line .= ';U' . "\r\n";
302
- echo $line;
303
- }
304
- }
305
- }
 
 
 
 
 
 
 
 
306
  }
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category Sarbacane
16
+ * @package Sarbacane_Sarbacanedesktop
17
+ * @author Sarbacane Software <contact@sarbacane.com>
18
+ * @copyright 2015 Sarbacane Software
19
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
+ */
21
+ class Sarbacane_Sarbacanedesktop_IndexController extends Mage_Core_Controller_Front_Action {
22
+ private function saveSdid($sdid, $list) {
23
+ $resource = Mage::getSingleton ( 'core/resource' );
24
+ $db_write = $resource->getConnection ( 'core_write' );
25
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
26
+
27
+ $rq_sql = 'DELETE FROM `' . $sarbacanedesktop_users . '` WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sdid . '\' AND list_id=\'' . $list . '\'';
28
+ $rq = $db_write->query ( $rq_sql );
29
+ $rq_sql = '
30
+ INSERT INTO `' . $sarbacanedesktop_users . '` (`sd_type`, `sd_value`, `list_id`, `last_call_date` ) VALUES
31
+ (\'sd_id\', ' . $db_write->quote ( $sdid ) . ', \'' . $list . '\', \'' . date ( 'Y-m-d H:i:s' ) . '\')';
32
+ $rq = $db_write->query ( $rq_sql );
33
+ return;
34
+ }
35
+ public function indexAction() {
36
+ if (Mage::app ()->getRequest ()->getParam ( 'stk' ) && Mage::app ()->getRequest ()->getParam ( 'sdid' )) {
37
+ $sdid = Mage::app ()->getRequest ()->getParam ( 'sdid' );
38
+ if (Mage::app ()->getRequest ()->getParam ( 'stk' ) == Mage::helper ( 'sarbacanedesktop' )->getToken () && $sdid != '') {
39
+ $identifier = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'identifier' );
40
+ $sd_id = "";
41
+ $configuration = Mage::helper ( 'sarbacanedesktop' )->getConfiguration ( 'all' );
42
+ if ($configuration ['sd_token'] != '' && $configuration ['sd_list'] != '') {
43
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
44
+ if ($sd_list_array != '') {
45
+ if (Mage::app ()->getRequest ()->getParam ( 'list' )) {
46
+ $list = Mage::app ()->getRequest ()->getParam ( 'list' );
47
+ $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
48
+ $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
49
+ $list_type_array = Mage::helper ( 'sarbacanedesktop' )->getListTypeArray ();
50
+ if (in_array ( $list_type, $list_type_array )) {
51
+ $id_and_list = $store_id . $list_type;
52
+ if (($list_type == 'N' && in_array ( $id_and_list . '0', $sd_list_array )) || ($list_type == 'C' && (in_array ( $id_and_list . '0', $sd_list_array ) || in_array ( $id_and_list . '1', $sd_list_array )))) {
53
+ $this->processNewUnsubcribersAndSubscribers ( $list_type, $store_id, $sdid );
54
+ $sd_id = $this->saveSdid ( $sdid, $list );
55
+ } else {
56
+ header ( 'HTTP/1.1 404 Not found' );
57
+ header ( "Content-type: application/json ; charset=utf-8" );
58
+ die ( 'FAILED_ID' );
59
+ }
60
+ } else {
61
+ header ( 'HTTP/1.1 404 Not found' );
62
+ header ( "Content-type: application/json ; charset=utf-8" );
63
+ die ( 'FAILED_ID' );
64
+ }
65
+ } else {
66
+ if ('delete' == Mage::app ()->getRequest ()->getParam ( 'action' )) {
67
+ Mage::helper ( 'sarbacanedesktop' )->deleteSdid ( $sd_id );
68
+ } else {
69
+ $this->getFormattedContentShops ( $sdid );
70
+ }
71
+ }
72
+ }
73
+ }
74
+ } else {
75
+ header ( "HTTP/1.1 403 Unauthorized" );
76
+ header ( "Content-type: application/json; charset=utf-8" );
77
+ die ( 'FAILED_SDTOKEN' );
78
+ }
79
+ } else {
80
+ echo "Param&egrave;tre[s] manquant[s]";
81
+ }
82
+ }
83
+ private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id) {
84
+ $resource = Mage::getSingleton ( 'core/resource' );
85
+ $db_read = $resource->getConnection ( 'core_read' );
86
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
87
+ $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
88
+ $last_call_date = $db_read->fetchOne ( $rq_sql );
89
+
90
+ $line = 'email;lastname;firstname';
91
+ if ($list_type == 'C') {
92
+ if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
93
+ $line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders;most_profitable_category';
94
+ }
95
+ }
96
+ $line .= ';action';
97
+ echo $line;
98
+ $this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
99
+ $this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
100
+ }
101
+ private function getListTypeArray() {
102
+ return array (
103
+ 'N',
104
+ 'C'
105
+ );
106
+ }
107
+ private function checkIfListWithCustomerData($list_type, $store_id) {
108
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
109
+ if (in_array ( $store_id . $list_type . '1', $sd_list_array )) {
110
+ return true;
111
+ }
112
+ return false;
113
+ }
114
+ private function getFormattedContentShops($sd_id) {
115
+ $stores = Mage::helper ( 'sarbacanedesktop' )->getStoresArray ();
116
+ echo 'list_id;name;reset;is_updated;type;version' . "\n";
117
+ $sd_list_array = Mage::helper ( 'sarbacanedesktop' )->getListConfiguration ( 'array' );
118
+ $list_array = array ();
119
+ foreach ( $sd_list_array as $list ) {
120
+ $store_id = Mage::helper ( 'sarbacanedesktop' )->getStoreidFromList ( $list );
121
+ $list_type = Mage::helper ( 'sarbacanedesktop' )->getListTypeFromList ( $list );
122
+ array_push ( $list_array, array (
123
+ 'store_id' => $store_id,
124
+ 'list_type' => $list_type,
125
+ 'list_id' => $list
126
+ ) );
127
+ }
128
+ foreach ( $stores as $store ) {
129
+ foreach ( $list_array as $list ) {
130
+ if ($store ['store_id'] == $list ['store_id']) {
131
+ $store_list = "" . $store ['store_id'] . $list ['list_type'] . ';' . $this->dQuote ( $store ['store_name'] ) . ';'; // TEST
132
+ $store_list .= $this->listIsResetted ( $store ['store_id'] . $list ['list_type'], $sd_id ) . ';';
133
+ $store_list .= $this->listIsUpdated ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
134
+ $store_list .= 'Magento;1.0.0.6' . "\n";
135
+ echo $store_list;
136
+ }
137
+ }
138
+ }
139
+ }
140
+ private function listIsResetted($list_id, $sd_id) {
141
+ $resource = Mage::getSingleton ( 'core/resource' );
142
+ $db_read = $resource->getConnection ( 'core_read' );
143
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
144
+ $rq_sql = '
145
+ SELECT count(*) AS `nb_in_table`
146
+ FROM ' . $sarbacanedesktop_users . '
147
+ WHERE `sd_type` = "sd_id"
148
+ AND `sd_value` = ' . $db_read->quote ( $sd_id ) . ' AND list_id="' . $list_id . '"';
149
+ $nb_in_table = $db_read->fetchOne ( $rq_sql );
150
+ if ($nb_in_table == 0)
151
+ return 'Y';
152
+ return 'N';
153
+ }
154
+ private function listIsUpdated($store_id, $list_type, $sd_id) {
155
+ $resource = Mage::getSingleton ( 'core/resource' );
156
+ $db_read = $resource->getConnection ( 'core_read' );
157
+ $sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
158
+ $rq_sql = 'SELECT last_call_date FROM ' . $sarbacanedesktop_users . ' WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sd_id . '\' AND list_id=\'' . $store_id . $list_type . '\'';
159
+ $last_call_date = $db_read->fetchOne ( $rq_sql );
160
+
161
+ $is_updated_list = 'N';
162
+ if ($this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
163
+ $is_updated_list = 'Y';
164
+ }
165
+ if ($this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
166
+ $is_updated_list = 'Y';
167
+ }
168
+ return $is_updated_list;
169
+ }
170
+ private function dQuote($value) {
171
+ $value = str_replace ( '"', '""', $value );
172
+ if (strpos ( $value, ' ' ) || strpos ( $value, ';' )) {
173
+ $value = '"' . $value . '"';
174
+ }
175
+ return $value;
176
+ }
177
+ private function processNewSubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
178
+ $resource = Mage::getSingleton ( 'core/resource' );
179
+ $db_read = $resource->getConnection ( 'core_read' );
180
+ $db_write = $resource->getConnection ( 'core_write' );
181
+ $sd_updates = $resource->getTableName ( 'sd_updates' );
182
+ $newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
183
+ $sales_flat_order = $resource->getTableName ( 'sales_flat_order' );
184
+ $sales_flat_order_item = $resource->getTableName ( 'sales_flat_order_item' );
185
+ $catalog_category_product = $resource->getTableName ( 'catalog_category_product' );
186
+ $catalog_category_entity_varchar = $resource->getTableName ( 'catalog_category_entity_varchar' );
187
+ $customer_entity = $resource->getTableName ( 'customer_entity' );
188
+ $customer_entity_varchar = $resource->getTableName ( 'customer_entity_varchar' );
189
+ $core_store = $resource->getTableName ( 'core_store' ); // core store
190
+ $attr_firstname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'firstname' )->getAttributeId ();
191
+ $attr_lastname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'lastname' )->getAttributeId ();
192
+ if ($list_type == 'N') {
193
+ if ($last_call_date != null && $last_call_date != '') {
194
+ $rq_sql = 'SELECT sdu.`email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
195
+ FROM `' . $sd_updates . '` AS `sdu`
196
+ LEFT JOIN ' . $newsletter_subscriber . ' ns ON ns.subscriber_email = sdu.email
197
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
198
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
199
+ WHERE ns.`subscriber_status` = 1 AND sdu.update_time > "' . $last_call_date . '" AND sdu.list_type="N" AND sdu.action="S"
200
+ AND ns.`store_id` = ' . ( int ) $store_id;
201
+ if ($type_action == 'is_updated')
202
+ $rq_sql .= ' LIMIT 0, 1 ';
203
+ } else {
204
+ $rq_sql = '
205
+ SELECT ns.`subscriber_email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
206
+ FROM `' . $newsletter_subscriber . '` AS `ns`
207
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
208
+ LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
209
+ WHERE ns.`subscriber_status` = 1
210
+ AND ns.`store_id` = ' . ( int ) $store_id;
211
+ if ($type_action == 'is_updated')
212
+ $rq_sql .= ' LIMIT 0, 1 ';
213
+ }
214
+ } else if ($list_type == 'C') {
215
+ $add_customer_data = $this->checkIfListWithCustomerData ( $list_type, $store_id );
216
+ $rq_sql = " SELECT t.email, t.lastname, t.firstname ";
217
+ if ($add_customer_data) {
218
+ $rq_sql .= " ,t.amount_max_order, t.amount_min_order, t.amount_avg_order, t.date_first_order, t.date_last_order, t.nb_orders, t.amount_all_orders,MAX(ta.amount_for_category), ta.category ";
219
+ }
220
+ $rq_sql .= " FROM ( SELECT c.email AS email,cevln.value AS lastname, cevfn.value AS firstname ";
221
+ if ($add_customer_data) {
222
+ $rq_sql .= ",MAX(sfo.base_grand_total) AS amount_max_order, MIN(sfo.base_grand_total) AS amount_min_order, AVG(sfo.base_grand_total) AS amount_avg_order, MIN(sfo.created_at) AS date_first_order, MAX(sfo.created_at) AS date_last_order, COUNT(sfo.entity_id) AS nb_orders, SUM(sfo.base_grand_total) AS amount_all_orders";
223
+ }
224
  $rq_sql .= " FROM $customer_entity c LEFT JOIN $customer_entity_varchar cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7
225
+ LEFT JOIN $customer_entity_varchar cevfn ON cevfn.entity_id = c.entity_id AND cevfn.attribute_id = 5";
226
+ if ($add_customer_data) {
227
+ $rq_sql .= " LEFT JOIN $sales_flat_order sfo ON sfo.customer_id = c.entity_id ";
228
+ }
229
+ $rq_sql .= " WHERE c.store_id = " . $store_id;
230
+ if ($last_call_date != null && $last_call_date != '') {
231
+ $rq_sql .= " AND (c.created_at > '" . $last_call_date . "' OR c.updated_at > '" . $last_call_date . "')";
232
+ if($add_customer_data){
233
+
234
+ $rq_sql .= " OR (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "')";
235
+ }
236
+ }
237
  $rq_sql .= " GROUP BY c.email
238
  UNION
239
+ SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname, sfo.customer_firstname as firstname";
240
+ if ($add_customer_data) {
241
+ $rq_sql .= ", MAX(sfo.base_grand_total) as amount_max_order, MIN(sfo.base_grand_total) as amount_min_order, AVG(sfo.base_grand_total) as amount_avg_order, MIN(sfo.created_at) as date_first_order, MAX(sfo.created_at) as date_last_order, COUNT(sfo.entity_id) as nb_orders, SUM(sfo.base_grand_total) as amount_all_orders";
242
+ }
243
+ $rq_sql .= " FROM $sales_flat_order sfo ";
244
+ $rq_sql .= " WHERE sfo.customer_id IS NULL AND sfo.store_id = " . $store_id;
245
+ if ($last_call_date != null && $last_call_date != '') {
246
+ $rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
247
+ }
248
+ $rq_sql .= " GROUP BY email ";
249
+
250
+ $rq_sql .= " ) as t ";
251
+ if($add_customer_data){
252
+ $rq_sql .= " LEFT JOIN (SELECT ccev.value AS category, SUM(sfoi.row_total) AS amount_for_category, sfo2.customer_email AS email FROM $sales_flat_order sfo2";
253
+ $rq_sql .= " LEFT JOIN $sales_flat_order_item sfoi ON sfo2.entity_id = sfoi.order_id";
254
+ $rq_sql .= " LEFT JOIN $catalog_category_product ccp ON ccp.product_id = sfoi.product_id";
255
+ $rq_sql .= " LEFT JOIN $catalog_category_entity_varchar ccev ON ccev.entity_id = ccp.category_id AND ccev.attribute_id=41 AND ccev.entity_type_id=3";
256
+ $rq_sql .= " WHERE sfo2.entity_id = (SELECT MAX(entity_id) FROM $sales_flat_order WHERE customer_email = sfo2.customer_email) ";
257
+ $rq_sql .= " GROUP BY email,category ";
258
+ $rq_sql .= " ORDER BY amount_for_category DESC) AS ta ON ta.email = t.email ";
259
+ }
260
+ $rq_sql .= " GROUP BY t.email;";
261
+ if ($type_action == 'is_updated')
262
+ $rq_sql .= ' LIMIT 0, 1 ';
263
+ } else {
264
+ return;
265
+ }
266
+ if ($type_action == 'is_updated') {
267
+ $rq = $db_read->fetchAll ( $rq_sql );
268
+ return count ( $rq );
269
+ } else {
270
+ $rq = $db_read->query ( $rq_sql );
271
+ while ( $r = $rq->fetch () ) {
272
+ $line = "\r\n" . $this->dQuote ( $r ['email'] ) . ';'; // TEST
273
+ $line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
274
+ $orders_data = '';
275
+ if ($list_type == 'C') {
276
+ if ($add_customer_data) {
277
+ $line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
278
+ $line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
279
+ $line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'] . ';'. $r['category'];
280
+ $orders_data = $r ['amount_min_order'] . $r ['amount_max_order'];
281
+ $orders_data .= $r ['nb_orders'] . $r ['amount_all_orders'];
282
+ }
283
+ }
284
+ $line .= ';S';
285
+ echo $line;
286
+ }
287
+ }
288
+ }
289
+ private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
290
+ $resource = Mage::getSingleton ( 'core/resource' );
291
+ $db_read = $resource->getConnection ( 'core_read' );
292
+
293
+ $sd_updates = $resource->getTableName ( 'sd_updates' );
294
+
295
+ switch ($list_type) {
296
+ case 'N' :
297
+ case 'C' :
298
+ $rq_sql = 'SELECT email FROM ' . $sd_updates . ' WHERE list_type="' . $list_type . '" AND action = "U"';
299
+ if ($last_call_date != null && $last_call_date != '') {
300
+ $rq_sql .= ' AND update_time > "' . $last_call_date . '"';
301
+ }
302
+ break;
303
+ default :
304
+ return;
305
+ }
306
+ if ($type_action == 'is_updated') {
307
+ $rq = $db_read->fetchAll ( $rq_sql );
308
+ return count ( $rq );
309
+ } else {
310
+ $rq = $db_read->query ( $rq_sql );
311
+ while ( $r = $rq->fetch () ) {
312
+ $line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
313
+ if ($list_type == 'C') {
314
+ if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
315
+ $line .= ';;;;;';
316
+ }
317
+ }
318
+ $line .= ';U' . "\r\n";
319
+ echo $line;
320
+ }
321
+ }
322
+ }
323
  }
app/code/community/Sarbacane/Sarbacanedesktop/etc/config.xml CHANGED
@@ -1,148 +1,148 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/afl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * @category Sarbacane
17
- * @package Sarbacane_Sarbacanedesktop
18
- * @author Sarbacane Software <contact@sarbacane.com>
19
- * @copyright 2015 Sarbacane Software
20
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
- */
22
- -->
23
- <config>
24
- <modules>
25
- <Sarbacane_Sarbacanedesktop>
26
- <version>1.0.0.4</version>
27
- </Sarbacane_Sarbacanedesktop>
28
- </modules>
29
- <frontend>
30
- <routers>
31
- <sarbacanedesktop>
32
- <use>standard</use>
33
- <args>
34
- <module>Sarbacane_Sarbacanedesktop</module>
35
- <frontName>sarbacanedesktop</frontName>
36
- </args>
37
- </sarbacanedesktop>
38
- </routers>
39
- <!--
40
- <layout>
41
- <updates>
42
- <sarbacanedesktop>
43
- <file>sarbacanedesktop.xml</file>
44
- </sarbacanedesktop>
45
- </updates>
46
- </layout>
47
- -->
48
- </frontend>
49
- <admin>
50
- <routers>
51
- <adminhtml>
52
- <args>
53
- <modules>
54
- <sarbacanedesktop before="Mage_Adminhtml">Sarbacane_Sarbacanedesktop_Adminhtml</sarbacanedesktop>
55
- </modules>
56
- </args>
57
- </adminhtml>
58
- </routers>
59
- <!--
60
- <routers>
61
- <sarbacanedesktop>
62
- <use>admin</use>
63
- <args>
64
- <module>Sarbacane_Sarbacanedesktop</module>
65
- <frontName>sarbacanedesktop</frontName>
66
- </args>
67
- </sarbacanedesktop>
68
- </routers>
69
- -->
70
- </admin>
71
- <adminhtml>
72
- <menu>
73
- <newsletter>
74
- <children>
75
- <items module="sarbacanedesktop" translate="title">
76
- <title>Sarbacane Desktop</title>
77
- <sort_order>120</sort_order>
78
- <action>adminhtml/sarbacanedesktop</action>
79
- </items>
80
- </children>
81
- </newsletter>
82
- </menu>
83
- <acl>
84
- <resources>
85
- <admin>
86
- <children>
87
- <newsletter>
88
- <children>
89
- <sarbacanedesktop translate="title">
90
- <title>Sarbacane Desktop</title>
91
- <sort_order>120</sort_order>
92
- </sarbacanedesktop>
93
- </children>
94
- </newsletter>
95
- </children>
96
- </admin>
97
- </resources>
98
- </acl>
99
- <layout>
100
- <updates>
101
- <sarbacanedesktop>
102
- <file>sarbacanedesktop.xml</file>
103
- </sarbacanedesktop>
104
- </updates>
105
- </layout>
106
- <translate>
107
- <modules>
108
- <Sarbacane_Sarbacanedesktop>
109
- <files>
110
- <default>Sarbacane_Sarbacanedesktop.csv</default>
111
- </files>
112
- </Sarbacane_Sarbacanedesktop>
113
- </modules>
114
- </translate>
115
- </adminhtml>
116
- <global>
117
- <helpers>
118
- <sarbacanedesktop>
119
- <class>Sarbacane_Sarbacanedesktop_Helper</class>
120
- </sarbacanedesktop>
121
- </helpers>
122
- <blocks>
123
- <sarbacanedesktop>
124
- <class>Sarbacane_Sarbacanedesktop_Block</class>
125
- </sarbacanedesktop>
126
- </blocks>
127
- <resources>
128
- <sarbacanedesktop_setup>
129
- <setup>
130
- <module>Sarbacane_Sarbacanedesktop</module>
131
- </setup>
132
- <connection>
133
- <use>core_setup</use>
134
- </connection>
135
- </sarbacanedesktop_setup>
136
- <sarbacanedesktop_write>
137
- <connection>
138
- <use>core_write</use>
139
- </connection>
140
- </sarbacanedesktop_write>
141
- <sarbacanedesktop_read>
142
- <connection>
143
- <use>core_read</use>
144
- </connection>
145
- </sarbacanedesktop_read>
146
- </resources>
147
- </global>
148
  </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Sarbacane
17
+ * @package Sarbacane_Sarbacanedesktop
18
+ * @author Sarbacane Software <contact@sarbacane.com>
19
+ * @copyright 2015 Sarbacane Software
20
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Sarbacane_Sarbacanedesktop>
26
+ <version>1.0.0.6</version>
27
+ </Sarbacane_Sarbacanedesktop>
28
+ </modules>
29
+ <frontend>
30
+ <routers>
31
+ <sarbacanedesktop>
32
+ <use>standard</use>
33
+ <args>
34
+ <module>Sarbacane_Sarbacanedesktop</module>
35
+ <frontName>sarbacanedesktop</frontName>
36
+ </args>
37
+ </sarbacanedesktop>
38
+ </routers>
39
+ <!--
40
+ <layout>
41
+ <updates>
42
+ <sarbacanedesktop>
43
+ <file>sarbacanedesktop.xml</file>
44
+ </sarbacanedesktop>
45
+ </updates>
46
+ </layout>
47
+ -->
48
+ </frontend>
49
+ <admin>
50
+ <routers>
51
+ <adminhtml>
52
+ <args>
53
+ <modules>
54
+ <sarbacanedesktop before="Mage_Adminhtml">Sarbacane_Sarbacanedesktop_Adminhtml</sarbacanedesktop>
55
+ </modules>
56
+ </args>
57
+ </adminhtml>
58
+ </routers>
59
+ <!--
60
+ <routers>
61
+ <sarbacanedesktop>
62
+ <use>admin</use>
63
+ <args>
64
+ <module>Sarbacane_Sarbacanedesktop</module>
65
+ <frontName>sarbacanedesktop</frontName>
66
+ </args>
67
+ </sarbacanedesktop>
68
+ </routers>
69
+ -->
70
+ </admin>
71
+ <adminhtml>
72
+ <menu>
73
+ <newsletter>
74
+ <children>
75
+ <items module="sarbacanedesktop" translate="title">
76
+ <title>Sarbacane Desktop</title>
77
+ <sort_order>120</sort_order>
78
+ <action>adminhtml/sarbacanedesktop</action>
79
+ </items>
80
+ </children>
81
+ </newsletter>
82
+ </menu>
83
+ <acl>
84
+ <resources>
85
+ <admin>
86
+ <children>
87
+ <newsletter>
88
+ <children>
89
+ <sarbacanedesktop translate="title">
90
+ <title>Sarbacane Desktop</title>
91
+ <sort_order>120</sort_order>
92
+ </sarbacanedesktop>
93
+ </children>
94
+ </newsletter>
95
+ </children>
96
+ </admin>
97
+ </resources>
98
+ </acl>
99
+ <layout>
100
+ <updates>
101
+ <sarbacanedesktop>
102
+ <file>sarbacanedesktop.xml</file>
103
+ </sarbacanedesktop>
104
+ </updates>
105
+ </layout>
106
+ <translate>
107
+ <modules>
108
+ <Sarbacane_Sarbacanedesktop>
109
+ <files>
110
+ <default>Sarbacane_Sarbacanedesktop.csv</default>
111
+ </files>
112
+ </Sarbacane_Sarbacanedesktop>
113
+ </modules>
114
+ </translate>
115
+ </adminhtml>
116
+ <global>
117
+ <helpers>
118
+ <sarbacanedesktop>
119
+ <class>Sarbacane_Sarbacanedesktop_Helper</class>
120
+ </sarbacanedesktop>
121
+ </helpers>
122
+ <blocks>
123
+ <sarbacanedesktop>
124
+ <class>Sarbacane_Sarbacanedesktop_Block</class>
125
+ </sarbacanedesktop>
126
+ </blocks>
127
+ <resources>
128
+ <sarbacanedesktop_setup>
129
+ <setup>
130
+ <module>Sarbacane_Sarbacanedesktop</module>
131
+ </setup>
132
+ <connection>
133
+ <use>core_setup</use>
134
+ </connection>
135
+ </sarbacanedesktop_setup>
136
+ <sarbacanedesktop_write>
137
+ <connection>
138
+ <use>core_write</use>
139
+ </connection>
140
+ </sarbacanedesktop_write>
141
+ <sarbacanedesktop_read>
142
+ <connection>
143
+ <use>core_read</use>
144
+ </connection>
145
+ </sarbacanedesktop_read>
146
+ </resources>
147
+ </global>
148
  </config>
package.xml CHANGED
@@ -1,21 +1,68 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sarbacane_Sarbacanedesktop</name>
4
- <version>1.0.0.5</version>
5
  <stability>stable</stability>
6
- <license>AFL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Le module synchronise votre boutique Magento et le logiciel d'Emailing Sarbacane Desktop</summary>
10
- <description>Ce module vous permet de synchroniser vos donn&#xE9;es client entre Magento et Sarabcane Desktop.&#xD;
 
 
11
  &#xD;
12
- Ces donn&#xE9;es comprennent les inscrits &#xE0; la newsletter et les clients.&#xD;
13
- En plus des donn&#xE9;es client (email, nom, pr&#xE9;nom) vous avez &#xE9;galement la possibilit&#xE9; de synchroniser les donn&#xE9;es des commandes.</description>
14
- <notes>This release fixes some links and labels anomalies.</notes>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  <authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
16
- <date>2015-07-06</date>
17
- <time>07:22:12</time>
18
- <contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="96c46a692c69e8c13942d73509436af5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="14007d42c0a5042129ce40e504059058"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SarbacanedesktopController.php" hash="afa6695d1dbd72a0cfca2f9423a52080"/></dir><file name="IndexController.php" hash="8b9016106ffd95d64e2cc5b82579e7eb"/></dir><dir name="etc"><file name="config.xml" hash="237f59c4b1a761f81402c2cf0c263c28"/></dir><dir name="sql"><dir name="sarbacanedesktop_setup"><file name="mysql4-install-1.0.0.0.php" hash="82834af7ce95c1bd9d3063ffdf3a11f5"/><file name="mysql4-upgrade-1.0.0.0-1.0.0.1.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.1-1.0.0.2.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.2-1.0.0.3.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.3-1.0.0.4.php" hash="a2a43fe29d015f53eae5479f2d5fcb3d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.css" hash="6fcee54bdab10db72a361ec5a139cc7c"/></dir></dir><dir name="js"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.js" hash="d38d9ec858dfdce14e0156acc87c1c50"/></dir></dir><dir name="images"><file name="sd.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sarbacanedesktop"><file name="sarbacanedesktop.phtml" hash="c402cc70b2bc30f8c22d4d7abf54889c"/></dir></dir><dir name="layout"><file name="sarbacanedesktop.xml" hash="4ec1fc007e23a1eb2d96c719f1e7c128"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sarbacane_Sarbacanedesktop.xml" hash="a922981e127e22e989a09b8c33be6f85"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sarbacane_Sarbacanedesktop.csv" hash="dc86c83c4fc641e7d4f9c648d36aa415"/></dir><dir name="en_US"><file name="Sarbacane_Sarbacanedesktop.csv" hash="fdcdf13b7d458e846ee673a60b9beab4"/></dir></target></contents>
19
  <compatible/>
20
- <dependencies><required><php><min>5.0.0</min><max>5.6.9</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Sarbacane_Sarbacanedesktop</name>
4
+ <version>1.0.0.6</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/academic.php">AFL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary> The extension synchronizes your e-shop Magento and the emailing solution software Sarbacane Desktop </summary>
10
+ <description>&lt;i&gt;With Sarbacane Desktop, easily create and send stunning newsletters to inform your community and increase customer loyalty.&lt;/i&gt;&#xD;
11
+ &lt;br /&gt;&#xD;
12
+ &lt;h2&gt;Merchant Benefits&lt;/h2&gt;&#xD;
13
  &#xD;
14
+ &lt;p&gt;&lt;b&gt;Easy : &lt;/b&gt;Simply create beautiful responsive newsletters thanks to the EmailBuilder&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ &lt;p&gt;&lt;b&gt;Optimal deliverability : &lt;/b&gt;Your customers really receive your emails&lt;/p&gt;&#xD;
17
+ &#xD;
18
+ &lt;p&gt;&lt;b&gt;Advanced Features : &lt;/b&gt;Targeting, segmentation, Split test...&lt;/p&gt;&#xD;
19
+ &#xD;
20
+ &lt;p&gt;&lt;b&gt;Support : &lt;/b&gt;Technical support available to help you and many online resources: videos, tutorials, guides, tips, etc.&lt;/p&gt;&#xD;
21
+ &#xD;
22
+ &lt;h2&gt;Features&lt;/h2&gt;&#xD;
23
+ &#xD;
24
+ &lt;p&gt;Sarbacane Desktop is a complete solution for emailing, &lt;b&gt;affordable for begginners and complete for experts.&lt;/b&gt;&lt;/p&gt;&#xD;
25
+ &#xD;
26
+ &lt;ul&gt;&#xD;
27
+ &lt;li&gt;Store data synchronized in real time, no need to export manually&lt;/li&gt;&#xD;
28
+ &lt;li&gt;Hundreds of free responsive templates to use and customize in the new EmailBuilder. &lt;b&gt;You create your email in a few clicks ! &lt;/b&gt;&lt;/li&gt;&#xD;
29
+ &lt;li&gt;Deliverability optimized through our routing platform known to all Internet service providers and Webmails.&lt;/li&gt;&#xD;
30
+ &lt;li&gt;A / B testing, programmable emailing, 1-click preview in more than 20 email clients.&lt;/li&gt;&#xD;
31
+ &lt;li&gt;Every element of your message is customizable with the data of your contact database: name, address, city, etc.&lt;/li&gt;&#xD;
32
+ &lt;li&gt;Ability to target contacts according to their orders data for more effective campaigns&lt;/li&gt;&#xD;
33
+ &lt;li&gt;Detailed statistics, geolocation, detection of openings, opening time, clicks, type of messaging, churn, incorrect addresses, etc.&lt;/li&gt;&#xD;
34
+ &lt;/ul&gt;&#xD;
35
+ &lt;hr /&gt;&#xD;
36
+ &lt;i&gt;Avec Sarbacane Desktop, cr&#xE9;ez et envoyez simplement de superbes newsletters pour informer et fid&#xE9;liser vos clients.&lt;/i&gt;&#xD;
37
+ &lt;br /&gt;&#xD;
38
+ &lt;h2&gt;Les &amp;quot;+&amp;quot; pour vous&lt;/h2&gt;&#xD;
39
+ &#xD;
40
+ &lt;p&gt;&lt;b&gt;Simplicit&#xE9; : &lt;/b&gt;Cr&#xE9;ez simplement de superbes newsletters responsive gr&#xE2;ce &#xE0; l'EmailBuilder.&lt;/p&gt;&#xD;
41
+ &#xD;
42
+ &lt;p&gt;&lt;b&gt;D&#xE9;livrabilit&#xE9; optimale : &lt;/b&gt;Vos clients re&#xE7;oivent vraiment vos emails.&lt;/p&gt;&#xD;
43
+ &#xD;
44
+ &lt;p&gt;&lt;b&gt;Fonctionnalit&#xE9;s avanc&#xE9;es : &lt;/b&gt;ciblage, segmentation, Split test etc.&lt;/p&gt;&#xD;
45
+ &#xD;
46
+ &lt;p&gt;&lt;b&gt;Accompagnement : &lt;/b&gt;Un support technique &#xE0; votre &#xE9;coute et de nombreuses ressources en ligne : vid&#xE9;os, tutoriels, guides, conseils ...&lt;/p&gt;&#xD;
47
+ &#xD;
48
+ &lt;h2&gt;Fonctionnalit&#xE9;s&lt;/h2&gt;&#xD;
49
+ &#xD;
50
+ &lt;p&gt;Sarbacane Desktop est une solution compl&#xE8;te pour l'emailing, &lt;b&gt;abordable pour les d&#xE9;butants et compl&#xE8;te pour les experts.&lt;/b&gt;&lt;/p&gt;&#xD;
51
+ &#xD;
52
+ &lt;ul&gt;&#xD;
53
+ &lt;li&gt;Donn&#xE9;es de boutique synchronis&#xE9;es en temps r&#xE9;el, pas besoin d'exporter manuellement.&lt;/li&gt;&#xD;
54
+ &lt;li&gt;Des centaines de mod&#xE8;les responsives gratuits &#xE0; utiliser et personnaliser dans l'EmailBuilder nouvelle g&#xE9;n&#xE9;ration. &lt;b&gt;Vous cr&#xE9;ez votre email en quelques clics ! &lt;/b&gt;&lt;/li&gt;&#xD;
55
+ &lt;li&gt;D&#xE9;livrabilit&#xE9; optimis&#xE9;e gr&#xE2;ce &#xE0; notre plateforme de routage reconnue aupr&#xE8;s de l'ensemble des fournisseurs d'acc&#xE8;s Internet et grands webmails.&lt;/li&gt;&#xD;
56
+ &lt;li&gt;Tests A/B, envois programmables, pr&#xE9;visualisation dans plus de 20 messageries en 1 clic.&lt;/li&gt;&#xD;
57
+ &lt;li&gt;Chaque &#xE9;l&#xE9;ment de votre message est personnalisable avec les donn&#xE9;es pr&#xE9;sentes dans votre base de contacts : pr&#xE9;nom, nom, ville, ...&lt;/li&gt;&#xD;
58
+ &lt;li&gt;Possibilit&#xE9; de cibler et exploiter les contacts en fonction de leurs donn&#xE9;es de commandes pour des campagnes plus efficaces&lt;/li&gt;&#xD;
59
+ &lt;li&gt;Statistiques d&#xE9;taill&#xE9;es, g&#xE9;olocalisation, d&#xE9;tection des ouvertures, temps d'ouvertures, clics, type de messageries, d&#xE9;sabonnements, adresses erronn&#xE9;es, etc.&lt;/li&gt;&#xD;
60
+ &lt;/ul&gt;</description>
61
+ <notes>We removed the limitation on customer synchronization.</notes>
62
  <authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
63
+ <date>2015-10-21</date>
64
+ <time>15:55:48</time>
65
+ <contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="96c46a692c69e8c13942d73509436af5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f3ea000b4a07fdf9e5eea9ef0b48f21a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SarbacanedesktopController.php" hash="a8b2442a589cb30411eed7e47a743563"/></dir><file name="IndexController.php" hash="12bd5fcaf683eb993640d5f6d5dfeac4"/></dir><dir name="etc"><file name="config.xml" hash="abd16e5a830dc04a63a06fd7a18d3e4b"/></dir><dir name="sql"><dir name="sarbacanedesktop_setup"><file name="mysql4-install-1.0.0.0.php" hash="82834af7ce95c1bd9d3063ffdf3a11f5"/><file name="mysql4-upgrade-1.0.0.0-1.0.0.1.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.1-1.0.0.2.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.2-1.0.0.3.php" hash="35660ae27bb6ef74c885ad86284f9071"/><file name="mysql4-upgrade-1.0.0.3-1.0.0.4.php" hash="a2a43fe29d015f53eae5479f2d5fcb3d"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.css" hash="6fcee54bdab10db72a361ec5a139cc7c"/></dir></dir><dir name="images"><file name="sd.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir><dir name="js"><dir name="Sarbacane_SarbacaneDesktop"><file name="sarbacanedesktop.js" hash="d38d9ec858dfdce14e0156acc87c1c50"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sarbacanedesktop.xml" hash="4ec1fc007e23a1eb2d96c719f1e7c128"/></dir><dir name="template"><dir name="sarbacanedesktop"><file name="sarbacanedesktop.phtml" hash="c402cc70b2bc30f8c22d4d7abf54889c"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Sarbacane_Sarbacanedesktop.xml" hash="a922981e127e22e989a09b8c33be6f85"/></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sarbacane_Sarbacanedesktop.csv" hash="dc86c83c4fc641e7d4f9c648d36aa415"/></dir><dir name="en_US"><file name="Sarbacane_Sarbacanedesktop.csv" hash="fdcdf13b7d458e846ee673a60b9beab4"/></dir></target></contents>
66
  <compatible/>
67
+ <dependencies><required><php><min>5.0.0</min><max>5.6.14</max></php></required></dependencies>
68
  </package>