Version Notes
This release hugely improves the plugin behavior. No more useless data are stored.
Download this release
Release Info
Developer | Sarbacane Software |
Extension | Sarbacane_Mailify |
Version | 1.0.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.2 to 1.0.0.4
- app/code/community/Sarbacane/Mailify/Helper/Data.php +4 -32
- app/code/community/Sarbacane/Mailify/controllers/Adminhtml/MailifyController.php +1 -7
- app/code/community/Sarbacane/Mailify/controllers/IndexController.php +300 -358
- app/code/community/Sarbacane/Mailify/etc/config.xml +1 -1
- app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.0-1.0.0.1.php +25 -0
- app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.1-1.0.0.2.php +25 -0
- app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.2-1.0.0.3.php +25 -0
- app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.3-1.0.0.4.php +87 -0
- app/locale/en_US/Sarbacane_Mailify.csv +3 -3
- app/locale/es_ES/Sarbacane_Mailify.csv +3 -3
- package.xml +5 -5
app/code/community/Sarbacane/Mailify/Helper/Data.php
CHANGED
@@ -72,15 +72,11 @@ class Sarbacane_Mailify_Helper_Data extends Mage_Core_Helper_Abstract
|
|
72 |
{
|
73 |
$resource = Mage::getSingleton('core/resource');
|
74 |
$db_write = $resource->getConnection('core_write');
|
75 |
-
$sarbacanedesktop = $resource->getTableName('
|
76 |
$rq_sql = '
|
77 |
DELETE FROM `' . $sarbacanedesktop . '`
|
78 |
-
WHERE `
|
79 |
-
AND `
|
80 |
-
if ($sd_id != '') {
|
81 |
-
$rq_sql .= '
|
82 |
-
AND `sd_id` = ' . $db_write->quote($sd_id);
|
83 |
-
}
|
84 |
$db_write->query($rq_sql);
|
85 |
}
|
86 |
|
@@ -139,37 +135,13 @@ class Sarbacane_Mailify_Helper_Data extends Mage_Core_Helper_Abstract
|
|
139 |
}
|
140 |
}
|
141 |
|
142 |
-
public function setConfiguration($field, $value)
|
143 |
-
{
|
144 |
-
$sql_field = '';
|
145 |
-
if ($field == 'identifier') {
|
146 |
-
$sql_field = 'lastname';
|
147 |
-
} else if ($field == 'sd_list') {
|
148 |
-
$sql_field = 'firstname';
|
149 |
-
} else if ($field == 'sd_token') {
|
150 |
-
$sql_field = 'orders_data';
|
151 |
-
}
|
152 |
-
if ($sql_field != '') {
|
153 |
-
$resource = Mage::getSingleton('core/resource');
|
154 |
-
$db_write = $resource->getConnection('core_write');
|
155 |
-
$sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
|
156 |
-
$rq_sql = '
|
157 |
-
UPDATE `' . $sarbacanedesktop . '`
|
158 |
-
SET `' . $sql_field . '` = ' . $db_write->quote($value) . '
|
159 |
-
WHERE `email` = \'-\'
|
160 |
-
AND `store_id` = \'-\'
|
161 |
-
AND `list_type` = \'-\'';
|
162 |
-
$db_write->query($rq_sql);
|
163 |
-
}
|
164 |
-
}
|
165 |
|
166 |
public function deleteSdid($sd_id){
|
167 |
$resource = Mage::getSingleton('core/resource');
|
168 |
$db_write = $resource->getConnection('core_write');
|
169 |
-
$sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
|
170 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
171 |
|
172 |
-
$rq_sql = 'DELETE FROM
|
173 |
$db_write->query($rq_sql);
|
174 |
}
|
175 |
|
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 |
|
135 |
}
|
136 |
}
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
public function deleteSdid($sd_id){
|
140 |
$resource = Mage::getSingleton('core/resource');
|
141 |
$db_write = $resource->getConnection('core_write');
|
|
|
142 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
143 |
|
144 |
+
$rq_sql = 'DELETE FROM '.$sarbacanedesktop_users.' WHERE sd_value ="'.$sd_id.' AND sd_type="sd_id"';
|
145 |
$db_write->query($rq_sql);
|
146 |
}
|
147 |
|
app/code/community/Sarbacane/Mailify/controllers/Adminhtml/MailifyController.php
CHANGED
@@ -47,7 +47,7 @@ class Sarbacane_Mailify_Adminhtml_MailifyController extends Mage_Adminhtml_Contr
|
|
47 |
if(Mage::app()->getRequest()->getParam("sd_is_user")){
|
48 |
Mage::getSingleton("core/session")->setData("sd_is_user",Mage::app()->getRequest()->getParam("sd_is_user"));
|
49 |
}
|
50 |
-
$this->_title($this->__('
|
51 |
$this->_setActiveMenu('newsletter');
|
52 |
$this->renderLayout();
|
53 |
}
|
@@ -68,7 +68,6 @@ class Sarbacane_Mailify_Adminhtml_MailifyController extends Mage_Adminhtml_Contr
|
|
68 |
}
|
69 |
}
|
70 |
$old_sd_list_array = Mage::helper('mailify')->getListConfiguration('array');
|
71 |
-
Mage::helper('mailify')->setConfiguration('sd_list', $shops);
|
72 |
$rq_sql = '
|
73 |
UPDATE `' . $sarbacanedesktop_users . '`
|
74 |
SET `sd_value` = ' . $db_write->quote($shops) . '
|
@@ -88,9 +87,7 @@ class Sarbacane_Mailify_Adminhtml_MailifyController extends Mage_Adminhtml_Contr
|
|
88 |
private function createTokenParameterConfiguration(){
|
89 |
$resource = Mage::getSingleton('core/resource');
|
90 |
$db_write = $resource->getConnection('core_write');
|
91 |
-
$sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
|
92 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
93 |
-
$rq_sql = 'TRUNCATE `' . $sarbacanedesktop . '`';
|
94 |
$rq_sql = 'TRUNCATE `' . $sarbacanedesktop_users . '`';
|
95 |
$db_write->query($rq_sql);
|
96 |
$token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
|
@@ -102,10 +99,7 @@ class Sarbacane_Mailify_Adminhtml_MailifyController extends Mage_Adminhtml_Contr
|
|
102 |
{
|
103 |
$resource = Mage::getSingleton('core/resource');
|
104 |
$db_write = $resource->getConnection('core_write');
|
105 |
-
$sarbacanedesktop = $resource->getTableName('sarbacanedesktop');
|
106 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
107 |
-
$rq_sql = 'TRUNCATE `' . $sarbacanedesktop . '`';
|
108 |
-
$db_write->query($rq_sql);
|
109 |
$token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
|
110 |
$rq_sql = '
|
111 |
UPDATE `' . $sarbacanedesktop_users . '`
|
47 |
if(Mage::app()->getRequest()->getParam("sd_is_user")){
|
48 |
Mage::getSingleton("core/session")->setData("sd_is_user",Mage::app()->getRequest()->getParam("sd_is_user"));
|
49 |
}
|
50 |
+
$this->_title($this->__('Mailify'));
|
51 |
$this->_setActiveMenu('newsletter');
|
52 |
$this->renderLayout();
|
53 |
}
|
68 |
}
|
69 |
}
|
70 |
$old_sd_list_array = Mage::helper('mailify')->getListConfiguration('array');
|
|
|
71 |
$rq_sql = '
|
72 |
UPDATE `' . $sarbacanedesktop_users . '`
|
73 |
SET `sd_value` = ' . $db_write->quote($shops) . '
|
87 |
private function createTokenParameterConfiguration(){
|
88 |
$resource = Mage::getSingleton('core/resource');
|
89 |
$db_write = $resource->getConnection('core_write');
|
|
|
90 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
|
|
91 |
$rq_sql = 'TRUNCATE `' . $sarbacanedesktop_users . '`';
|
92 |
$db_write->query($rq_sql);
|
93 |
$token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
|
99 |
{
|
100 |
$resource = Mage::getSingleton('core/resource');
|
101 |
$db_write = $resource->getConnection('core_write');
|
|
|
102 |
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
|
|
|
|
103 |
$token_parameter = rand(100000, 999999) . Mage::getModel('core/date')->timestamp(time());
|
104 |
$rq_sql = '
|
105 |
UPDATE `' . $sarbacanedesktop_users . '`
|
app/code/community/Sarbacane/Mailify/controllers/IndexController.php
CHANGED
@@ -1,361 +1,303 @@
|
|
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_Mailify
|
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_Mailify_IndexController extends Mage_Core_Controller_Front_Action {
|
22 |
-
private function
|
23 |
-
$resource = Mage::getSingleton ( 'core/resource' );
|
24 |
-
$
|
25 |
-
$sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
|
26 |
-
$rq_sql = '
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
$rq = $
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$
|
116 |
-
|
117 |
-
$sd_list_array
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
$store_list
|
130 |
-
$store_list .= $this->
|
131 |
-
$store_list .= '
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
$
|
140 |
-
$
|
141 |
-
$
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
AND `
|
147 |
-
$nb_in_table = $db_read->fetchOne ( $rq_sql );
|
148 |
-
if ($nb_in_table == 0)
|
149 |
-
return 'Y';
|
150 |
-
return 'N';
|
151 |
-
}
|
152 |
-
private function listIsUpdated($store_id, $list_type, $sd_id) {
|
153 |
-
$
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
$
|
176 |
-
$
|
177 |
-
$
|
178 |
-
$
|
179 |
-
$
|
180 |
-
$
|
181 |
-
$
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
UNION
|
214 |
-
SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname
|
|
|
|
|
|
|
|
|
215 |
FROM $sales_flat_order sfo
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
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 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
$
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
`orders_data` = VALUES(`orders_data`)';
|
287 |
-
$db_write->query ( $rq_sql );
|
288 |
-
}
|
289 |
-
}
|
290 |
-
}
|
291 |
-
private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display') {
|
292 |
-
$resource = Mage::getSingleton ( 'core/resource' );
|
293 |
-
$db_read = $resource->getConnection ( 'core_read' );
|
294 |
-
$db_write = $resource->getConnection ( 'core_write' );
|
295 |
-
$sarbacanedesktop = $resource->getTableName ( 'sarbacanedesktop' );
|
296 |
-
$newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
|
297 |
-
$customer_entity = $resource->getTableName ( 'customer_entity' );
|
298 |
-
|
299 |
-
$rq_sql_limit = '2500';
|
300 |
-
if ($type_action == 'is_updated')
|
301 |
-
$rq_sql_limit = '1';
|
302 |
-
if ($list_type == 'N') {
|
303 |
-
$rq_sql = '
|
304 |
-
SELECT s.`email`, s.`store_id`
|
305 |
-
FROM `' . $sarbacanedesktop . '` AS s
|
306 |
-
LEFT JOIN `' . $newsletter_subscriber . '` AS ns ON (ns.`subscriber_email` = s.`email` AND ns.`store_id` = s.`store_id` AND ns.`subscriber_status` = 1)
|
307 |
-
WHERE s.`list_type` = \'N\' AND s.`store_id` = ' . $db_write->quote ( $store_id ) . ' AND s.`sd_id` = ' . $db_write->quote ( $sd_id ) . ' AND ns.`store_id` IS NULL';
|
308 |
-
} else if ($list_type == 'C') {
|
309 |
-
// REVOIR REQUETE
|
310 |
-
$rq_sql = "SELECT * FROM " . $sarbacanedesktop . " WHERE 1=2";
|
311 |
-
// $rq_sql = '
|
312 |
-
// SELECT s.email, s.store_id FROM `' . $sarbacanedesktop . '` AS `s` LEFT JOIN ' . $customer_entity . ' AS c ON s.email = c.email WHERE c.is_active = 0';
|
313 |
-
} else {
|
314 |
-
return;
|
315 |
-
}
|
316 |
-
if ($type_action == 'is_updated') {
|
317 |
-
$rq = $db_read->fetchAll ( $rq_sql );
|
318 |
-
return count ( $rq );
|
319 |
-
} else {
|
320 |
-
$rq = $db_read->query ( $rq_sql );
|
321 |
-
$rq_sql_delete = '';
|
322 |
-
$i = 0;
|
323 |
-
while ( $r = $rq->fetch () ) {
|
324 |
-
$line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
|
325 |
-
if ($list_type == 'C') {
|
326 |
-
if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
|
327 |
-
$line .= ';;;;;';
|
328 |
-
}
|
329 |
-
}
|
330 |
-
$line .= ';U' . "\r\n";
|
331 |
-
echo $line;
|
332 |
-
$rq_sql_delete .= '(' . $db_write->quote ( $r ['email'] ) . '),';
|
333 |
-
if ($i == 200) {
|
334 |
-
$rq_sql_delete = substr ( $rq_sql_delete, 0, - 1 );
|
335 |
-
$rq_sql = '
|
336 |
-
DELETE FROM `' . $sarbacanedesktop . '`
|
337 |
-
WHERE (`email`)
|
338 |
-
IN (' . $rq_sql_delete . ')
|
339 |
-
AND `list_type` = ' . $db_write->quote ( $list_type ) . '
|
340 |
-
AND `store_id` = ' . $db_write->quote ( $store_id ) . '
|
341 |
-
AND `sd_id` = ' . $db_write->quote ( $sd_id );
|
342 |
-
$db_write->query ( $rq_sql );
|
343 |
-
$rq_sql_delete = '';
|
344 |
-
$i = 0;
|
345 |
-
}
|
346 |
-
$i ++;
|
347 |
-
}
|
348 |
-
if ($rq_sql_delete != '') {
|
349 |
-
$rq_sql_delete = substr ( $rq_sql_delete, 0, - 1 );
|
350 |
-
$rq_sql = '
|
351 |
-
DELETE FROM `' . $sarbacanedesktop . '`
|
352 |
-
WHERE (`email`)
|
353 |
-
IN (' . $rq_sql_delete . ')
|
354 |
-
AND `list_type` = ' . $db_write->quote ( $list_type ) . '
|
355 |
-
AND `store_id` = ' . $db_write->quote ( $store_id ) . '
|
356 |
-
AND `sd_id` = ' . $db_write->quote ( $sd_id );
|
357 |
-
$db_write->query ( $rq_sql );
|
358 |
-
}
|
359 |
-
}
|
360 |
-
}
|
361 |
}
|
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_Mailify
|
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_Mailify_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 |
+
$rq_sql = 'DELETE FROM `' . $sarbacanedesktop_users . '` WHERE sd_type=\'sd_id\' AND sd_value=\'' . $sdid . '\' AND list_id=\'' . $list . '\'';
|
27 |
+
$rq = $db_write->query ( $rq_sql );
|
28 |
+
$rq_sql = '
|
29 |
+
INSERT INTO `' . $sarbacanedesktop_users . '` (`sd_type`, `sd_value`, `list_id`, `last_call_date` ) VALUES
|
30 |
+
(\'sd_id\', ' . $db_write->quote ( $sdid ) . ', \'' . $list . '\', \'' . date ( 'Y-m-d H:i:s' ) . '\')';
|
31 |
+
$rq = $db_write->query ( $rq_sql );
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
public function indexAction() {
|
35 |
+
if (Mage::app ()->getRequest ()->getParam ( 'stk' ) && Mage::app ()->getRequest ()->getParam ( 'sdid' )) {
|
36 |
+
$sdid = Mage::app ()->getRequest ()->getParam ( 'sdid' );
|
37 |
+
if (Mage::app ()->getRequest ()->getParam ( 'stk' ) == Mage::helper ( 'mailify' )->getToken () && $sdid != '') {
|
38 |
+
$identifier = Mage::helper ( 'mailify' )->getConfiguration ( 'identifier' );
|
39 |
+
$sd_id = "";
|
40 |
+
$configuration = Mage::helper ( 'mailify' )->getConfiguration ( 'all' );
|
41 |
+
if ($configuration ['sd_token'] != '' && $configuration ['sd_list'] != '') {
|
42 |
+
$sd_list_array = Mage::helper ( 'mailify' )->getListConfiguration ( 'array' );
|
43 |
+
if ($sd_list_array != '') {
|
44 |
+
if (Mage::app ()->getRequest ()->getParam ( 'list' )) {
|
45 |
+
$list = Mage::app ()->getRequest ()->getParam ( 'list' );
|
46 |
+
$store_id = Mage::helper ( 'mailify' )->getStoreidFromList ( $list );
|
47 |
+
$list_type = Mage::helper ( 'mailify' )->getListTypeFromList ( $list );
|
48 |
+
$list_type_array = Mage::helper ( 'mailify' )->getListTypeArray ();
|
49 |
+
if (in_array ( $list_type, $list_type_array )) {
|
50 |
+
$id_and_list = $store_id . $list_type;
|
51 |
+
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 )))) {
|
52 |
+
$this->processNewUnsubcribersAndSubscribers ( $list_type, $store_id, $sdid );
|
53 |
+
$sd_id = $this->saveSdid ( $sdid, $list );
|
54 |
+
}else{
|
55 |
+
header ( 'HTTP/1.1 404 Not found' );
|
56 |
+
header ( "Content-type: application/json ; charset=utf-8" );
|
57 |
+
die ( 'FAILED_ID' );
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
header ( 'HTTP/1.1 404 Not found' );
|
61 |
+
header ( "Content-type: application/json ; charset=utf-8" );
|
62 |
+
die ( 'FAILED_ID' );
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
if ('delete' == Mage::app ()->getRequest ()->getParam ( 'action' )) {
|
66 |
+
Mage::helper ( 'mailify' )->deleteSdid ( $sd_id );
|
67 |
+
} else {
|
68 |
+
$this->getFormattedContentShops ( $sdid, $last_call_date );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
} else {
|
74 |
+
header ( "HTTP/1.1 403 Unauthorized" );
|
75 |
+
header ( "Content-type: application/json; charset=utf-8" );
|
76 |
+
die ( 'FAILED_SDTOKEN' );
|
77 |
+
}
|
78 |
+
} else {
|
79 |
+
echo "Paramètre[s] manquant[s]";
|
80 |
+
}
|
81 |
+
}
|
82 |
+
private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id) {
|
83 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
84 |
+
$db_read = $resource->getConnection ( 'core_read' );
|
85 |
+
$sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
|
86 |
+
$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 . '\'';
|
87 |
+
$last_call_date = $db_read->fetchOne ( $rq_sql );
|
88 |
+
$line = 'email;lastname;firstname';
|
89 |
+
if ($list_type == 'C') {
|
90 |
+
if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
|
91 |
+
$line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders';
|
92 |
+
}
|
93 |
+
}
|
94 |
+
$line .= ';action';
|
95 |
+
echo $line;
|
96 |
+
$this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
|
97 |
+
$this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'display', $last_call_date );
|
98 |
+
}
|
99 |
+
private function getListTypeArray() {
|
100 |
+
return array (
|
101 |
+
'N',
|
102 |
+
'C'
|
103 |
+
);
|
104 |
+
}
|
105 |
+
private function checkIfListWithCustomerData($list_type, $store_id) {
|
106 |
+
$sd_list_array = Mage::helper ( 'mailify' )->getListConfiguration ( 'array' );
|
107 |
+
if (in_array ( $store_id . $list_type . '1', $sd_list_array )) {
|
108 |
+
return true;
|
109 |
+
}
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
private function getFormattedContentShops($sd_id) {
|
113 |
+
$stores = Mage::helper ( 'mailify' )->getStoresArray ();
|
114 |
+
echo 'list_id;name;reset;is_updated;type;version' . "\n";
|
115 |
+
$sd_list_array = Mage::helper ( 'mailify' )->getListConfiguration ( 'array' );
|
116 |
+
$list_array = array ();
|
117 |
+
foreach ( $sd_list_array as $list ) {
|
118 |
+
$store_id = Mage::helper ( 'mailify' )->getStoreidFromList ( $list );
|
119 |
+
$list_type = Mage::helper ( 'mailify' )->getListTypeFromList ( $list );
|
120 |
+
array_push ( $list_array, array (
|
121 |
+
'store_id' => $store_id,
|
122 |
+
'list_type' => $list_type,
|
123 |
+
'list_id' => $list
|
124 |
+
) );
|
125 |
+
}
|
126 |
+
foreach ( $stores as $store ) {
|
127 |
+
foreach ( $list_array as $list ) {
|
128 |
+
if ($store ['store_id'] == $list ['store_id']) {
|
129 |
+
$store_list = "" . $store ['store_id'] . $list ['list_type'] . ';' . $this->dQuote ( $store ['store_name'] ) . ';'; // TEST
|
130 |
+
$store_list .= $this->listIsResetted ( $store ['store_id'] . $list ['list_type'], $sd_id ) . ';';
|
131 |
+
$store_list .= $this->listIsUpdated ( $store ['store_id'], $list ['list_type'], $sd_id ) . ';';
|
132 |
+
$store_list .= 'Magento;1.0.0.4' . "\n";
|
133 |
+
echo $store_list;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
private function listIsResetted($list_id, $sd_id) {
|
139 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
140 |
+
$db_read = $resource->getConnection ( 'core_read' );
|
141 |
+
$sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
|
142 |
+
$rq_sql = '
|
143 |
+
SELECT count(*) AS `nb_in_table`
|
144 |
+
FROM ' . $sarbacanedesktop_users . '
|
145 |
+
WHERE `sd_type` = "sd_id"
|
146 |
+
AND `sd_value` = ' . $db_read->quote ( $sd_id ) . ' AND list_id="' . $list_id . '"';
|
147 |
+
$nb_in_table = $db_read->fetchOne ( $rq_sql );
|
148 |
+
if ($nb_in_table == 0)
|
149 |
+
return 'Y';
|
150 |
+
return 'N';
|
151 |
+
}
|
152 |
+
private function listIsUpdated($store_id, $list_type, $sd_id) {
|
153 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
154 |
+
$db_read = $resource->getConnection ( 'core_read' );
|
155 |
+
$sarbacanedesktop_users = $resource->getTableName ( 'sarbacanedesktop_users' );
|
156 |
+
$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 . '\'';
|
157 |
+
$last_call_date = $db_read->fetchOne ( $rq_sql );
|
158 |
+
$is_updated_list = 'N';
|
159 |
+
if ($this->processNewUnsubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
|
160 |
+
$is_updated_list = 'Y';
|
161 |
+
}
|
162 |
+
if ($this->processNewSubscribers ( $list_type, $store_id, $sd_id, 'is_updated', $last_call_date ) > 0) {
|
163 |
+
$is_updated_list = 'Y';
|
164 |
+
}
|
165 |
+
return $is_updated_list;
|
166 |
+
}
|
167 |
+
private function dQuote($value) {
|
168 |
+
$value = str_replace ( '"', '""', $value );
|
169 |
+
if (strpos ( $value, ' ' ) || strpos ( $value, ';' )) {
|
170 |
+
$value = '"' . $value . '"';
|
171 |
+
}
|
172 |
+
return $value;
|
173 |
+
}
|
174 |
+
private function processNewSubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
|
175 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
176 |
+
$db_read = $resource->getConnection ( 'core_read' );
|
177 |
+
$db_write = $resource->getConnection ( 'core_write' );
|
178 |
+
$sd_updates = $resource->getTableName ( 'sd_updates' );
|
179 |
+
$newsletter_subscriber = $resource->getTableName ( 'newsletter_subscriber' );
|
180 |
+
$sales_flat_order = $resource->getTableName ( 'sales_flat_order' );
|
181 |
+
$customer_entity = $resource->getTableName ( 'customer_entity' );
|
182 |
+
$customer_entity_varchar = $resource->getTableName ( 'customer_entity_varchar' );
|
183 |
+
$core_store = $resource->getTableName ( 'core_store' ); // core store
|
184 |
+
$attr_firstname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'firstname' )->getAttributeId ();
|
185 |
+
$attr_lastname = Mage::getModel ( 'customer/customer' )->getAttribute ( 'lastname' )->getAttributeId ();
|
186 |
+
$rq_sql_limit = '2500';
|
187 |
+
if ($type_action == 'is_updated')
|
188 |
+
$rq_sql_limit = '1';
|
189 |
+
if ($list_type == 'N') {
|
190 |
+
if ($last_call_date != null && $last_call_date != '') {
|
191 |
+
$rq_sql = 'SELECT sdu.`email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
|
192 |
+
FROM `' . $sd_updates . '` AS `sdu`
|
193 |
+
LEFT JOIN ' . $newsletter_subscriber . ' ns ON ns.subscriber_email = sdu.email
|
194 |
+
LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
|
195 |
+
LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
|
196 |
+
WHERE ns.`subscriber_status` = 1 AND sdu.update_time > "' . $last_call_date . '" AND sdu.list_type="N" AND sdu.action="S"
|
197 |
+
AND ns.`store_id` = ' . ( int ) $store_id . '
|
198 |
+
LIMIT 0, ' . $rq_sql_limit;
|
199 |
+
} else {
|
200 |
+
$rq_sql = '
|
201 |
+
SELECT ns.`subscriber_email` AS `email`, IFNULL(lastname.`value`, \'\') AS `lastname`, IFNULL(firstname.`value`, \'\') AS `firstname`
|
202 |
+
FROM `' . $newsletter_subscriber . '` AS `ns`
|
203 |
+
LEFT JOIN ' . $customer_entity_varchar . ' AS `lastname` ON lastname.`entity_id` = ns.`customer_id` AND lastname.`attribute_id` = ' . ( int ) $attr_lastname . '
|
204 |
+
LEFT JOIN ' . $customer_entity_varchar . ' AS `firstname` ON firstname.`entity_id` = ns.`customer_id` AND firstname.`attribute_id` = ' . ( int ) $attr_firstname . '
|
205 |
+
WHERE ns.`subscriber_status` = 1
|
206 |
+
AND ns.`store_id` = ' . ( int ) $store_id . '
|
207 |
+
LIMIT 0, ' . $rq_sql_limit;
|
208 |
+
}
|
209 |
+
} else if ($list_type == 'C') {
|
210 |
+
$add_customer_data = $this->checkIfListWithCustomerData ( $list_type, $store_id );
|
211 |
+
$rq_sql = "
|
212 |
+
SELECT c.email AS email ,cevln.value as lastname , cevfn.value as firstname";
|
213 |
+
if ($add_customer_data) {
|
214 |
+
$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";
|
215 |
+
}
|
216 |
+
$rq_sql .= " FROM $customer_entity c LEFT JOIN $customer_entity_varchar cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7
|
217 |
+
LEFT JOIN $customer_entity_varchar cevfn ON cevfn.entity_id = c.entity_id AND cevfn.attribute_id = 5";
|
218 |
+
if ($add_customer_data) {
|
219 |
+
$rq_sql .= " LEFT JOIN $sales_flat_order sfo ON sfo.customer_id = c.entity_id ";
|
220 |
+
}
|
221 |
+
$rq_sql .= " WHERE c.store_id = " . $store_id;
|
222 |
+
if ($last_call_date != null && $last_call_date != '') {
|
223 |
+
$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 . "') ";
|
224 |
+
}
|
225 |
+
$rq_sql .= " GROUP BY c.email
|
226 |
UNION
|
227 |
+
SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname, sfo.customer_firstname as firstname";
|
228 |
+
if ($add_customer_data) {
|
229 |
+
$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";
|
230 |
+
}
|
231 |
+
$rq_sql .= "
|
232 |
FROM $sales_flat_order sfo
|
233 |
+
WHERE sfo.customer_id IS NULL AND sfo.store_id = " . $store_id;
|
234 |
+
if ($last_call_date != null && $last_call_date != '') {
|
235 |
+
$rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
|
236 |
+
}
|
237 |
+
$rq_sql .= " GROUP BY sfo.customer_email ";
|
238 |
+
|
239 |
+
$rq_sql .= " LIMIT 0, " . $rq_sql_limit;
|
240 |
+
} else {
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
if ($type_action == 'is_updated') {
|
244 |
+
$rq = $db_read->fetchAll ( $rq_sql );
|
245 |
+
return count ( $rq );
|
246 |
+
} else {
|
247 |
+
$rq = $db_read->query ( $rq_sql );
|
248 |
+
while ( $r = $rq->fetch () ) {
|
249 |
+
$line = "\r\n" . $this->dQuote ( $r ['email'] ) . ';'; // TEST
|
250 |
+
$line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
|
251 |
+
$orders_data = '';
|
252 |
+
if ($list_type == 'C') {
|
253 |
+
if ($add_customer_data) {
|
254 |
+
$line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
|
255 |
+
$line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
|
256 |
+
$line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'];
|
257 |
+
$orders_data = $r ['amount_min_order'] . $r ['amount_max_order'];
|
258 |
+
$orders_data .= $r ['nb_orders'] . $r ['amount_all_orders'];
|
259 |
+
}
|
260 |
+
}
|
261 |
+
$line .= ';S';
|
262 |
+
echo $line;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
}
|
266 |
+
private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
|
267 |
+
$resource = Mage::getSingleton ( 'core/resource' );
|
268 |
+
$db_read = $resource->getConnection ( 'core_read' );
|
269 |
+
|
270 |
+
$sd_updates = $resource->getTableName ( 'sd_updates' );
|
271 |
+
|
272 |
+
$rq_sql_limit = '2500';
|
273 |
+
if ($type_action == 'is_updated')
|
274 |
+
$rq_sql_limit = '1';
|
275 |
+
switch ($list_type) {
|
276 |
+
case 'N' :
|
277 |
+
case 'C' :
|
278 |
+
$rq_sql = 'SELECT email FROM ' . $sd_updates . ' WHERE list_type="' . $list_type . '" AND action = "U"';
|
279 |
+
if ($last_call_date != null && $last_call_date != '') {
|
280 |
+
$rq_sql .= ' AND update_time > "' . $last_call_date . '"';
|
281 |
+
}
|
282 |
+
break;
|
283 |
+
default :
|
284 |
+
return;
|
285 |
+
}
|
286 |
+
if ($type_action == 'is_updated') {
|
287 |
+
$rq = $db_read->fetchAll ( $rq_sql );
|
288 |
+
return count ( $rq );
|
289 |
+
} else {
|
290 |
+
$rq = $db_read->query ( $rq_sql );
|
291 |
+
while ( $r = $rq->fetch () ) {
|
292 |
+
$line = "\n" . $this->dQuote ( $r ['email'] ) . ';;'; // TEST
|
293 |
+
if ($list_type == 'C') {
|
294 |
+
if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
|
295 |
+
$line .= ';;;;;';
|
296 |
+
}
|
297 |
+
}
|
298 |
+
$line .= ';U' . "\r\n";
|
299 |
+
echo $line;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
app/code/community/Sarbacane/Mailify/etc/config.xml
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<config>
|
24 |
<modules>
|
25 |
<Sarbacane_Mailify>
|
26 |
-
<version>1.0.0.
|
27 |
</Sarbacane_Mailify>
|
28 |
</modules>
|
29 |
<frontend>
|
23 |
<config>
|
24 |
<modules>
|
25 |
<Sarbacane_Mailify>
|
26 |
+
<version>1.0.0.4</version>
|
27 |
</Sarbacane_Mailify>
|
28 |
</modules>
|
29 |
<frontend>
|
app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.0-1.0.0.1.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
22 |
+
$installer = $this;
|
23 |
+
$installer->startSetup();
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.1-1.0.0.2.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
22 |
+
$installer = $this;
|
23 |
+
$installer->startSetup();
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.2-1.0.0.3.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
22 |
+
$installer = $this;
|
23 |
+
$installer->startSetup();
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/code/community/Sarbacane/Mailify/sql/mailify_setup/mysql4-upgrade-1.0.0.3-1.0.0.4.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
22 |
+
$installer = $this;
|
23 |
+
$installer->startSetup();
|
24 |
+
|
25 |
+
$installer->run("DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop')}`;");
|
26 |
+
$installer->run("DROP TABLE IF EXISTS `{$this->getTable('sd_updates')}`;");
|
27 |
+
|
28 |
+
$installer->run("ALTER TABLE `{$this->getTable('sarbacanedesktop_users')}` ADD COLUMN `list_id` VARCHAR(50) NULL DEFAULT NULL AFTER `sd_value`;");
|
29 |
+
$installer->run("ALTER TABLE `{$this->getTable('sarbacanedesktop_users')}` ADD COLUMN `last_call_date` VARCHAR(50) NULL DEFAULT NULL AFTER `list_id`;");
|
30 |
+
|
31 |
+
$installer->run("
|
32 |
+
CREATE TABLE `{$this->getTable('sd_updates')}` (
|
33 |
+
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
34 |
+
`email` VARCHAR(50) NOT NULL COLLATE 'utf8_bin',
|
35 |
+
`update_time` DATETIME NOT NULL,
|
36 |
+
`action` VARCHAR(5) NOT NULL COLLATE 'utf8_bin',
|
37 |
+
`list_type` VARCHAR(10) NULL DEFAULT NULL COLLATE 'utf8_bin',
|
38 |
+
PRIMARY KEY (`id`),
|
39 |
+
INDEX `update_time_action` (`update_time`, `action`)
|
40 |
+
)
|
41 |
+
COMMENT='Contains useful data used by SD/MF plugin'
|
42 |
+
COLLATE='utf8_bin'
|
43 |
+
ENGINE=InnoDB
|
44 |
+
;");
|
45 |
+
|
46 |
+
$installer->run("DROP TRIGGER IF EXISTS sd_newsletter_update;");
|
47 |
+
$installer->run("DROP TRIGGER IF EXISTS sd_customer_delete;");
|
48 |
+
|
49 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
50 |
+
|
51 |
+
$sql= "
|
52 |
+
CREATE TRIGGER `sd_newsletter_update`
|
53 |
+
AFTER UPDATE ON `{$this->getTable('newsletter_subscriber')}`
|
54 |
+
FOR EACH ROW BEGIN
|
55 |
+
DELETE FROM {$this->getTable('sd_updates')} WHERE email=NEW.subscriber_email AND list_type='N';
|
56 |
+
IF NEW.subscriber_status = 1 THEN
|
57 |
+
INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'S','N');
|
58 |
+
ELSE
|
59 |
+
INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'U','N');
|
60 |
+
END IF;
|
61 |
+
END;";
|
62 |
+
$write->exec($sql);
|
63 |
+
|
64 |
+
$sql= "
|
65 |
+
CREATE TRIGGER `sd_newsletter_insert`
|
66 |
+
AFTER INSERT ON `{$this->getTable('newsletter_subscriber')}`
|
67 |
+
FOR EACH ROW BEGIN
|
68 |
+
DELETE FROM {$this->getTable('sd_updates')} WHERE email=NEW.subscriber_email AND list_type='N';
|
69 |
+
IF NEW.subscriber_status = 1 THEN
|
70 |
+
INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'S','N');
|
71 |
+
ELSE
|
72 |
+
INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (NEW.subscriber_email,UTC_TIMESTAMP(),'U','N');
|
73 |
+
END IF;
|
74 |
+
END;";
|
75 |
+
$write->exec($sql);
|
76 |
+
|
77 |
+
$sql = "
|
78 |
+
CREATE TRIGGER `sd_customer_delete`
|
79 |
+
BEFORE DELETE ON `{$this->getTable('customer_entity')}`
|
80 |
+
FOR EACH ROW BEGIN
|
81 |
+
DELETE FROM {$this->getTable('sd_updates')} WHERE email=OLD.email AND list_type='C';
|
82 |
+
INSERT INTO {$this->getTable('sd_updates')} (email,update_time,action,list_type) VALUES (OLD.email,UTC_TIMESTAMP(),'U','C');
|
83 |
+
END";
|
84 |
+
$write->exec($sql);
|
85 |
+
|
86 |
+
|
87 |
+
$installer->endSetup();
|
app/locale/en_US/Sarbacane_Mailify.csv
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"Tel:","Tel:"
|
26 |
"+33(0) 328 328 040","(646)-844-0983"
|
27 |
"Website:","Website : "
|
28 |
-
"http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://www.mailify.com/?lng=EN&utm_source=module-
|
29 |
"http://www.sarbacane.com","http://www.mailify.com"
|
30 |
"How to set up the module?","How to set up the module?"
|
31 |
"Do you already have a Sarbacane Desktop account?","Do you already have a Mailify account?"
|
@@ -47,12 +47,12 @@
|
|
47 |
"- Average amount of the orders placed","- Average amount of the orders placed"
|
48 |
"Previous","Previous"
|
49 |
"Download and install Sarbacane","Download and install Mailify"
|
50 |
-
"https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://static.mailify.com/ws/soft-redirect.asp?key=
|
51 |
"Create your free account","Create your free account"
|
52 |
"Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Enable the Magento extension in our extensions menu, and then fill in the following fields:"
|
53 |
"Url","Url"
|
54 |
"Key","Key"
|
55 |
"Generate a new key","Generate a new key"
|
56 |
"Read more","Read more"
|
57 |
-
"http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","
|
58 |
"in the help section online","in the help section online"
|
25 |
"Tel:","Tel:"
|
26 |
"+33(0) 328 328 040","(646)-844-0983"
|
27 |
"Website:","Website : "
|
28 |
+
"http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://www.mailify.com/?lng=EN&utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
|
29 |
"http://www.sarbacane.com","http://www.mailify.com"
|
30 |
"How to set up the module?","How to set up the module?"
|
31 |
"Do you already have a Sarbacane Desktop account?","Do you already have a Mailify account?"
|
47 |
"- Average amount of the orders placed","- Average amount of the orders placed"
|
48 |
"Previous","Previous"
|
49 |
"Download and install Sarbacane","Download and install Mailify"
|
50 |
+
"https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://static.mailify.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo&lng=EN"
|
51 |
"Create your free account","Create your free account"
|
52 |
"Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Enable the Magento extension in our extensions menu, and then fill in the following fields:"
|
53 |
"Url","Url"
|
54 |
"Key","Key"
|
55 |
"Generate a new key","Generate a new key"
|
56 |
"Read more","Read more"
|
57 |
+
"http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://www.mailify.com/faq/extensions/configuration-prestashop/?lng=EN&utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
|
58 |
"in the help section online","in the help section online"
|
app/locale/es_ES/Sarbacane_Mailify.csv
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"Tel:","Tel:"
|
26 |
"+33(0) 328 328 040","+34 93 4763638"
|
27 |
"Website:","Web : "
|
28 |
-
"http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://es.mailify.com/?lng=ES&utm_source=module-
|
29 |
"http://www.sarbacane.com","http://es.mailify.com"
|
30 |
"How to set up the module?","¿Cómo configurar el módulo?"
|
31 |
"Do you already have a Sarbacane Desktop account?","¿Ya eres usuario Mailify?"
|
@@ -47,12 +47,12 @@
|
|
47 |
"- Average amount of the orders placed","- Importe medio de pedidos"
|
48 |
"Previous","Anterior"
|
49 |
"Download and install Sarbacane","Descarga e instala Mailify"
|
50 |
-
"https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://static.mailify.com/ws/soft-redirect.asp?key=
|
51 |
"Create your free account","Crea tu cuenta gratis"
|
52 |
"Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Activa la extensión Magento desde el menú ''Extensiones'' en Mailify e introduce los siguientes datos:"
|
53 |
"Url","Url"
|
54 |
"Key","Clave"
|
55 |
"Generate a new key","Generar una nueva clave"
|
56 |
"Read more","Leer más en la"
|
57 |
-
"http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","https://
|
58 |
"in the help section online","ayuda en línea"
|
25 |
"Tel:","Tel:"
|
26 |
"+33(0) 328 328 040","+34 93 4763638"
|
27 |
"Website:","Web : "
|
28 |
+
"http://www.sarbacane.com/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","http://es.mailify.com/?lng=ES&utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
|
29 |
"http://www.sarbacane.com","http://es.mailify.com"
|
30 |
"How to set up the module?","¿Cómo configurar el módulo?"
|
31 |
"Do you already have a Sarbacane Desktop account?","¿Ya eres usuario Mailify?"
|
47 |
"- Average amount of the orders placed","- Importe medio de pedidos"
|
48 |
"Previous","Anterior"
|
49 |
"Download and install Sarbacane","Descarga e instala Mailify"
|
50 |
+
"https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo","https://static.mailify.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=PrestaShopInfo&lng=ES"
|
51 |
"Create your free account","Crea tu cuenta gratis"
|
52 |
"Enable the Prestashop extension in our extensions menu, and then fill in the following fields:","Activa la extensión Magento desde el menú ''Extensiones'' en Mailify e introduce los siguientes datos:"
|
53 |
"Url","Url"
|
54 |
"Key","Clave"
|
55 |
"Generate a new key","Generar una nueva clave"
|
56 |
"Read more","Leer más en la"
|
57 |
+
"http://www.sarbacane.com/faq/extensions/configuration-plugin-prestashop/?utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop","https://es.mailify.com/faq/herramientas-analisis-email-marketing/configurar-plugin-prestashop/?lng=ES&utm_source=module-prestashop&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=prestashop"
|
58 |
"in the help section online","ayuda en línea"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sarbacane_Mailify</name>
|
4 |
-
<version>1.0.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">AFL</license>
|
7 |
<channel>community</channel>
|
@@ -58,11 +58,11 @@
|
|
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>
|
62 |
<authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
|
63 |
-
<date>2015-06-
|
64 |
-
<time>15:
|
65 |
-
<contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Mailify"><dir name="Block"><dir name="Adminhtml"><file name="Mailify.php" hash="f0ad71d64dc619421a67a3af24b23278"/></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
66 |
<compatible/>
|
67 |
<dependencies><required><php><min>5.0.0</min><max>5.6.9</max></php></required></dependencies>
|
68 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sarbacane_Mailify</name>
|
4 |
+
<version>1.0.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/academic.php">AFL</license>
|
7 |
<channel>community</channel>
|
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>This release hugely improves the plugin behavior. No more useless data are stored.</notes>
|
62 |
<authors><author><name>Sarbacane Software</name><user>egavard</user><email>connectors@sarbacane.com</email></author></authors>
|
63 |
+
<date>2015-06-25</date>
|
64 |
+
<time>15:08:30</time>
|
65 |
+
<contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Mailify"><dir name="Block"><dir name="Adminhtml"><file name="Mailify.php" hash="f0ad71d64dc619421a67a3af24b23278"/></dir></dir><dir name="Helper"><file name="Data.php" hash="00fbadd2b8c1d7d4c88f20edb09721a9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MailifyController.php" hash="3e8e56c95f4453af3fa9853f946bce9e"/></dir><file name="IndexController.php" hash="a84d67560076b3e0a555503fd0bc7889"/></dir><dir name="etc"><file name="config.xml" hash="0c8052e8c0c88f71148193f672cf382a"/></dir><dir name="sql"><dir name="mailify_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="2bd5ea1d79115c1a6ba919a708b1fb4b"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="Sarbacane_Mailify"><file name="mailify.css" hash="6fcee54bdab10db72a361ec5a139cc7c"/></dir></dir><dir name="images"><file name="sd.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir><dir name="js"><dir name="Sarbacane_Mailify"><file name="mailify.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="mailify.xml" hash="2ce0ac9b7cd4ec8adf80494c86aaae10"/></dir><dir name="template"><dir name="mailify"><file name="mailify.phtml" hash="01ed4cea3b25957dbfbb2ad3e99c41e8"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Sarbacane_Mailify.xml" hash="daf2fd2fbde04d804b1fdd7671273c82"/></dir></dir></dir></target><target name="magelocale"><dir name="es_ES"><file name="Sarbacane_Mailify.csv" hash="8935ea92f97fa8f488ce2d6e22dcc1f6"/></dir><dir name="en_US"><file name="Sarbacane_Mailify.csv" hash="5e35719a54d7d7729af24a83e65861b0"/></dir></target></contents>
|
66 |
<compatible/>
|
67 |
<dependencies><required><php><min>5.0.0</min><max>5.6.9</max></php></required></dependencies>
|
68 |
</package>
|