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 +5 -2
- app/code/community/Sarbacane/Sarbacanedesktop/controllers/Adminhtml/SarbacanedesktopController.php +1 -3
- app/code/community/Sarbacane/Sarbacanedesktop/controllers/IndexController.php +319 -302
- app/code/community/Sarbacane/Sarbacanedesktop/etc/config.xml +147 -147
- package.xml +58 -11
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($
|
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 `
|
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 |
-
|
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è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.
|
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 |
-
$
|
185 |
-
$
|
186 |
-
$
|
187 |
-
$
|
188 |
-
$
|
189 |
-
$
|
190 |
-
|
191 |
-
|
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 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
LEFT JOIN ' . $customer_entity_varchar . ' AS `
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
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 . "'
|
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 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
$
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
$
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
$line .= ';
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
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è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.
|
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 |
<stability>stable</stability>
|
6 |
-
<license>AFL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description
|
|
|
|
|
11 |

|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
<authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
|
16 |
-
<date>2015-
|
17 |
-
<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="
|
19 |
<compatible/>
|
20 |
-
<dependencies><required><php><min>5.0.0</min><max>5.6.
|
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><i>With Sarbacane Desktop, easily create and send stunning newsletters to inform your community and increase customer loyalty.</i>
|
11 |
+
<br />
|
12 |
+
<h2>Merchant Benefits</h2>
|
13 |

|
14 |
+
<p><b>Easy : </b>Simply create beautiful responsive newsletters thanks to the EmailBuilder</p>
|
15 |
+

|
16 |
+
<p><b>Optimal deliverability : </b>Your customers really receive your emails</p>
|
17 |
+

|
18 |
+
<p><b>Advanced Features : </b>Targeting, segmentation, Split test...</p>
|
19 |
+

|
20 |
+
<p><b>Support : </b>Technical support available to help you and many online resources: videos, tutorials, guides, tips, etc.</p>
|
21 |
+

|
22 |
+
<h2>Features</h2>
|
23 |
+

|
24 |
+
<p>Sarbacane Desktop is a complete solution for emailing, <b>affordable for begginners and complete for experts.</b></p>
|
25 |
+

|
26 |
+
<ul>
|
27 |
+
<li>Store data synchronized in real time, no need to export manually</li>
|
28 |
+
<li>Hundreds of free responsive templates to use and customize in the new EmailBuilder. <b>You create your email in a few clicks ! </b></li>
|
29 |
+
<li>Deliverability optimized through our routing platform known to all Internet service providers and Webmails.</li>
|
30 |
+
<li>A / B testing, programmable emailing, 1-click preview in more than 20 email clients.</li>
|
31 |
+
<li>Every element of your message is customizable with the data of your contact database: name, address, city, etc.</li>
|
32 |
+
<li>Ability to target contacts according to their orders data for more effective campaigns</li>
|
33 |
+
<li>Detailed statistics, geolocation, detection of openings, opening time, clicks, type of messaging, churn, incorrect addresses, etc.</li>
|
34 |
+
</ul>
|
35 |
+
<hr />
|
36 |
+
<i>Avec Sarbacane Desktop, créez et envoyez simplement de superbes newsletters pour informer et fidéliser vos clients.</i>
|
37 |
+
<br />
|
38 |
+
<h2>Les &quot;+&quot; pour vous</h2>
|
39 |
+

|
40 |
+
<p><b>Simplicité : </b>Créez simplement de superbes newsletters responsive grâce à l'EmailBuilder.</p>
|
41 |
+

|
42 |
+
<p><b>Délivrabilité optimale : </b>Vos clients reçoivent vraiment vos emails.</p>
|
43 |
+

|
44 |
+
<p><b>Fonctionnalités avancées : </b>ciblage, segmentation, Split test etc.</p>
|
45 |
+

|
46 |
+
<p><b>Accompagnement : </b>Un support technique à votre écoute et de nombreuses ressources en ligne : vidéos, tutoriels, guides, conseils ...</p>
|
47 |
+

|
48 |
+
<h2>Fonctionnalités</h2>
|
49 |
+

|
50 |
+
<p>Sarbacane Desktop est une solution complète pour l'emailing, <b>abordable pour les débutants et complète pour les experts.</b></p>
|
51 |
+

|
52 |
+
<ul>
|
53 |
+
<li>Données de boutique synchronisées en temps réel, pas besoin d'exporter manuellement.</li>
|
54 |
+
<li>Des centaines de modèles responsives gratuits à utiliser et personnaliser dans l'EmailBuilder nouvelle génération. <b>Vous créez votre email en quelques clics ! </b></li>
|
55 |
+
<li>Délivrabilité optimisée grâce à notre plateforme de routage reconnue auprès de l'ensemble des fournisseurs d'accès Internet et grands webmails.</li>
|
56 |
+
<li>Tests A/B, envois programmables, prévisualisation dans plus de 20 messageries en 1 clic.</li>
|
57 |
+
<li>Chaque élément de votre message est personnalisable avec les données présentes dans votre base de contacts : prénom, nom, ville, ...</li>
|
58 |
+
<li>Possibilité de cibler et exploiter les contacts en fonction de leurs données de commandes pour des campagnes plus efficaces</li>
|
59 |
+
<li>Statistiques détaillées, géolocalisation, détection des ouvertures, temps d'ouvertures, clics, type de messageries, désabonnements, adresses erronnées, etc.</li>
|
60 |
+
</ul></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>
|