Version Notes
We improved performance on synchronization.
It should be more efficient and nearly instant on most websites.
Download this release
Release Info
Developer | Sarbacane Software |
Extension | Sarbacane_Sarbacanedesktop |
Version | 1.0.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.7 to 1.0.0.8
- app/code/community/Sarbacane/Sarbacanedesktop/Block/Adminhtml/Sarbacanedesktop.php +1 -2
- app/code/community/Sarbacane/Sarbacanedesktop/Helper/Data.php +187 -119
- app/code/community/Sarbacane/Sarbacanedesktop/Model/Observer.php +155 -0
- app/code/community/Sarbacane/Sarbacanedesktop/controllers/Adminhtml/SarbacanedesktopController.php +118 -94
- app/code/community/Sarbacane/Sarbacanedesktop/controllers/IndexController.php +497 -348
- app/code/community/Sarbacane/Sarbacanedesktop/etc/config.xml +139 -125
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-install-1.0.0.0.php +0 -52
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.0-1.0.0.1.php +0 -25
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.1-1.0.0.2.php +0 -25
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.2-1.0.0.3.php +0 -25
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.3-1.0.0.4.php +0 -87
- app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.7-1.0.0.8.php +113 -0
- app/design/adminhtml/default/default/layout/sarbacanedesktop.xml +6 -6
- app/design/adminhtml/default/default/template/sarbacanedesktop/sarbacanedesktop.phtml +260 -244
- app/etc/modules/Sarbacane_Sarbacanedesktop.xml +1 -1
- app/locale/en_US/Sarbacane_Sarbacanedesktop.csv +4 -2
- app/locale/fr_FR/Sarbacane_Sarbacanedesktop.csv +5 -3
- package.xml +7 -7
- skin/adminhtml/default/default/images/{sd.png → sarbacanedesktop.png} +0 -0
- skin/adminhtml/default/default/js/Sarbacane_SarbacaneDesktop/sarbacanedesktop.js +0 -95
- skin/adminhtml/default/default/{css/Sarbacane_SarbacaneDesktop/sarbacanedesktop.css → sarbacanedesktop.css} +4 -6
- skin/adminhtml/default/default/sarbacanedesktop.js +74 -0
app/code/community/Sarbacane/Sarbacanedesktop/Block/Adminhtml/Sarbacanedesktop.php
CHANGED
@@ -18,8 +18,7 @@
|
|
18 |
* @copyright 2015 Sarbacane Software
|
19 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
*/
|
21 |
-
|
22 |
class Sarbacane_Sarbacanedesktop_Block_Adminhtml_Sarbacanedesktop extends Mage_Adminhtml_Block_Template
|
23 |
{
|
24 |
|
25 |
-
}
|
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_Block_Adminhtml_Sarbacanedesktop extends Mage_Adminhtml_Block_Template
|
22 |
{
|
23 |
|
24 |
+
}
|
app/code/community/Sarbacane/Sarbacanedesktop/Helper/Data.php
CHANGED
@@ -18,133 +18,201 @@
|
|
18 |
* @copyright 2015 Sarbacane Software
|
19 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
*/
|
21 |
-
|
22 |
class Sarbacane_Sarbacanedesktop_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
SELECT *
|
101 |
-
FROM `' . $sarbacanedesktop_users . '`
|
102 |
-
WHERE `sd_type` = \'sd_token\'
|
103 |
-
OR `sd_type` = \'sd_list\'';
|
104 |
-
$rq = $db_read->query($rq_sql);
|
105 |
-
$sd_token = '';
|
106 |
-
$sd_list = '';
|
107 |
-
while ($r = $rq->fetch()) {
|
108 |
-
if ($r['sd_type'] == 'sd_token') {
|
109 |
-
$sd_token = $r['sd_value'];
|
110 |
-
}
|
111 |
-
else if ($r['sd_type'] == 'sd_list') {
|
112 |
-
$sd_list = $r['sd_value'];
|
113 |
-
}
|
114 |
-
}
|
115 |
-
if ($return == 'sd_token' || $return == 'sd_list') {
|
116 |
-
if ($return == 'sd_token') {
|
117 |
-
return $sd_token;
|
118 |
-
}
|
119 |
-
else if ($return == 'sd_list') {
|
120 |
-
return $sd_list;
|
121 |
-
}
|
122 |
-
} else {
|
123 |
-
if ($return == 'all') {
|
124 |
-
return array(
|
125 |
-
'sd_token' => $sd_token,
|
126 |
-
'sd_list' => $sd_list
|
127 |
-
);
|
128 |
-
} else {
|
129 |
-
$nb_configured = 0;
|
130 |
-
if ($sd_token != '') {
|
131 |
-
$nb_configured++;
|
132 |
-
}
|
133 |
-
if ($sd_list != '') {
|
134 |
-
$nb_configured++;
|
135 |
-
}
|
136 |
-
return $nb_configured;
|
137 |
-
}
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
public function deleteSdid($sd_id){
|
142 |
-
$resource = Mage::getSingleton('core/resource');
|
143 |
-
$db_write = $resource->getConnection('core_write');
|
144 |
-
$sarbacanedesktop_users = $resource->getTableName('sarbacanedesktop_users');
|
145 |
-
|
146 |
-
$rq_sql = 'DELETE FROM '.$sarbacanedesktop_users.' WHERE sd_value = "'.$sd_id.'" AND sd_type="sd_id"';
|
147 |
-
$db_write->query($rq_sql);
|
148 |
-
}
|
149 |
|
150 |
-
}
|
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_Helper_Data extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
|
24 |
+
public function getShopsArray()
|
25 |
+
{
|
26 |
+
$shops = Mage::app()->getStores();
|
27 |
+
$shops_array = array();
|
28 |
+
foreach ($shops as $shop) {
|
29 |
+
$shops_array[] = array(
|
30 |
+
'store_id' => $shop->store_id,
|
31 |
+
'name' => $shop->name
|
32 |
+
);
|
33 |
+
}
|
34 |
+
$shops_array[] = array(
|
35 |
+
'store_id' => '0',
|
36 |
+
'name' => $this->__('Other')
|
37 |
+
);
|
38 |
+
return $shops_array;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getIdShopFromList($list)
|
42 |
+
{
|
43 |
+
if (substr($list, -1) == 'N' || substr($list, -1) == 'C') {
|
44 |
+
return substr($list, 0, -1);
|
45 |
+
} else {
|
46 |
+
return substr($list, 0, -2);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getListTypeFromList($list)
|
51 |
+
{
|
52 |
+
if (substr($list, -1) == 'N' || substr($list, -1) == 'C') {
|
53 |
+
return substr($list, -1);
|
54 |
+
} else {
|
55 |
+
return substr($list, -2, 1);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getListTypeArray()
|
60 |
+
{
|
61 |
+
return array('N', 'C');
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getListConfiguration($return = 'string')
|
65 |
+
{
|
66 |
+
$sd_list = $this->getConfiguration('sd_list');
|
67 |
+
if ($return == 'string') {
|
68 |
+
return $sd_list;
|
69 |
+
} else {
|
70 |
+
if (strlen($sd_list) != 0) {
|
71 |
+
return explode(',', $sd_list);
|
72 |
+
}
|
73 |
+
return array();
|
74 |
+
}
|
75 |
+
}
|
76 |
|
77 |
+
public function getToken()
|
78 |
+
{
|
79 |
+
$str = $this->getConfiguration('sd_token');
|
80 |
+
$str = explode('-', $str);
|
81 |
+
$token = '';
|
82 |
+
foreach ($str as $key => $s) {
|
83 |
+
if ($key == 0) {
|
84 |
+
$token = $s . substr(Mage::helper('core')->encrypt('SecurityTokenForModule'), 0, 11) . $s;
|
85 |
+
$token = md5($token);
|
86 |
+
}else {
|
87 |
+
$token .= $s;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return $token;
|
91 |
+
}
|
92 |
|
93 |
+
public function getConfiguration($return = 'nb_configured')
|
94 |
+
{
|
95 |
+
$sd_configuration_loaded = false;
|
96 |
+
if (isset($this->sd_configuration)) {
|
97 |
+
if (isset($this->sd_configuration['sd_token']) && isset($this->sd_configuration['sd_list'])
|
98 |
+
&& isset($this->sd_configuration['sd_is_user']) && isset($this->sd_configuration['sd_last_update'])
|
99 |
+
&& isset($this->sd_configuration['sd_nb_failed'])) {
|
100 |
+
$sd_configuration_loaded = true;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
if ( ! $sd_configuration_loaded) {
|
104 |
+
$resource = Mage::getSingleton('core/resource');
|
105 |
+
$db_read = $resource->getConnection('core_read');
|
106 |
+
$sd_data = $resource->getTableName('sd_data');
|
107 |
+
$sd_configuration = array(
|
108 |
+
'sd_token' => '',
|
109 |
+
'sd_list' => '',
|
110 |
+
'sd_is_user' => '',
|
111 |
+
'sd_last_update' => '',
|
112 |
+
'sd_nb_failed' => 0
|
113 |
+
);
|
114 |
+
$rq_sql = '
|
115 |
+
SELECT *
|
116 |
+
FROM `' . $sd_data . '`
|
117 |
+
WHERE `sd_type` IN (\'sd_token\', \'sd_list\', \'sd_is_user\', \'sd_last_update\', \'sd_nb_failed\')';
|
118 |
+
$rq = $db_read->query($rq_sql);
|
119 |
+
while ($r = $rq->fetch()) {
|
120 |
+
$sd_configuration[$r['sd_type']] = $r['sd_value'];
|
121 |
+
}
|
122 |
+
$sd_configuration['sd_nb_failed'] = (int)$sd_configuration['sd_nb_failed'];
|
123 |
+
$this->sd_configuration = $sd_configuration;
|
124 |
+
}
|
125 |
+
if ($return == 'sd_token' || $return == 'sd_list' || $return == 'sd_is_user' || $return == 'sd_last_update' || $return == 'sd_nb_failed') {
|
126 |
+
return $this->sd_configuration[$return];
|
127 |
+
} else {
|
128 |
+
if ($return == 'all') {
|
129 |
+
return $this->sd_configuration;
|
130 |
+
} else {
|
131 |
+
$nb_configured = 0;
|
132 |
+
if ($this->sd_configuration['sd_token'] != '') {
|
133 |
+
$nb_configured = 3;
|
134 |
+
} else {
|
135 |
+
if ($this->sd_configuration['sd_list'] != '') {
|
136 |
+
$nb_configured++;
|
137 |
+
}
|
138 |
+
if ($this->sd_configuration['sd_is_user'] != '') {
|
139 |
+
$nb_configured++;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
return $nb_configured;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
|
147 |
+
public function updateConfiguration($name, $value) {
|
148 |
+
$resource = Mage::getSingleton('core/resource');
|
149 |
+
$db_write = $resource->getConnection('core_write');
|
150 |
+
$sd_data = $resource->getTableName('sd_data');
|
151 |
+
$rq_sql = '
|
152 |
+
UPDATE `' . $sd_data . '`
|
153 |
+
SET `sd_value` = ' . $db_write->quote($value) . '
|
154 |
+
WHERE `sd_type` = ' . $db_write->quote($name);
|
155 |
+
$db_write->query($rq_sql);
|
156 |
+
unset($this->sd_configuration);
|
157 |
+
}
|
158 |
|
159 |
+
public function deleteSdid($sd_id)
|
160 |
+
{
|
161 |
+
$resource = Mage::getSingleton('core/resource');
|
162 |
+
$db_write = $resource->getConnection('core_write');
|
163 |
+
$sd_users = $resource->getTableName('sd_users');
|
164 |
+
$rq_sql = '
|
165 |
+
DELETE
|
166 |
+
FROM `' . $sd_users . '`
|
167 |
+
WHERE `sd_id` = ' . $db_write->quote($sd_id);
|
168 |
+
$db_write->query($rq_sql);
|
169 |
+
}
|
|
|
170 |
|
171 |
+
public function checkNeedUserInsertSdUpdates($store_id, $list_type)
|
172 |
+
{
|
173 |
+
$sd_list_array = $this->getListConfiguration('array');
|
174 |
+
$sd_list_string = implode(',', $sd_list_array);
|
175 |
+
if (strpos($sd_list_string, $list_type) === false) {
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
if ($list_type == 'N') {
|
179 |
+
$in_array = in_array($store_id . 'N0', $sd_list_array);
|
180 |
+
} else {
|
181 |
+
$in_array = in_array($store_id . 'C0', $sd_list_array) || in_array($store_id . 'C1', $sd_list_array);
|
182 |
+
}
|
183 |
+
if ($in_array) {
|
184 |
+
$sd_synchronized_lists_array = $this->getSynchronizedListsArray();
|
185 |
+
if (in_array($store_id . $list_type, $sd_synchronized_lists_array)) {
|
186 |
+
return true;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
return false;
|
190 |
+
}
|
191 |
|
192 |
+
public function getSynchronizedListsArray() {
|
193 |
+
if ( ! isset($this->sd_synchronized_lists_array)) {
|
194 |
+
$resource = Mage::getSingleton('core/resource');
|
195 |
+
$db_read = $resource->getConnection('core_read');
|
196 |
+
$sd_users = $resource->getTableName('sd_users');
|
197 |
+
$sd_synchronized_lists_array = array();
|
198 |
+
$rq_sql = '
|
199 |
+
SELECT `list_id`
|
200 |
+
FROM `' . $sd_users . '`
|
201 |
+
GROUP BY `list_id`';
|
202 |
+
$rq = $db_read->query($rq_sql);
|
203 |
+
while ($r = $rq->fetch()) {
|
204 |
+
$sd_synchronized_lists_array[] = $r['list_id'];
|
205 |
+
}
|
206 |
+
$this->sd_synchronized_lists_array = $sd_synchronized_lists_array;
|
207 |
+
}
|
208 |
+
return $this->sd_synchronized_lists_array;
|
209 |
+
}
|
210 |
|
211 |
+
public function checkFailed() {
|
212 |
+
if ($this->getConfiguration('sd_nb_failed') < 1000000) {
|
213 |
+
return false;
|
214 |
+
}
|
215 |
+
return true;
|
216 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
+
}
|
app/code/community/Sarbacane/Sarbacanedesktop/Model/Observer.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Model_Observer
|
22 |
+
{
|
23 |
+
|
24 |
+
public function customerSave(Varien_Event_Observer $observer)
|
25 |
+
{
|
26 |
+
try {
|
27 |
+
if (Mage::app()->getRequest()->getActionName() != 'saveOrder') {
|
28 |
+
$old_data = $observer->getCustomer()->getOrigData();
|
29 |
+
$new_data = $observer->getCustomer()->getData();
|
30 |
+
if (isset($old_data['email']) && isset($new_data['email']) && isset($old_data['store_id']) && isset($new_data['store_id']) && isset($old_data['website_id']) && isset($new_data['website_id'])) {
|
31 |
+
$old_website_id = $old_data['website_id'];
|
32 |
+
$new_website_id = $new_data['website_id'];
|
33 |
+
if ($old_website_id != 0 || $new_website_id != 0) {
|
34 |
+
$old_email = $old_data['email'];
|
35 |
+
$new_email = $new_data['email'];
|
36 |
+
$old_store_id = $old_data['store_id'];
|
37 |
+
$new_store_id = $new_data['store_id'];
|
38 |
+
if ($old_email != $new_email || $old_store_id != $new_store_id) {
|
39 |
+
$now = gmdate('Y-m-d H:i:s');
|
40 |
+
$this->userInsertSdUpdatesIfNecessary($old_email, $old_store_id, 'C', 'U', $now);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
catch(Exception $e) {}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function customerDelete(Varien_Event_Observer $observer)
|
50 |
+
{
|
51 |
+
try {
|
52 |
+
$data = $observer->getCustomer()->getData();
|
53 |
+
if (isset($data['email']) && isset($data['entity_id']) && isset($data['store_id']) && isset($data['website_id'])) {
|
54 |
+
$website_id = $data['website_id'];
|
55 |
+
if ($website_id != 0) {
|
56 |
+
$email = $data['email'];
|
57 |
+
$store_id = $data['store_id'];
|
58 |
+
$now = gmdate('Y-m-d H:i:s');
|
59 |
+
$this->userInsertSdUpdatesIfNecessary($email, $store_id, 'C', 'U', $now);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
catch(Exception $e) {}
|
64 |
+
}
|
65 |
+
|
66 |
+
public function newsletterSubscriberSave(Varien_Event_Observer $observer)
|
67 |
+
{
|
68 |
+
try {
|
69 |
+
$action_name = Mage::app()->getRequest()->getActionName();
|
70 |
+
if ($action_name != 'saveOrder') {
|
71 |
+
$data = $observer->getSubscriber()->getData();
|
72 |
+
if (isset($data['subscriber_email']) && isset($data['store_id']) && isset($data['subscriber_status'])) {
|
73 |
+
$new_email = $data['subscriber_email'];
|
74 |
+
$new_store_id = $data['store_id'];
|
75 |
+
$new_status = $data['subscriber_status'];
|
76 |
+
if ($new_status == '1' || $new_status == '3') {
|
77 |
+
$now = gmdate('Y-m-d H:i:s');
|
78 |
+
$mass_unsubscribe_subscribers = false;
|
79 |
+
if ($action_name == 'massUnsubscribe') {
|
80 |
+
if (Mage::app()->getRequest()->getParam('subscriber')) {
|
81 |
+
$mass_unsubscribe_subscribers = true;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
if ($mass_unsubscribe_subscribers) {
|
85 |
+
$this->userInsertSdUpdatesIfNecessary($new_email, $new_store_id, 'N', 'U', $now);
|
86 |
+
} else {
|
87 |
+
if (isset($data['subscriber_id'])) {
|
88 |
+
$resource = Mage::getSingleton('core/resource');
|
89 |
+
$db_read = $resource->getConnection('core_read');
|
90 |
+
$newsletter_subscriber = $resource->getTableName('newsletter_subscriber');
|
91 |
+
$rq_sql = '
|
92 |
+
SELECT `subscriber_email`, `store_id`, `subscriber_status`
|
93 |
+
FROM `' . $newsletter_subscriber . '`
|
94 |
+
WHERE `subscriber_id` = ' . (int)$data['subscriber_id'];
|
95 |
+
$rq = $db_read->query($rq_sql);
|
96 |
+
while ($r = $rq->fetch()) {
|
97 |
+
$old_email = $r['subscriber_email'];
|
98 |
+
$old_store_id = $r['store_id'];
|
99 |
+
$old_status = $r['subscriber_status'];
|
100 |
+
if ($old_email != $new_email || $old_store_id != $new_store_id) {
|
101 |
+
if ($old_status == '1') {
|
102 |
+
$this->userInsertSdUpdatesIfNecessary($old_email, $old_store_id, 'N', 'U', $now);
|
103 |
+
}
|
104 |
+
} else {
|
105 |
+
if ($old_status == '1' && $new_status == '3') {
|
106 |
+
$this->userInsertSdUpdatesIfNecessary($new_email, $new_store_id, 'N', 'U', $now);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if ($new_status == '1') {
|
112 |
+
$this->userInsertSdUpdatesIfNecessary($new_email, $new_store_id, 'N', 'S', $now);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
catch(Exception $e) {}
|
120 |
+
}
|
121 |
+
|
122 |
+
public function newsletterSubscriberDelete(Varien_Event_Observer $observer)
|
123 |
+
{
|
124 |
+
try {
|
125 |
+
$data = $observer->getSubscriber()->getData();
|
126 |
+
if (isset($data['subscriber_email']) && isset($data['store_id']) && isset($data['subscriber_status'])) {
|
127 |
+
$subscriber_email = $data['subscriber_email'];
|
128 |
+
$store_id = $data['store_id'];
|
129 |
+
$subscriber_status = $data['subscriber_status'];
|
130 |
+
if ($subscriber_status == '1') {
|
131 |
+
$now = gmdate('Y-m-d H:i:s');
|
132 |
+
$this->userInsertSdUpdatesIfNecessary($subscriber_email, $store_id, 'N', 'U', $now);
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
catch(Exception $e) {}
|
137 |
+
}
|
138 |
+
|
139 |
+
private function userInsertSdUpdatesIfNecessary($email, $store_id, $list_type, $action, $now)
|
140 |
+
{
|
141 |
+
if (Mage::helper('sarbacanedesktop')->checkNeedUserInsertSdUpdates($store_id, $list_type)) {
|
142 |
+
$resource = Mage::getSingleton('core/resource');
|
143 |
+
$db_write = $resource->getConnection('core_write');
|
144 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
145 |
+
$rq_sql = '
|
146 |
+
INSERT INTO `' . $sd_updates . '` VALUES
|
147 |
+
(' . $db_write->quote($email) . ', ' . (int)$store_id . ', ' . $db_write->quote($list_type) . ', ' . $db_write->quote($action) . ', ' . $db_write->quote($now) . ')
|
148 |
+
ON DUPLICATE KEY UPDATE
|
149 |
+
`action` = VALUES(`action`),
|
150 |
+
`update_date` = VALUES(`update_date`)';
|
151 |
+
$db_write->query($rq_sql);
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
app/code/community/Sarbacane/Sarbacanedesktop/controllers/Adminhtml/SarbacanedesktopController.php
CHANGED
@@ -18,103 +18,127 @@
|
|
18 |
* @copyright 2015 Sarbacane Software
|
19 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
*/
|
21 |
-
|
22 |
class Sarbacane_Sarbacanedesktop_Adminhtml_SarbacanedesktopController extends Mage_Adminhtml_Controller_Action
|
23 |
{
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
}
|
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_Adminhtml_SarbacanedesktopController extends Mage_Adminhtml_Controller_Action
|
22 |
{
|
23 |
|
24 |
+
protected function _isAllowed()
|
25 |
+
{
|
26 |
+
return Mage::getSingleton('admin/session')->isAllowed('newsletter/sarbacanedesktop');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function indexAction()
|
30 |
+
{
|
31 |
+
$general_configuration = Mage::helper('sarbacanedesktop')->getConfiguration('nb_configured');
|
32 |
+
$displayed_step = 1;
|
33 |
+
if ($general_configuration == 1) {
|
34 |
+
$displayed_step = 2;
|
35 |
+
} else if ($general_configuration == 2 || $general_configuration == 3) {
|
36 |
+
$displayed_step = 3;
|
37 |
+
}
|
38 |
+
if (Mage::app()->getRequest()->getParam('submit_is_user')) {
|
39 |
+
$this->saveSdIsUser();
|
40 |
+
$general_configuration = Mage::helper('sarbacanedesktop')->getConfiguration('nb_configured');
|
41 |
+
$displayed_step = 2;
|
42 |
+
} else if (Mage::app()->getRequest()->getParam('submit_configuration')) {
|
43 |
+
$this->saveListConfiguration();
|
44 |
+
if (Mage::helper('sarbacanedesktop')->getConfiguration('sd_token') == '') {
|
45 |
+
$this->saveTokenParameterConfiguration();
|
46 |
+
}
|
47 |
+
$general_configuration = Mage::helper('sarbacanedesktop')->getConfiguration('nb_configured');
|
48 |
+
$displayed_step = 3;
|
49 |
+
} else if (Mage::app()->getRequest()->getParam('submit_parameter_key')) {
|
50 |
+
$this->saveTokenParameterConfiguration();
|
51 |
+
}
|
52 |
+
$this->loadLayout();
|
53 |
+
$block = $this->getLayout()->getBlock('sarbacanedesktop');
|
54 |
+
$block->setSdFormKey($this->getSdFormKey());
|
55 |
+
$block->setKeyForSynchronisation($this->getKeyForSynchronisation());
|
56 |
+
$block->setCheckFailed(Mage::helper('sarbacanedesktop')->checkFailed());
|
57 |
+
$block->setListConfiguration(Mage::helper('sarbacanedesktop')->getListConfiguration('array'));
|
58 |
+
$block->setGeneralConfiguration($general_configuration);
|
59 |
+
$block->setSdIsUser(Mage::helper('sarbacanedesktop')->getConfiguration('sd_is_user'));
|
60 |
+
$block->setDisplayedStep($displayed_step);
|
61 |
+
$block->setShopsArray(Mage::helper('sarbacanedesktop')->getShopsArray());
|
62 |
+
$this->_title($this->__('Sarbacane Desktop'));
|
63 |
+
$this->_setActiveMenu('newsletter');
|
64 |
+
$this->renderLayout();
|
65 |
+
}
|
66 |
+
|
67 |
+
private function saveSdIsUser()
|
68 |
+
{
|
69 |
+
if (Mage::app()->getRequest()->getParam('sd_is_user')) {
|
70 |
+
$sd_is_user = Mage::app()->getRequest()->getParam('sd_is_user');
|
71 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_is_user', $sd_is_user);
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
private function saveTokenParameterConfiguration()
|
76 |
+
{
|
77 |
+
$resource = Mage::getSingleton('core/resource');
|
78 |
+
$db_write = $resource->getConnection('core_write');
|
79 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
80 |
+
$sd_users = $resource->getTableName('sd_users');
|
81 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_nb_failed', '');
|
82 |
+
$rq_sql = 'TRUNCATE `' . $sd_updates . '`';
|
83 |
+
$db_write->query($rq_sql);
|
84 |
+
$rq_sql = 'TRUNCATE `' . $sd_users . '`';
|
85 |
+
$db_write->query($rq_sql);
|
86 |
+
$token_parameter = rand(100000, 999999) . time() . '-';
|
87 |
+
$characters = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
88 |
+
$nb_characters = strlen($characters);
|
89 |
+
for ($i = 0; $i < 30; $i++) {
|
90 |
+
$token_parameter .= substr($characters, mt_rand(0, $nb_characters - 1), 1);
|
91 |
+
}
|
92 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_token', $token_parameter);
|
93 |
+
}
|
94 |
+
|
95 |
+
private function getKeyForSynchronisation()
|
96 |
+
{
|
97 |
+
return str_rot13('sarbacanedesktop?stk=' . Mage::helper('sarbacanedesktop')->getToken());
|
98 |
+
}
|
99 |
+
|
100 |
+
private function saveListConfiguration()
|
101 |
+
{
|
102 |
+
$shops = '';
|
103 |
+
if (Mage::app()->getRequest()->getParam('store_id')) {
|
104 |
+
$stores_id = Mage::app()->getRequest()->getParam('store_id');
|
105 |
+
if (is_array($stores_id)) {
|
106 |
+
$sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
|
107 |
+
foreach ($sd_list_array as $sd_list) {
|
108 |
+
if ( ! in_array($sd_list, $stores_id)) {
|
109 |
+
$store_id = Mage::helper('sarbacanedesktop')->getIdShopFromList($sd_list);
|
110 |
+
$list_type = Mage::helper('sarbacanedesktop')->getListTypeFromList($sd_list);
|
111 |
+
$this->deleteListData($list_type, $store_id);
|
112 |
+
}
|
113 |
+
}
|
114 |
+
$shops = implode(',', $stores_id);
|
115 |
+
}
|
116 |
+
}
|
117 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_list', $shops);
|
118 |
+
}
|
119 |
|
120 |
+
private function deleteListData($list_type, $store_id)
|
121 |
+
{
|
122 |
+
$resource = Mage::getSingleton('core/resource');
|
123 |
+
$db_write = $resource->getConnection('core_write');
|
124 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
125 |
+
$sd_users = $resource->getTableName('sd_users');
|
126 |
+
$rq_sql = '
|
127 |
+
DELETE
|
128 |
+
FROM `' . $sd_updates . '`
|
129 |
+
WHERE `store_id` = ' . (int)$store_id . '
|
130 |
+
AND `list_type` = ' . $db_write->quote($list_type);
|
131 |
+
$db_write->query($rq_sql);
|
132 |
+
$rq_sql = '
|
133 |
+
DELETE
|
134 |
+
FROM `' . $sd_users . '`
|
135 |
+
WHERE `list_id` = ' . $db_write->quote($store_id . $list_type);
|
136 |
+
$db_write->query($rq_sql);
|
137 |
+
}
|
138 |
|
139 |
+
private function getSdFormKey()
|
140 |
+
{
|
141 |
+
return substr(Mage::helper('core')->encrypt('SarbacaneDesktopForm'), 0, 15);
|
142 |
+
}
|
143 |
|
144 |
+
}
|
app/code/community/Sarbacane/Sarbacanedesktop/controllers/IndexController.php
CHANGED
@@ -18,353 +18,502 @@
|
|
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 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
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 |
-
|
214 |
-
|
215 |
-
|
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 |
-
SELECT
|
259 |
-
sfo.customer_email AS email, sfo.customer_lastname AS lastname,sfo.customer_firstname AS firstname,
|
260 |
-
MAX(sfo.base_grand_total) AS amount_max_order,
|
261 |
-
MIN(sfo.base_grand_total) AS amount_min_order,
|
262 |
-
AVG(sfo.base_grand_total) AS amount_avg_order,
|
263 |
-
MIN(sfo.created_at) AS date_first_order,
|
264 |
-
MAX(sfo.created_at) AS date_last_order,
|
265 |
-
COUNT(sfo.entity_id) AS nb_orders,
|
266 |
-
SUM(sfo.base_grand_total) AS amount_all_orders,
|
267 |
-
(SELECT
|
268 |
-
ccev.value AS category
|
269 |
-
FROM
|
270 |
-
$sales_flat_order AS sfo2
|
271 |
-
LEFT JOIN
|
272 |
-
$sales_flat_order_item AS sfoi ON sfo2.entity_id = sfoi.order_id
|
273 |
-
LEFT JOIN
|
274 |
-
$catalog_category_product AS ccp ON ccp.product_id = sfoi.product_id
|
275 |
-
LEFT JOIN
|
276 |
-
$catalog_category_entity_varchar AS ccev ON ccev.entity_id = ccp.category_id
|
277 |
-
AND ccev.attribute_id = 41
|
278 |
-
AND ccev.entity_type_id = 3
|
279 |
-
WHERE sfo2.customer_email = sfo.customer_email AND sfo2.customer_is_guest = 1 AND sfo2.store_id = sfo.store_id
|
280 |
-
GROUP BY category
|
281 |
-
ORDER BY SUM(sfoi.row_total) DESC
|
282 |
-
LIMIT 1) AS most_profitable_category
|
283 |
-
FROM
|
284 |
-
$sales_flat_order AS sfo
|
285 |
-
WHERE sfo.customer_is_guest = 1 AND sfo.store_id = " . $store_id;
|
286 |
-
if ($last_call_date != null && $last_call_date != '') {
|
287 |
-
$rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
|
288 |
-
}
|
289 |
-
$rq_sql .= " GROUP BY sfo.customer_email)";
|
290 |
-
} else {
|
291 |
-
$rq_sql = " SELECT t.email, t.lastname, t.firstname ";
|
292 |
-
$rq_sql .= " FROM ( SELECT c.email AS email,cevln.value AS lastname, cevfn.value AS firstname ";
|
293 |
-
$rq_sql .= " FROM $customer_entity c LEFT JOIN $customer_entity_varchar cevln ON cevln.entity_id = c.entity_id AND cevln.attribute_id=7
|
294 |
-
LEFT JOIN $customer_entity_varchar cevfn ON cevfn.entity_id = c.entity_id AND cevfn.attribute_id = 5";
|
295 |
-
$rq_sql .= " WHERE c.store_id = " . $store_id;
|
296 |
-
if ($last_call_date != null && $last_call_date != '') {
|
297 |
-
$rq_sql .= " AND (c.created_at > '" . $last_call_date . "' OR c.updated_at > '" . $last_call_date . "')";
|
298 |
-
}
|
299 |
-
$rq_sql .= " GROUP BY c.email
|
300 |
-
UNION
|
301 |
-
SELECT sfo.customer_email AS email ,sfo.customer_lastname as lastname, sfo.customer_firstname as firstname";
|
302 |
-
$rq_sql .= " FROM $sales_flat_order sfo ";
|
303 |
-
$rq_sql .= " WHERE sfo.customer_id IS NULL AND sfo.store_id = " . $store_id;
|
304 |
-
if ($last_call_date != null && $last_call_date != '') {
|
305 |
-
$rq_sql .= " AND (sfo.created_at > '" . $last_call_date . "' OR sfo.updated_at > '" . $last_call_date . "') ";
|
306 |
-
}
|
307 |
-
$rq_sql .= " GROUP BY email ";
|
308 |
-
|
309 |
-
$rq_sql .= " ) as t ";
|
310 |
-
$rq_sql .= " GROUP BY t.email;";
|
311 |
-
}
|
312 |
-
} else {
|
313 |
-
return;
|
314 |
-
}
|
315 |
-
if ($type_action == 'is_updated') {
|
316 |
-
$rq_sql .= ' LIMIT 0, 1 ';
|
317 |
-
$rq = $db_read->fetchAll ( $rq_sql );
|
318 |
-
return count ( $rq );
|
319 |
-
} else {
|
320 |
-
$rq = $db_read->query ( $rq_sql );
|
321 |
-
while ( $r = $rq->fetch () ) {
|
322 |
-
$line = $this->dQuote ( $r ['email'] ) . ';'; // TEST
|
323 |
-
$line .= $this->dQuote ( $r ['lastname'] ) . ';' . $this->dQuote ( $r ['firstname'] );
|
324 |
-
if ($list_type == 'C') {
|
325 |
-
if ($add_customer_data) {
|
326 |
-
$line .= ';' . $this->dQuote ( $r ['date_first_order'] ) . ';' . $this->dQuote ( $r ['date_last_order'] );
|
327 |
-
$line .= ';' . ( float ) $r ['amount_min_order'] . ';' . ( float ) $r ['amount_max_order'] . ';' . ( float ) $r ['amount_avg_order'];
|
328 |
-
$line .= ';' . $r ['nb_orders'] . ';' . ( float ) $r ['amount_all_orders'] . ';' . $r ['category'];
|
329 |
-
}
|
330 |
-
}
|
331 |
-
$line .= ';S'."\r\n";
|
332 |
-
echo $line;
|
333 |
-
}
|
334 |
-
}
|
335 |
-
}
|
336 |
-
private function processNewUnsubscribers($list_type, $store_id, $sd_id, $type_action = 'display', $last_call_date) {
|
337 |
-
$resource = Mage::getSingleton ( 'core/resource' );
|
338 |
-
$db_read = $resource->getConnection ( 'core_read' );
|
339 |
-
|
340 |
-
$sd_updates = $resource->getTableName ( 'sd_updates' );
|
341 |
-
|
342 |
-
switch ($list_type) {
|
343 |
-
case 'N' :
|
344 |
-
case 'C' :
|
345 |
-
$rq_sql = 'SELECT email FROM ' . $sd_updates . ' WHERE list_type="' . $list_type . '" AND action = "U"';
|
346 |
-
if ($last_call_date != null && $last_call_date != '') {
|
347 |
-
$rq_sql .= ' AND update_time > "' . $last_call_date . '"';
|
348 |
-
}
|
349 |
-
break;
|
350 |
-
default :
|
351 |
-
return;
|
352 |
-
}
|
353 |
-
if ($type_action == 'is_updated') {
|
354 |
-
$rq = $db_read->fetchAll ( $rq_sql );
|
355 |
-
return count ( $rq );
|
356 |
-
} else {
|
357 |
-
$rq = $db_read->query ( $rq_sql );
|
358 |
-
while ( $r = $rq->fetch () ) {
|
359 |
-
$line = $this->dQuote ( $r ['email'] ) . ';;'; // TEST
|
360 |
-
if ($list_type == 'C') {
|
361 |
-
if ($this->checkIfListWithCustomerData ( $list_type, $store_id )) {
|
362 |
-
$line .= ';;;;;;;;';
|
363 |
-
}
|
364 |
-
}
|
365 |
-
$line .= ';U' . "\r\n";
|
366 |
-
echo $line;
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
}
|
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 |
+
{
|
23 |
+
|
24 |
+
public function indexAction()
|
25 |
+
{
|
26 |
+
if (Mage::app()->getRequest()->getParam('stk') && Mage::app()->getRequest()->getParam('sdid')) {
|
27 |
+
$sdid = Mage::app()->getRequest()->getParam('sdid');
|
28 |
+
$stk = Mage::helper('sarbacanedesktop')->getToken();
|
29 |
+
if (Mage::app()->getRequest()->getParam('stk') == $stk && strlen($stk) > 30 && ! Mage::helper('sarbacanedesktop')->checkFailed()) {
|
30 |
+
if ($sdid != '' && Mage::helper('sarbacanedesktop')->getConfiguration('nb_configured') == 3) {
|
31 |
+
header('Content-type: text/plain; charset=utf-8');
|
32 |
+
$configuration = Mage::helper('sarbacanedesktop')->getConfiguration('all');
|
33 |
+
if ($configuration['sd_token'] != '' && $configuration['sd_list'] != '' && $configuration['sd_is_user'] != '') {
|
34 |
+
$sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
|
35 |
+
if (is_array($sd_list_array) && count($sd_list_array) > 0) {
|
36 |
+
if (Mage::app()->getRequest()->getParam('list')) {
|
37 |
+
$list = Mage::app()->getRequest()->getParam('list');
|
38 |
+
$store_id = Mage::helper('sarbacanedesktop')->getIdShopFromList($list);
|
39 |
+
$list_type = Mage::helper('sarbacanedesktop')->getListTypeFromList($list);
|
40 |
+
$list_type_array = Mage::helper('sarbacanedesktop')->getListTypeArray();
|
41 |
+
if (in_array($list_type, $list_type_array)) {
|
42 |
+
if (($list_type == 'N' && in_array($list . '0', $sd_list_array))
|
43 |
+
|| ($list_type == 'C' && (in_array($list . '0', $sd_list_array) || in_array($list . '1', $sd_list_array)))) {
|
44 |
+
$now = gmdate('Y-m-d H:i:s');
|
45 |
+
$this->processNewUnsubcribersAndSubscribers($list_type, $store_id, $sdid);
|
46 |
+
$this->saveSdid($sdid, $list, $now);
|
47 |
+
$this->clearHistory($list_type, $store_id);
|
48 |
+
} else {
|
49 |
+
header('HTTP/1.1 404 Not found');
|
50 |
+
die('FAILED_ID');
|
51 |
+
}
|
52 |
+
} else {
|
53 |
+
header('HTTP/1.1 404 Not found');
|
54 |
+
die('FAILED_ID');
|
55 |
+
}
|
56 |
+
} else {
|
57 |
+
if (Mage::app()->getRequest()->getParam('action') == 'reset') {
|
58 |
+
Mage::helper('sarbacanedesktop')->deleteSdid($sdid);
|
59 |
+
} else {
|
60 |
+
$this->setDataToUpdate();
|
61 |
+
$this->getFormattedContentShops($sdid);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
} else {
|
68 |
+
$this->updateFailed();
|
69 |
+
header("HTTP/1.1 403 Unauthorized");
|
70 |
+
die('FAILED_SDTOKEN');
|
71 |
+
}
|
72 |
+
die;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
private function saveSdid($sd_id, $list, $now)
|
77 |
+
{
|
78 |
+
$resource = Mage::getSingleton('core/resource');
|
79 |
+
$db_write = $resource->getConnection('core_write');
|
80 |
+
$sd_users = $resource->getTableName('sd_users');
|
81 |
+
$rq_sql = '
|
82 |
+
INSERT INTO `' . $sd_users . '` VALUES
|
83 |
+
(' . $db_write->quote($sd_id) . ', ' . $db_write->quote($list) . ', ' . $db_write->quote($now) . ')
|
84 |
+
ON DUPLICATE KEY UPDATE
|
85 |
+
`last_call_date` = VALUES(`last_call_date`)';
|
86 |
+
$db_write->query($rq_sql);
|
87 |
+
}
|
88 |
+
|
89 |
+
private function updateFailed() {
|
90 |
+
if ( ! Mage::helper('sarbacanedesktop')->checkFailed()) {
|
91 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_nb_failed', Mage::helper('sarbacanedesktop')->getConfiguration('sd_nb_failed') + 1);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
private function setDataToUpdate()
|
96 |
+
{
|
97 |
+
$resource = Mage::getSingleton('core/resource');
|
98 |
+
$db_write = $resource->getConnection('core_write');
|
99 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
100 |
+
$sales_flat_order = $resource->getTableName('sales_flat_order');
|
101 |
+
$customer_entity = $resource->getTableName('customer_entity');
|
102 |
+
$now = gmdate('Y-m-d H:i:s');
|
103 |
+
if (count(Mage::helper('sarbacanedesktop')->getSynchronizedListsArray() > 0)) {
|
104 |
+
$sd_last_update = Mage::helper('sarbacanedesktop')->getConfiguration('sd_last_update');
|
105 |
+
if ($sd_last_update != '') {
|
106 |
+
$sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
|
107 |
+
if (count($sd_list_array) > 0) {
|
108 |
+
$id_shops_customer_array = array();
|
109 |
+
foreach ($sd_list_array as $sd_list) {
|
110 |
+
$store_id = substr($sd_list, 0, -2);
|
111 |
+
if (strpos($sd_list, 'C') !== false) {
|
112 |
+
if (Mage::helper('sarbacanedesktop')->checkNeedUserInsertSdUpdates($store_id, 'C')) {
|
113 |
+
$id_shops_customer_array[] = (int)$store_id;
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
if (count($id_shops_customer_array) > 0) {
|
118 |
+
$id_shops_customer = implode(', ', $id_shops_customer_array);
|
119 |
+
for ($i = 0; $i < 2; $i++) {
|
120 |
+
if ($i == 0) {
|
121 |
+
$rq_sql_action = 'S';
|
122 |
+
$rq_sql_where = '`is_active` = 1';
|
123 |
+
} else {
|
124 |
+
$rq_sql_action = 'U';
|
125 |
+
$rq_sql_where = '`is_active` = 0';
|
126 |
+
}
|
127 |
+
$rq_sql = '
|
128 |
+
INSERT INTO `' . $sd_updates . '`
|
129 |
+
SELECT `email`, `store_id`, \'C\' AS `list_type`, \'' . $rq_sql_action . '\' AS `action`, ' . $db_write->quote($now) . ' AS `update_date`
|
130 |
+
FROM `' . $customer_entity . '`
|
131 |
+
WHERE `updated_at` >= ' . $db_write->quote($sd_last_update) . '
|
132 |
+
AND `updated_at` < ' . $db_write->quote($now) . '
|
133 |
+
AND `store_id` IN (' . $id_shops_customer . ')
|
134 |
+
AND `website_id` != 0
|
135 |
+
AND ' . $rq_sql_where . '
|
136 |
+
ON DUPLICATE KEY UPDATE
|
137 |
+
`action` = VALUES(`action`),
|
138 |
+
`update_date` = VALUES(`update_date`)';
|
139 |
+
$db_write->query($rq_sql);
|
140 |
+
}
|
141 |
+
$rq_sql = '
|
142 |
+
INSERT INTO `' . $sd_updates . '`
|
143 |
+
SELECT IFNULL(`c`.`email`, `sfo`.`customer_email`) AS `email`, `sfo`.`store_id`, \'C\' AS `list_type`, \'S\' AS `action`, ' . $db_write->quote($now) . ' AS `update_date`
|
144 |
+
FROM `' . $sales_flat_order . '` AS `sfo`
|
145 |
+
LEFT JOIN `' . $customer_entity . '` AS `c`
|
146 |
+
ON `c`.`entity_id` = `sfo`.`customer_id`
|
147 |
+
AND `c`.`store_id` = `sfo`.`store_id`
|
148 |
+
AND `c`.`website_id` != 0
|
149 |
+
WHERE `sfo`.`updated_at` >= ' . $db_write->quote($sd_last_update) . '
|
150 |
+
AND `sfo`.`updated_at` < ' . $db_write->quote($now) . '
|
151 |
+
AND `sfo`.`store_id` IN (' . $id_shops_customer . ')
|
152 |
+
ON DUPLICATE KEY UPDATE
|
153 |
+
`action` = VALUES(`action`),
|
154 |
+
`update_date` = VALUES(`update_date`)';
|
155 |
+
$db_write->query($rq_sql);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
Mage::helper('sarbacanedesktop')->updateConfiguration('sd_last_update', $now);
|
161 |
+
}
|
162 |
+
|
163 |
+
private function processNewUnsubcribersAndSubscribers($list_type, $store_id, $sd_id)
|
164 |
+
{
|
165 |
+
$resource = Mage::getSingleton('core/resource');
|
166 |
+
$db_read = $resource->getConnection('core_read');
|
167 |
+
$sd_users = $resource->getTableName('sd_users');
|
168 |
+
$rq_sql = '
|
169 |
+
SELECT `last_call_date`
|
170 |
+
FROM `' . $sd_users . '`
|
171 |
+
WHERE `sd_id` = ' . $db_read->quote($sd_id) . '
|
172 |
+
AND `list_id` = ' . $db_read->quote($store_id . $list_type);
|
173 |
+
$last_call_date = $db_read->fetchOne($rq_sql);
|
174 |
+
if ($last_call_date == null || $last_call_date == '') {
|
175 |
+
$last_call_date = false;
|
176 |
+
}
|
177 |
+
$line = 'email;lastname;firstname';
|
178 |
+
if ($list_type == 'C') {
|
179 |
+
if ($this->checkIfListWithCustomerData('C', $store_id)) {
|
180 |
+
$line .= ';date_first_order;date_last_order;amount_min_order;amount_max_order;amount_avg_order;nb_orders;amount_all_orders';
|
181 |
+
}
|
182 |
+
}
|
183 |
+
$line .= ';action' . "\n";
|
184 |
+
echo $line;
|
185 |
+
$this->processNewUnsubscribers($list_type, $store_id, $last_call_date, 'display');
|
186 |
+
$this->processNewSubscribers($list_type, $store_id, $last_call_date, 'display');
|
187 |
+
}
|
188 |
+
|
189 |
+
private function checkIfListWithCustomerData($list_type, $store_id)
|
190 |
+
{
|
191 |
+
$sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
|
192 |
+
if (in_array($store_id . $list_type . '1', $sd_list_array)) {
|
193 |
+
return true;
|
194 |
+
}
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
|
198 |
+
private function getFormattedContentShops($sd_id)
|
199 |
+
{
|
200 |
+
$shops = Mage::helper('sarbacanedesktop')->getShopsArray();
|
201 |
+
echo 'list_id;name;reset;is_updated;type;version' . "\n";
|
202 |
+
$sd_list_array = Mage::helper('sarbacanedesktop')->getListConfiguration('array');
|
203 |
+
foreach ($sd_list_array as $list) {
|
204 |
+
foreach ($shops as $shop) {
|
205 |
+
$store_id = Mage::helper('sarbacanedesktop')->getIdShopFromList($list);
|
206 |
+
$list_type = Mage::helper('sarbacanedesktop')->getListTypeFromList($list);
|
207 |
+
if ($shop['store_id'] == $store_id) {
|
208 |
+
$shop_list = $store_id . $list_type . ';' . $this->dQuote($shop['name']) . ';';
|
209 |
+
$shop_list .= $this->listStatus($store_id, $list_type, $sd_id) . ';';
|
210 |
+
$shop_list .= 'Magento;1.0.0.8' . "\n";//
|
211 |
+
echo $shop_list;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
private function listStatus($store_id, $list_type, $sd_id)
|
218 |
+
{
|
219 |
+
$resource = Mage::getSingleton('core/resource');
|
220 |
+
$db_read = $resource->getConnection('core_read');
|
221 |
+
$sd_users = $resource->getTableName('sd_users');
|
222 |
+
$list_is_resetted = 'Y';
|
223 |
+
$list_is_updated = 'N';
|
224 |
+
$last_call_date = false;
|
225 |
+
if ( ! isset($this->sd_used_lists)) {
|
226 |
+
$rq_sql = '
|
227 |
+
SELECT `sd_id`, `list_id`, `last_call_date`
|
228 |
+
FROM `' . $sd_users . '`';
|
229 |
+
$this->sd_used_lists = $db_read->fetchAll($rq_sql);
|
230 |
+
}
|
231 |
+
if (is_array($this->sd_used_lists)) {
|
232 |
+
foreach ($this->sd_used_lists as $r) {
|
233 |
+
if ($r['sd_id'] == $sd_id && $r['list_id'] == $store_id . $list_type) {
|
234 |
+
$list_is_resetted = 'N';
|
235 |
+
$last_call_date = $r['last_call_date'];
|
236 |
+
if ($last_call_date == null || $last_call_date == '') {
|
237 |
+
$last_call_date = false;
|
238 |
+
}
|
239 |
+
break;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
if ($this->processNewUnsubscribers($list_type, $store_id, $last_call_date, 'is_updated') > 0) {
|
244 |
+
$list_is_updated = 'Y';
|
245 |
+
} else if ($this->processNewSubscribers($list_type, $store_id, $last_call_date, 'is_updated') > 0) {
|
246 |
+
$list_is_updated = 'Y';
|
247 |
+
}
|
248 |
+
return $list_is_resetted . ';' . $list_is_updated;
|
249 |
+
}
|
250 |
+
|
251 |
+
private function dQuote($value)
|
252 |
+
{
|
253 |
+
$value = str_replace('"', '""', $value);
|
254 |
+
if (strpos($value, ' ') !== false || strpos($value, ';') !== false) {
|
255 |
+
$value = '"' . $value . '"';
|
256 |
+
}
|
257 |
+
return $value;
|
258 |
+
}
|
259 |
+
|
260 |
+
private function processNewSubscribers($list_type, $store_id, $last_call_date, $type_action = 'display')
|
261 |
+
{
|
262 |
+
$resource = Mage::getSingleton('core/resource');
|
263 |
+
$db_read = $resource->getConnection('core_read');
|
264 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
265 |
+
$newsletter_subscriber = $resource->getTableName('newsletter_subscriber');
|
266 |
+
$sales_flat_order = $resource->getTableName('sales_flat_order');
|
267 |
+
$customer_entity = $resource->getTableName('customer_entity');
|
268 |
+
$customer_entity_varchar = $resource->getTableName('customer_entity_varchar');
|
269 |
+
$attr_firstname = Mage::getModel('customer/customer')->getAttribute('firstname')->getAttributeId();
|
270 |
+
$attr_lastname = Mage::getModel('customer/customer')->getAttribute('lastname')->getAttributeId();
|
271 |
+
if ($list_type == 'N') {
|
272 |
+
$rq_sql_select = '
|
273 |
+
SELECT `ns`.`subscriber_email` AS `email`,
|
274 |
+
IFNULL(`lastname`.`value`, SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_lastname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1)) AS `lastname`,
|
275 |
+
IFNULL(`firstname`.`value`, SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_firstname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1)) AS `firstname`';
|
276 |
+
$rq_sql_from = '
|
277 |
+
LEFT JOIN `' . $customer_entity . '` AS `c`
|
278 |
+
ON `c`.`email` = `ns`.`subscriber_email`
|
279 |
+
AND `c`.`store_id` = `ns`.`store_id`
|
280 |
+
AND `c`.`website_id` != 0
|
281 |
+
LEFT JOIN `' . $customer_entity_varchar . '` AS `lastname`
|
282 |
+
ON `lastname`.`entity_id` = `c`.`entity_id`
|
283 |
+
AND `lastname`.`attribute_id` = ' . (int)$attr_lastname . '
|
284 |
+
LEFT JOIN `' . $customer_entity_varchar . '` AS `firstname`
|
285 |
+
ON `firstname`.`entity_id` = `c`.`entity_id`
|
286 |
+
AND `firstname`.`attribute_id` = ' . (int)$attr_firstname . '
|
287 |
+
LEFT JOIN `' . $sales_flat_order . '` AS `sfo`
|
288 |
+
ON `sfo`.`customer_email` = `ns`.`subscriber_email`
|
289 |
+
AND `sfo`.`store_id` = `ns`.`store_id`';
|
290 |
+
$rq_sql_group_by = '
|
291 |
+
GROUP BY `ns`.`subscriber_email`';
|
292 |
+
if ( ! $last_call_date) {
|
293 |
+
$rq_sql =
|
294 |
+
$rq_sql_select . '
|
295 |
+
FROM `' . $newsletter_subscriber . '` AS `ns`
|
296 |
+
' . $rq_sql_from . '
|
297 |
+
WHERE `ns`.`subscriber_status` = 1
|
298 |
+
AND `ns`.`store_id` = ' . (int)$store_id .
|
299 |
+
$rq_sql_group_by;
|
300 |
+
} else {
|
301 |
+
$rq_sql =
|
302 |
+
$rq_sql_select . '
|
303 |
+
FROM `' . $sd_updates . '` AS `s`
|
304 |
+
INNER JOIN `' . $newsletter_subscriber . '` AS `ns`
|
305 |
+
ON `ns`.`subscriber_email` = `s`.`email`
|
306 |
+
AND `ns`.`store_id` = `s`.`store_id`
|
307 |
+
AND `ns`.`subscriber_status` = 1
|
308 |
+
' . $rq_sql_from . '
|
309 |
+
WHERE `s`.`update_date` >= ' . $db_read->quote($last_call_date) . '
|
310 |
+
AND `s`.`list_type` = \'N\'
|
311 |
+
AND `s`.`store_id` = ' . (int)$store_id .
|
312 |
+
$rq_sql_group_by;
|
313 |
+
}
|
314 |
+
} else if ($list_type == 'C') {
|
315 |
+
$add_customer_data = $this->checkIfListWithCustomerData('C', $store_id);
|
316 |
+
if ($add_customer_data) {
|
317 |
+
$rq_sql_select = '
|
318 |
+
SELECT `t`.`email`, `t`.`lastname`, `t`.`firstname`,
|
319 |
+
MIN(`t`.`date_first_order`) AS `date_first_order`, MAX(`t`.`date_last_order`) AS `date_last_order`,
|
320 |
+
MIN(`t`.`amount_min_order`) AS `amount_min_order`, MAX(`t`.`amount_max_order`) AS `amount_max_order`,
|
321 |
+
ROUND(SUM(`t`.`amount_all_orders`)/SUM(`t`.`nb_orders`), 6) AS `amount_avg_order`, SUM(`t`.`nb_orders`) AS `nb_orders`,
|
322 |
+
SUM(`t`.`amount_all_orders`) AS `amount_all_orders`
|
323 |
+
FROM
|
324 |
+
(';
|
325 |
+
$rq_sql_select_table_1 = '
|
326 |
+
SELECT `c`.`email`, `lastname`.`value` AS `lastname`, `firstname`.`value` AS `firstname`,
|
327 |
+
MIN(`sfo`.`created_at`) AS `date_first_order`, MAX(`sfo`.`created_at`) AS `date_last_order`,
|
328 |
+
MIN(`sfo`.`base_grand_total`) AS `amount_min_order`, MAX(`sfo`.`base_grand_total`) AS `amount_max_order`,
|
329 |
+
COUNT(`sfo`.`created_at`) AS `nb_orders`, SUM(`sfo`.`base_grand_total`) AS `amount_all_orders`';
|
330 |
+
$rq_sql_select_table_2 = '
|
331 |
+
SELECT `sfo`.`customer_email` AS `email`,
|
332 |
+
SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_lastname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1) AS `lastname`,
|
333 |
+
SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_firstname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1) AS `firstname`,
|
334 |
+
MIN(`sfo`.`created_at`) AS `date_first_order`, MAX(`sfo`.`created_at`) AS `date_last_order`,
|
335 |
+
MIN(`sfo`.`base_grand_total`) AS `amount_min_order`, MAX(`sfo`.`base_grand_total`) AS `amount_max_order`,
|
336 |
+
COUNT(`sfo`.`created_at`) AS `nb_orders`, SUM(`sfo`.`base_grand_total`) AS `amount_all_orders`';
|
337 |
+
$rq_sql_from = '
|
338 |
+
INNER JOIN `' . $customer_entity_varchar . '` AS `lastname`
|
339 |
+
ON `lastname`.`entity_id` = `c`.`entity_id`
|
340 |
+
AND `lastname`.`attribute_id` = 7
|
341 |
+
INNER JOIN `' . $customer_entity_varchar . '` AS `firstname`
|
342 |
+
ON `firstname`.`entity_id` = `c`.`entity_id`
|
343 |
+
AND `firstname`.`attribute_id` = 5
|
344 |
+
LEFT JOIN `' . $sales_flat_order . '` AS `sfo`
|
345 |
+
ON `sfo`.`customer_id` = `c`.`entity_id`
|
346 |
+
AND `sfo`.`store_id` = `c`.`store_id`';
|
347 |
+
$rq_sql_group_by = '
|
348 |
+
) AS `t`
|
349 |
+
GROUP BY `t`.`email`';
|
350 |
+
} else {
|
351 |
+
$rq_sql_select = '
|
352 |
+
SELECT `t`.`email`, `t`.`lastname`, `t`.`firstname`
|
353 |
+
FROM
|
354 |
+
(';
|
355 |
+
$rq_sql_select_table_1 = '
|
356 |
+
SELECT `c`.`email`, `lastname`.`value` AS `lastname`, `firstname`.`value` AS `firstname`';
|
357 |
+
$rq_sql_select_table_2 = '
|
358 |
+
SELECT `sfo`.`customer_email` AS `email`,
|
359 |
+
SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_lastname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1) AS `lastname`,
|
360 |
+
SUBSTRING_INDEX(GROUP_CONCAT(`sfo`.`customer_firstname` ORDER BY `sfo`.`updated_at` DESC SEPARATOR \'||\'), \'||\', 1) AS `firstname`';
|
361 |
+
$rq_sql_from = '
|
362 |
+
INNER JOIN `' . $customer_entity_varchar . '` AS `lastname`
|
363 |
+
ON `lastname`.`entity_id` = `c`.`entity_id`
|
364 |
+
AND `lastname`.`attribute_id` = 7
|
365 |
+
INNER JOIN `' . $customer_entity_varchar . '` AS `firstname`
|
366 |
+
ON `firstname`.`entity_id` = `c`.`entity_id`
|
367 |
+
AND `firstname`.`attribute_id` = 5';
|
368 |
+
$rq_sql_group_by = '
|
369 |
+
) AS `t`
|
370 |
+
GROUP BY `t`.`email`';
|
371 |
+
}
|
372 |
+
if ( ! $last_call_date) {
|
373 |
+
$rq_sql =
|
374 |
+
$rq_sql_select . '
|
375 |
+
(
|
376 |
+
' . $rq_sql_select_table_1 . '
|
377 |
+
FROM `' . $customer_entity . '` AS `c`
|
378 |
+
' . $rq_sql_from . '
|
379 |
+
WHERE `c`.`store_id` = ' . (int)$store_id . '
|
380 |
+
AND `c`.`website_id` != 0
|
381 |
+
GROUP BY `c`.`email`
|
382 |
+
)
|
383 |
+
UNION ALL
|
384 |
+
(
|
385 |
+
' . $rq_sql_select_table_2 . '
|
386 |
+
FROM `' . $sales_flat_order . '` AS `sfo`
|
387 |
+
LEFT JOIN `' . $customer_entity . '` AS `c`
|
388 |
+
ON `c`.`entity_id` = `sfo`.`customer_id`
|
389 |
+
AND `c`.`store_id` = `sfo`.`store_id`
|
390 |
+
AND `c`.`website_id` != 0
|
391 |
+
WHERE `c`.`entity_id` IS NULL
|
392 |
+
AND `sfo`.`store_id` = ' . (int)$store_id . '
|
393 |
+
GROUP BY `sfo`.`customer_email`
|
394 |
+
)' .
|
395 |
+
$rq_sql_group_by;
|
396 |
+
} else {
|
397 |
+
$rq_sql =
|
398 |
+
$rq_sql_select . '
|
399 |
+
(
|
400 |
+
' . $rq_sql_select_table_1 . '
|
401 |
+
FROM `' . $sd_updates . '` AS `s`
|
402 |
+
INNER JOIN `' . $customer_entity . '` AS `c`
|
403 |
+
ON `c`.`email` = `s`.`email`
|
404 |
+
AND `c`.`store_id` = `s`.`store_id`
|
405 |
+
AND `c`.`website_id` != 0
|
406 |
+
' . $rq_sql_from . '
|
407 |
+
WHERE `s`.`store_id` = ' . (int)$store_id . '
|
408 |
+
AND `s`.`list_type` = \'C\'
|
409 |
+
AND `s`.`update_date` >= ' . $db_read->quote($last_call_date) . '
|
410 |
+
GROUP BY `c`.`email`
|
411 |
+
)
|
412 |
+
UNION ALL
|
413 |
+
(
|
414 |
+
' . $rq_sql_select_table_2 . '
|
415 |
+
FROM `' . $sd_updates . '` AS `s`
|
416 |
+
INNER JOIN `' . $sales_flat_order . '` AS `sfo`
|
417 |
+
ON `sfo`.`customer_email` = `s`.`email`
|
418 |
+
AND `sfo`.`store_id` = `s`.`store_id`
|
419 |
+
LEFT JOIN `' . $customer_entity . '` AS `c`
|
420 |
+
ON `c`.`entity_id` = `sfo`.`customer_id`
|
421 |
+
AND `c`.`store_id` = `s`.`store_id`
|
422 |
+
AND `c`.`website_id` != 0
|
423 |
+
WHERE `c`.`entity_id` IS NULL
|
424 |
+
AND `s`.`store_id` = ' . (int)$store_id . '
|
425 |
+
AND `s`.`list_type` = \'C\'
|
426 |
+
AND `s`.`update_date` >= ' . $db_read->quote($last_call_date) . '
|
427 |
+
GROUP BY `sfo`.`customer_email`
|
428 |
+
)' .
|
429 |
+
$rq_sql_group_by;
|
430 |
+
}
|
431 |
+
} else {
|
432 |
+
if ($type_action == 'is_updated') {
|
433 |
+
return 0;
|
434 |
+
} else {
|
435 |
+
return;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
$rq = $db_read->query($rq_sql);
|
439 |
+
while ($r = $rq->fetch()) {
|
440 |
+
if ($type_action == 'is_updated') {
|
441 |
+
return 1;
|
442 |
+
}
|
443 |
+
$line = $this->dQuote($r['email']) . ';';
|
444 |
+
$line .= $this->dQuote($r['lastname']) . ';' . $this->dQuote($r['firstname']);
|
445 |
+
if ($list_type == 'C') {
|
446 |
+
if ($add_customer_data) {
|
447 |
+
$line .= ';' . $this->dQuote($r ['date_first_order']) . ';' . $this->dQuote($r['date_last_order']);
|
448 |
+
$line .= ';' . (float)$r['amount_min_order'] . ';' . (float)$r['amount_max_order'] . ';' . (float)$r['amount_avg_order'];
|
449 |
+
$line .= ';' . $r['nb_orders'] . ';' . (float)$r['amount_all_orders'];
|
450 |
+
}
|
451 |
+
}
|
452 |
+
$line .= ';S' . "\n";
|
453 |
+
echo $line;
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
+
private function processNewUnsubscribers($list_type, $store_id, $last_call_date, $type_action = 'display')
|
458 |
+
{
|
459 |
+
$resource = Mage::getSingleton('core/resource');
|
460 |
+
$db_read = $resource->getConnection('core_read');
|
461 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
462 |
+
if ($last_call_date !== false && ($list_type == 'N' || $list_type == 'C')) {
|
463 |
+
$rq_sql = '
|
464 |
+
SELECT `email`
|
465 |
+
FROM `' . $sd_updates . '`
|
466 |
+
WHERE `list_type` = ' . $db_read->quote($list_type) . '
|
467 |
+
AND `store_id` = ' . (int)$store_id . '
|
468 |
+
AND `action` = \'U\'
|
469 |
+
AND `update_date` >= ' . $db_read->quote($last_call_date);
|
470 |
+
$rq = $db_read->query($rq_sql);
|
471 |
+
while ($r = $rq->fetch()) {
|
472 |
+
if ($type_action == 'is_updated') {
|
473 |
+
return 1;
|
474 |
+
}
|
475 |
+
$line = $this->dQuote($r['email']) . ';;';
|
476 |
+
if ($list_type == 'C') {
|
477 |
+
if ($this->checkIfListWithCustomerData('C', $store_id)) {
|
478 |
+
$line .= ';;;;;;;;';
|
479 |
+
}
|
480 |
+
}
|
481 |
+
$line .= ';U' . "\n";
|
482 |
+
echo $line;
|
483 |
+
}
|
484 |
+
}
|
485 |
+
else {
|
486 |
+
if ($type_action == 'is_updated') {
|
487 |
+
return 0;
|
488 |
+
}
|
489 |
+
}
|
490 |
+
}
|
491 |
+
|
492 |
+
private function clearHistory($list_type, $store_id)
|
493 |
+
{
|
494 |
+
$resource = Mage::getSingleton('core/resource');
|
495 |
+
$db_write = $resource->getConnection('core_write');
|
496 |
+
$sd_updates = $resource->getTableName('sd_updates');
|
497 |
+
$sd_users = $resource->getTableName('sd_users');
|
498 |
+
$rq_sql = '
|
499 |
+
DELETE
|
500 |
+
FROM `' . $sd_updates . '`
|
501 |
+
WHERE `store_id` = ' . (int)$store_id . '
|
502 |
+
AND `list_type` = ' . $db_write->quote($list_type) . '
|
503 |
+
AND `update_date` <= (
|
504 |
+
SELECT MIN(`last_call_date`)
|
505 |
+
FROM `' . $sd_users . '`
|
506 |
+
WHERE `list_id` = ' . $db_write->quote($store_id . $list_type) . '
|
507 |
+
)';
|
508 |
+
$db_write->query($rq_sql);
|
509 |
+
$rq_sql = '
|
510 |
+
DELETE
|
511 |
+
FROM `' . $sd_updates . '`
|
512 |
+
WHERE `update_date` <= (
|
513 |
+
SELECT MIN(`last_call_date`)
|
514 |
+
FROM `' . $sd_users . '`
|
515 |
+
)';
|
516 |
+
$db_write->query($rq_sql);
|
517 |
+
}
|
518 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
}
|
app/code/community/Sarbacane/Sarbacanedesktop/etc/config.xml
CHANGED
@@ -21,128 +21,142 @@
|
|
21 |
*/
|
22 |
-->
|
23 |
<config>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
*/
|
22 |
-->
|
23 |
<config>
|
24 |
+
<modules>
|
25 |
+
<Sarbacane_Sarbacanedesktop>
|
26 |
+
<version>1.0.0.8</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 |
+
</frontend>
|
40 |
+
<admin>
|
41 |
+
<routers>
|
42 |
+
<adminhtml>
|
43 |
+
<args>
|
44 |
+
<modules>
|
45 |
+
<sarbacanedesktop before="Mage_Adminhtml">Sarbacane_Sarbacanedesktop_Adminhtml</sarbacanedesktop>
|
46 |
+
</modules>
|
47 |
+
</args>
|
48 |
+
</adminhtml>
|
49 |
+
</routers>
|
50 |
+
</admin>
|
51 |
+
<adminhtml>
|
52 |
+
<menu>
|
53 |
+
<newsletter>
|
54 |
+
<children>
|
55 |
+
<sarbacanedesktop module="sarbacanedesktop" translate="title">
|
56 |
+
<title>Sarbacane Desktop</title>
|
57 |
+
<sort_order>120</sort_order>
|
58 |
+
<action>adminhtml/sarbacanedesktop</action>
|
59 |
+
</sarbacanedesktop>
|
60 |
+
</children>
|
61 |
+
</newsletter>
|
62 |
+
</menu>
|
63 |
+
<acl>
|
64 |
+
<resources>
|
65 |
+
<admin>
|
66 |
+
<children>
|
67 |
+
<newsletter>
|
68 |
+
<children>
|
69 |
+
<sarbacanedesktop translate="title">
|
70 |
+
<title>Sarbacane Desktop</title>
|
71 |
+
<sort_order>120</sort_order>
|
72 |
+
</sarbacanedesktop>
|
73 |
+
</children>
|
74 |
+
</newsletter>
|
75 |
+
</children>
|
76 |
+
</admin>
|
77 |
+
</resources>
|
78 |
+
</acl>
|
79 |
+
<layout>
|
80 |
+
<updates>
|
81 |
+
<sarbacanedesktop>
|
82 |
+
<file>sarbacanedesktop.xml</file>
|
83 |
+
</sarbacanedesktop>
|
84 |
+
</updates>
|
85 |
+
</layout>
|
86 |
+
<translate>
|
87 |
+
<modules>
|
88 |
+
<Sarbacane_Sarbacanedesktop>
|
89 |
+
<files>
|
90 |
+
<default>Sarbacane_Sarbacanedesktop.csv</default>
|
91 |
+
</files>
|
92 |
+
</Sarbacane_Sarbacanedesktop>
|
93 |
+
</modules>
|
94 |
+
</translate>
|
95 |
+
</adminhtml>
|
96 |
+
<global>
|
97 |
+
<events>
|
98 |
+
<customer_save_before>
|
99 |
+
<observers>
|
100 |
+
<sarbacanedesktop_customer_save>
|
101 |
+
<class>Sarbacane_Sarbacanedesktop_Model_Observer</class>
|
102 |
+
<method>customerSave</method>
|
103 |
+
</sarbacanedesktop_customer_save>
|
104 |
+
</observers>
|
105 |
+
</customer_save_before>
|
106 |
+
<customer_delete_before>
|
107 |
+
<observers>
|
108 |
+
<sarbacanedesktop_customer_delete>
|
109 |
+
<class>Sarbacane_Sarbacanedesktop_Model_Observer</class>
|
110 |
+
<method>customerDelete</method>
|
111 |
+
</sarbacanedesktop_customer_delete>
|
112 |
+
</observers>
|
113 |
+
</customer_delete_before>
|
114 |
+
<newsletter_subscriber_save_before>
|
115 |
+
<observers>
|
116 |
+
<sarbacanedesktop_newsletter_subscriber_save>
|
117 |
+
<class>Sarbacane_Sarbacanedesktop_Model_Observer</class>
|
118 |
+
<method>newsletterSubscriberSave</method>
|
119 |
+
</sarbacanedesktop_newsletter_subscriber_save>
|
120 |
+
</observers>
|
121 |
+
</newsletter_subscriber_save_before>
|
122 |
+
<newsletter_subscriber_delete_before>
|
123 |
+
<observers>
|
124 |
+
<sarbacanedesktop_newsletter_subscriber_delete>
|
125 |
+
<class>Sarbacane_Sarbacanedesktop_Model_Observer</class>
|
126 |
+
<method>newsletterSubscriberDelete</method>
|
127 |
+
</sarbacanedesktop_newsletter_subscriber_delete>
|
128 |
+
</observers>
|
129 |
+
</newsletter_subscriber_delete_before>
|
130 |
+
</events>
|
131 |
+
<helpers>
|
132 |
+
<sarbacanedesktop>
|
133 |
+
<class>Sarbacane_Sarbacanedesktop_Helper</class>
|
134 |
+
</sarbacanedesktop>
|
135 |
+
</helpers>
|
136 |
+
<blocks>
|
137 |
+
<sarbacanedesktop>
|
138 |
+
<class>Sarbacane_Sarbacanedesktop_Block</class>
|
139 |
+
</sarbacanedesktop>
|
140 |
+
</blocks>
|
141 |
+
<resources>
|
142 |
+
<sarbacanedesktop_setup>
|
143 |
+
<setup>
|
144 |
+
<module>Sarbacane_Sarbacanedesktop</module>
|
145 |
+
</setup>
|
146 |
+
<connection>
|
147 |
+
<use>core_setup</use>
|
148 |
+
</connection>
|
149 |
+
</sarbacanedesktop_setup>
|
150 |
+
<sarbacanedesktop_write>
|
151 |
+
<connection>
|
152 |
+
<use>core_write</use>
|
153 |
+
</connection>
|
154 |
+
</sarbacanedesktop_write>
|
155 |
+
<sarbacanedesktop_read>
|
156 |
+
<connection>
|
157 |
+
<use>core_read</use>
|
158 |
+
</connection>
|
159 |
+
</sarbacanedesktop_read>
|
160 |
+
</resources>
|
161 |
+
</global>
|
162 |
+
</config>
|
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-install-1.0.0.0.php
DELETED
@@ -1,52 +0,0 @@
|
|
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("
|
26 |
-
DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop')}`;
|
27 |
-
DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop_users')}`;
|
28 |
-
|
29 |
-
CREATE TABLE `{$this->getTable('sarbacanedesktop')}` (
|
30 |
-
`email` varchar(150) NOT NULL,
|
31 |
-
`list_type` varchar(20) NOT NULL,
|
32 |
-
`store_id` varchar(20) NOT NULL,
|
33 |
-
`sd_id` varchar(20) NOT NULL,
|
34 |
-
`lastname` varchar(150) NOT NULL,
|
35 |
-
`firstname` varchar(150) NOT NULL,
|
36 |
-
`orders_data` varchar(150) NOT NULL,
|
37 |
-
PRIMARY KEY(`email`,`store_id`,`list_type`,`sd_id`)
|
38 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
39 |
-
|
40 |
-
CREATE TABLE `{$this->getTable('sarbacanedesktop_users')}` (
|
41 |
-
`sd_id` int(20) unsigned NOT NULL AUTO_INCREMENT,
|
42 |
-
`sd_type` varchar(20) NOT NULL,
|
43 |
-
`sd_value` varchar(200) NOT NULL,
|
44 |
-
PRIMARY KEY(`sd_id`)
|
45 |
-
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
46 |
-
|
47 |
-
INSERT INTO `{$this->getTable('sarbacanedesktop_users')}` (`sd_type`, `sd_value`) VALUES
|
48 |
-
('sd_token', ''),
|
49 |
-
('sd_list', '');
|
50 |
-
|
51 |
-
");
|
52 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.0-1.0.0.1.php
DELETED
@@ -1,25 +0,0 @@
|
|
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/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.1-1.0.0.2.php
DELETED
@@ -1,25 +0,0 @@
|
|
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/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.2-1.0.0.3.php
DELETED
@@ -1,25 +0,0 @@
|
|
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/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.3-1.0.0.4.php
DELETED
@@ -1,87 +0,0 @@
|
|
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/code/community/Sarbacane/Sarbacanedesktop/sql/sarbacanedesktop_setup/mysql4-upgrade-1.0.0.7-1.0.0.8.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
try{
|
26 |
+
$installer->run("DROP TRIGGER IF EXISTS sd_newsletter_update;");
|
27 |
+
}
|
28 |
+
catch(Exception $e) {}
|
29 |
+
try{
|
30 |
+
$installer->run("DROP TRIGGER IF EXISTS sd_newsletter_insert;");
|
31 |
+
}
|
32 |
+
catch(Exception $e) {}
|
33 |
+
try{
|
34 |
+
$installer->run("DROP TRIGGER IF EXISTS sd_customer_delete;");
|
35 |
+
}
|
36 |
+
catch(Exception $e) {}
|
37 |
+
|
38 |
+
$installer->run("
|
39 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('sarbacanedesktop_users')}` (
|
40 |
+
`sd_type` varchar(20) NOT NULL,
|
41 |
+
`sd_value` varchar(200) NOT NULL,
|
42 |
+
PRIMARY KEY(`sd_type`)
|
43 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
44 |
+
");
|
45 |
+
|
46 |
+
$db_read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
47 |
+
$sd_token = '';
|
48 |
+
$sd_list = '';
|
49 |
+
$sd_is_user = '';
|
50 |
+
$sd_nb_failed = '';
|
51 |
+
$sd_last_update = '';
|
52 |
+
|
53 |
+
$rq_sql = "
|
54 |
+
SELECT `sd_type`, `sd_value`
|
55 |
+
FROM `{$this->getTable('sarbacanedesktop_users')}`
|
56 |
+
WHERE `sd_type` IN ('sd_token', 'sd_list');";
|
57 |
+
$rq = $db_read->query($rq_sql);
|
58 |
+
while ($r = $rq->fetch()) {
|
59 |
+
if ($r['sd_type'] == 'sd_token') {
|
60 |
+
$sd_token = $r['sd_value'];
|
61 |
+
} else if ($r['sd_type'] == 'sd_list') {
|
62 |
+
$sd_list = $r['sd_value'];
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
if ($sd_token != '' || $sd_list != '') {
|
67 |
+
$sd_is_user = 'yes';
|
68 |
+
}
|
69 |
+
|
70 |
+
$installer->run("
|
71 |
+
DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop')}`;
|
72 |
+
|
73 |
+
DROP TABLE IF EXISTS `{$this->getTable('sarbacanedesktop_users')}`;
|
74 |
+
|
75 |
+
DROP TABLE IF EXISTS `{$this->getTable('sd_updates')}`;
|
76 |
+
|
77 |
+
DROP TABLE IF EXISTS `{$this->getTable('sd_users')}`;
|
78 |
+
|
79 |
+
DROP TABLE IF EXISTS `{$this->getTable('sd_data')}`;
|
80 |
+
|
81 |
+
CREATE TABLE `{$this->getTable('sd_updates')}` (
|
82 |
+
`email` varchar(50) NOT NULL,
|
83 |
+
`store_id` int(11) unsigned NOT NULL,
|
84 |
+
`list_type` varchar(10) NOT NULL,
|
85 |
+
`action` varchar(5) NOT NULL,
|
86 |
+
`update_date` datetime NOT NULL,
|
87 |
+
PRIMARY KEY (`email`, `store_id`, `list_type`)
|
88 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
89 |
+
|
90 |
+
CREATE TABLE `{$this->getTable('sd_users')}` (
|
91 |
+
`sd_id` varchar(200) NOT NULL,
|
92 |
+
`list_id` varchar(50) NOT NULL,
|
93 |
+
`last_call_date` datetime NOT NULL,
|
94 |
+
PRIMARY KEY(`sd_id`, `list_id`)
|
95 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
96 |
+
|
97 |
+
CREATE TABLE `{$this->getTable('sd_data')}` (
|
98 |
+
`sd_type` varchar(20) NOT NULL,
|
99 |
+
`sd_value` varchar(200) NOT NULL,
|
100 |
+
PRIMARY KEY(`sd_type`)
|
101 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
102 |
+
|
103 |
+
INSERT INTO `{$this->getTable('sd_data')}`
|
104 |
+
(`sd_type`, `sd_value`)
|
105 |
+
VALUES
|
106 |
+
('sd_token', {$db_read->quote($sd_token)}),
|
107 |
+
('sd_list', {$db_read->quote($sd_list)}),
|
108 |
+
('sd_is_user', {$db_read->quote($sd_is_user)}),
|
109 |
+
('sd_nb_failed', {$db_read->quote($sd_nb_failed)}),
|
110 |
+
('sd_last_update', {$db_read->quote($sd_last_update)});
|
111 |
+
");
|
112 |
+
|
113 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/sarbacanedesktop.xml
CHANGED
@@ -21,9 +21,9 @@
|
|
21 |
*/
|
22 |
-->
|
23 |
<layout>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
</layout>
|
21 |
*/
|
22 |
-->
|
23 |
<layout>
|
24 |
+
<adminhtml_sarbacanedesktop_index>
|
25 |
+
<reference name="content">
|
26 |
+
<block type="sarbacanedesktop/adminhtml_sarbacanedesktop" name="sarbacanedesktop" template="sarbacanedesktop/sarbacanedesktop.phtml"/>
|
27 |
+
</reference>
|
28 |
+
</adminhtml_sarbacanedesktop_index>
|
29 |
+
</layout>
|
app/design/adminhtml/default/default/template/sarbacanedesktop/sarbacanedesktop.phtml
CHANGED
@@ -18,249 +18,265 @@
|
|
18 |
* @copyright 2015 Sarbacane Software
|
19 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
*/
|
21 |
-
$key_for_synchronisation = $this->getKeyForSynchronisation
|
22 |
-
$
|
23 |
-
$
|
24 |
-
$
|
|
|
|
|
|
|
25 |
?>
|
26 |
-
<link rel="stylesheet" type="text/css" href="
|
27 |
-
<script type="text/javascript" src="
|
28 |
<div id="sarbacanedesktop">
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
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 |
-
|
214 |
-
|
215 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
* @copyright 2015 Sarbacane Software
|
19 |
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
20 |
*/
|
21 |
+
$key_for_synchronisation = $this->getKeyForSynchronisation();
|
22 |
+
$check_failed = $this->getCheckFailed();
|
23 |
+
$list_configuration = $this->getListConfiguration();
|
24 |
+
$general_configuration = $this->getGeneralConfiguration();
|
25 |
+
$sd_is_user = $this->getSdIsUser();
|
26 |
+
$displayed_step = $this->getDisplayedStep();
|
27 |
+
$shops_array = $this->getShopsArray();
|
28 |
?>
|
29 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('sarbacanedesktop.css') ?>"/>
|
30 |
+
<script type="text/javascript" src="<?php echo $this->getSkinUrl('sarbacanedesktop.js') ?>"></script>
|
31 |
<div id="sarbacanedesktop">
|
32 |
+
<div class="sd_header">
|
33 |
+
<div class="sd_logo_<?php echo $this->__('sarbacane') ?>"></div>
|
34 |
+
</div>
|
35 |
+
<p class="sd_title"><?php echo $this->__('It\'s easy to manage your newsletter and email campaigns') ?></p>
|
36 |
+
<div class="sd_title_separator_page"></div>
|
37 |
+
<div class="sd_video_config_container">
|
38 |
+
<div class="sd_video_container">
|
39 |
+
<iframe width="565" height="315" src="<?php echo $this->__('https://www.youtube.com/embed/eLMy2tSSYgE') ?>?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
|
40 |
+
</div>
|
41 |
+
<div class="sd_config_container">
|
42 |
+
<p><?php echo $this->__('This Magento module enables you to synchronize clients and accounts that have subscribed to your newsletter from your shop online using Sarbacane Desktop\'s email marketing software.') ?></p>
|
43 |
+
<p>
|
44 |
+
<input type="button" onclick="sdDisplaySteps()" class="sd_config_button" value="<?php echo $this->__('Begin the set-up') ?>"/>
|
45 |
+
</p>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<div class="sd_separator"></div>
|
49 |
+
<div class="sd_detail_description_container">
|
50 |
+
<div>
|
51 |
+
<div>
|
52 |
+
<div>
|
53 |
+
<div class="sd_picto1"></div>
|
54 |
+
<p class="sd_long_subtitle"><?php echo $this->__('Synchronization of your shop data') ?></p>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
<div>
|
58 |
+
<div>
|
59 |
+
<div class="sd_picto2"></div>
|
60 |
+
<p class="sd_long_subtitle"><?php echo $this->__('Responsive visual editor') ?></p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
<div>
|
64 |
+
<div>
|
65 |
+
<div class="sd_picto3"></div>
|
66 |
+
<p class="sd_short_subtitle"><?php echo $this->__('Detailed statistics') ?></p>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<div>
|
70 |
+
<div>
|
71 |
+
<div class="sd_picto4"></div>
|
72 |
+
<p class="sd_short_subtitle"><?php echo $this->__('Optimal deliverability') ?></p>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
<div>
|
77 |
+
<div>
|
78 |
+
<div>
|
79 |
+
<div class="sd_subtitle_separator"></div>
|
80 |
+
<p><?php echo $this->__('Synchronize and manage all the email lists from your Magento store') ?></p>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div>
|
84 |
+
<div>
|
85 |
+
<div class="sd_subtitle_separator"></div>
|
86 |
+
<p><?php echo $this->__('NEW! Create awesome, responsive newsletters thanks to the EmailBuilder') ?></p>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<div>
|
90 |
+
<div>
|
91 |
+
<div class="sd_subtitle_separator"></div>
|
92 |
+
<p><?php echo $this->__('Geolocation, openings, opening time, clicks, opt-outs...') ?></p>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
<div>
|
96 |
+
<div>
|
97 |
+
<div class="sd_subtitle_separator"></div>
|
98 |
+
<p><?php echo $this->__('Optimal deliverability thanks to our renowned professional routing platform') ?></p>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
<div class="sd_separator"></div>
|
104 |
+
<div class="sd_account_offer_container">
|
105 |
+
<p class="sd_account"><?php echo $this->__('Create your account for free and start sending emails') ?></p>
|
106 |
+
<p class="sd_offer"><?php echo $this->__('No strings attached') ?></p>
|
107 |
+
<div class="sd_title_separator_account_offer"></div>
|
108 |
+
</div>
|
109 |
+
<div class="sd_info_container">
|
110 |
+
<div class="sd_info_container_left">
|
111 |
+
<div>
|
112 |
+
<p class="sd_info_title"><?php echo $this->__('Why choose Sarbacane?') ?></p>
|
113 |
+
<div>
|
114 |
+
<p><?php echo $this->__('Create your account for free and start sending emails') ?></p>
|
115 |
+
<p><?php echo $this->__('Trusted by over 20,000 users worldwide') ?></p>
|
116 |
+
<p><?php echo $this->__('Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)') ?></p>
|
117 |
+
<p><?php echo $this->__('All you need to succeed: design, customize, send, and follow-up on your campaigns') ?></p>
|
118 |
+
<p><?php echo $this->__('A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...') ?></p>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<div class="sd_info_container_right">
|
123 |
+
<div>
|
124 |
+
<p class="sd_info_title"><?php echo $this->__('Need help?') ?></p>
|
125 |
+
<div>
|
126 |
+
<p><?php echo $this->__('Email:') ?> <?php echo $this->__('support@sarbacane.com') ?></p>
|
127 |
+
<p><?php echo $this->__('Tel:') ?> <?php echo $this->__('+33(0) 328 328 040') ?></p>
|
128 |
+
<p>
|
129 |
+
<?php echo $this->__('Website:') ?>
|
130 |
+
<a href="<?php echo $this->__('http://www.sarbacane.com/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento') ?>" target="_blank"><?php echo $this->__('http://www.sarbacane.com') ?></a>
|
131 |
+
</p>
|
132 |
+
</div>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
</div>
|
136 |
+
<div id="sd_step"></div>
|
137 |
+
<!-- STEP 1 -->
|
138 |
+
<div id="sd_step1" class="sd_step<?php if ($displayed_step == 1) { ?> sd_show_step<?php } ?>">
|
139 |
+
<p class="sd_step_title"><?php echo $this->__('How to set up the module?') ?></p>
|
140 |
+
<div class="sd_step_line"></div>
|
141 |
+
<p class="sd_step1_instruction"><?php echo $this->__('Do you already have a Sarbacane Desktop account?') ?></p>
|
142 |
+
<form autocomplete="off" action="<?php echo Mage::helper('adminhtml')->getUrl("*/*/*/") ?>#sd_step" method="POST">
|
143 |
+
<p class="sd_step1_selection">
|
144 |
+
<span>
|
145 |
+
<input onclick="sdUserYesNoDisplayButton('yes')" type="radio" id="sd_user_click_yes" name="sd_is_user" value="yes"<?php if ($sd_is_user == "yes") { ?> checked="checked"<?php } ?>/>
|
146 |
+
<label for="sd_user_click_yes"><?php echo $this->__('Yes') ?></label>
|
147 |
+
</span>
|
148 |
+
<span>
|
149 |
+
<input onclick="sdUserYesNoDisplayButton('no')" type="radio" id="sd_user_click_no" name="sd_is_user" value="no"<?php if ($sd_is_user == "no") { ?> checked="checked"<?php } ?>/>
|
150 |
+
<label for="sd_user_click_no"><?php echo $this->__('No') ?></label>
|
151 |
+
</span>
|
152 |
+
</p>
|
153 |
+
<div class="sd_step_buttons">
|
154 |
+
<div class="sd_step_buttons_right">
|
155 |
+
<input type="hidden" name="submit_is_user" value="1"/>
|
156 |
+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>"/>
|
157 |
+
<input type="submit" class="sd_button" value="<?php echo $this->__('Next') ?>"/>
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
</form>
|
161 |
+
</div>
|
162 |
+
<!-- STEP 2 -->
|
163 |
+
<div id="sd_step2" class="sd_step<?php if ($displayed_step == 2) { ?> sd_show_step<?php } ?>">
|
164 |
+
<div class="sd_step_line"></div>
|
165 |
+
<p class="sd_step2_instruction"><?php echo $this->__('Select your shop and pick your settings') ?></p>
|
166 |
+
<form autocomplete="off" action="<?php echo Mage::helper('adminhtml')->getUrl("*/*/*/") ?>#sd_step" method="POST">
|
167 |
+
<div class="sd_step2_selection">
|
168 |
+
<?php foreach ($shops_array as $shop) { ?>
|
169 |
+
<div class="sd_step2_selection_list">
|
170 |
+
<p class="sd_step2_selection_shop_title"><?php echo $shop['name'] ?></p>
|
171 |
+
<div class="sd_step2_selection_shop">
|
172 |
+
<div class="sd_step2_selection_shop_input">
|
173 |
+
<?php
|
174 |
+
$store_value = $shop['store_id'] . 'N0';
|
175 |
+
$store_checked = $general_configuration < 3 || in_array($shop['store_id'] . 'N0', $list_configuration);
|
176 |
+
?>
|
177 |
+
<input type="checkbox" name="store_id[]" value="<?php echo $store_value ?>"<?php if ($store_checked) { ?> checked="checked"<?php } ?>/>
|
178 |
+
</div>
|
179 |
+
<div class="sd_step2_selection_shop_text">
|
180 |
+
<?php echo $this->__('Create a list in Sarbacane Desktop with newsletter opt-ins') ?>
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
<div class="sd_step2_selection_shop">
|
184 |
+
<div class="sd_step2_selection_shop_input">
|
185 |
+
<?php
|
186 |
+
$store_value = '';
|
187 |
+
$store_checked = false;
|
188 |
+
$store_with_customer_data = false;
|
189 |
+
if (in_array($shop['store_id'] . 'C1', $list_configuration)) {
|
190 |
+
$store_value = $shop['store_id'] . 'C1';
|
191 |
+
$store_with_customer_data = true;
|
192 |
+
$store_checked = true;
|
193 |
+
} else if ($general_configuration < 3 || in_array($shop['store_id'] . 'C0', $list_configuration)) {
|
194 |
+
$store_value = $shop['store_id'] . 'C0';
|
195 |
+
$store_checked = true;
|
196 |
+
}
|
197 |
+
?>
|
198 |
+
<input id="id_shop_<?php echo $shop['store_id'] ?>C" type="checkbox" name="store_id[]" onclick="changeOptionOrdersDataDisplay('<?php echo $shop['store_id'] ?>C', this.checked)" value="<?php echo $store_value ?>"<?php if ($store_checked) { ?> checked="checked"<?php } ?>/>
|
199 |
+
</div>
|
200 |
+
<div class="sd_step2_selection_shop_text">
|
201 |
+
<?php echo $this->__('Create a list in Sarbacane Desktop with your clients who have an account or who have placed an order online') ?>
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
<div class="sd_step2_selection_shop_option<?php if ($shop['store_id'] == '0') { ?> sd_hidden<?php } ?>">
|
205 |
+
<div class="sd_step2_selection_shop_input">
|
206 |
+
<input id="customer_data_<?php echo $shop['store_id'] ?>C" type="checkbox" onclick="changeOptionOrdersData('<?php echo $shop['store_id'] ?>C', this.checked)" <?php if ($store_with_customer_data) { ?>checked="checked"<?php } ?>/>
|
207 |
+
</div>
|
208 |
+
<div class="sd_step2_selection_shop_text">
|
209 |
+
<?php echo $this->__('Add order data (date, amount, etc...)') ?>
|
210 |
+
</div>
|
211 |
+
<div onclick="sdInfoDataOrdersClick('<?php echo $shop['store_id'] ?>C')" onmouseover="sdInfoDataOrdersHover('<?php echo $shop['store_id'] ?>C')" onmouseout="sdInfoDataOrdersOut('<?php echo $shop['store_id'] ?>C')" class="sd_step2_info"></div>
|
212 |
+
</div>
|
213 |
+
</div>
|
214 |
+
<div id="sd_tooltip_<?php echo $shop['store_id'] ?>C" class="sd_tooltip">
|
215 |
+
<div>
|
216 |
+
<?php echo $this->__('As you enable data from orders, you can also gather extra info in your contact list, and target your recipients in Sarbacane Desktop.') ?>
|
217 |
+
<br/><?php echo $this->__('Below are pieces of information that will be added to your contact list:') ?>
|
218 |
+
<br/><?php echo $this->__('- Date of first order') ?>
|
219 |
+
<br/><?php echo $this->__('- Date of latest order') ?>
|
220 |
+
<br/><?php echo $this->__('- Total number of orders') ?>
|
221 |
+
<br/><?php echo $this->__('- Total amount of orders') ?>
|
222 |
+
<br/><?php echo $this->__('- Amount of the cheapest order') ?>
|
223 |
+
<br/><?php echo $this->__('- Amount of the most expensive order') ?>
|
224 |
+
<br/><?php echo $this->__('- Average amount of the orders placed') ?>
|
225 |
+
</div>
|
226 |
+
</div>
|
227 |
+
<?php } ?>
|
228 |
+
</div>
|
229 |
+
<div class="sd_step_buttons">
|
230 |
+
<div class="sd_step_buttons_left">
|
231 |
+
<input type="button" onclick="sdDisplayStep(1)" value="<?php echo $this->__('Previous') ?>"/>
|
232 |
+
</div>
|
233 |
+
<div class="sd_step_buttons_right">
|
234 |
+
<input type="hidden" name="submit_configuration" value="1"/>
|
235 |
+
<input type="hidden" name="submit_is_user" value="<?php echo $this->getIsUser() ?>"/>
|
236 |
+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>"/>
|
237 |
+
<input type="submit" class="sd_button" value="<?php echo $this->__('Next') ?>"/>
|
238 |
+
</div>
|
239 |
+
</div>
|
240 |
+
</form>
|
241 |
+
</div>
|
242 |
+
<!-- STEP 3 -->
|
243 |
+
<div id="sd_step3" class="sd_step<?php if ($displayed_step == 3) { ?> sd_show_step<?php } ?>">
|
244 |
+
<div class="sd_step_line"></div>
|
245 |
+
<div class="sd_step3_instruction">
|
246 |
+
<?php if ($sd_is_user == "yes") { ?>
|
247 |
+
<p>1/ <a href="<?php echo $this->__('https://www.sarbacane.com/ws/soft-redirect.asp?key=heXmrxBEUO&com=MagentoInfo') ?>" target="_blank"><?php echo $this->__('Download and install Sarbacane') ?></a></p>
|
248 |
+
<p>2/ <?php echo $this->__('Create your free account') ?></p>
|
249 |
+
<p>3/ <?php echo $this->__('Enable the Magento extension in our extensions menu, and then fill in the following fields:') ?></p>
|
250 |
+
<?php } else if ($sd_is_user == "no") { ?>
|
251 |
+
<p><?php echo $this->__('Enable the Magento extension in our extensions menu, and then fill in the following fields:') ?></p>
|
252 |
+
<?php } ?>
|
253 |
+
<form autocomplete="off" action="<?php echo Mage::helper('adminhtml')->getUrl("*/*/*/") ?>#sd_step" method="POST">
|
254 |
+
<div class="sd_key_container">
|
255 |
+
<p><?php echo $this->__('Url') ?></p>
|
256 |
+
<input value="<?php echo Mage::getBaseUrl() ?>" onclick="this.select()" type="text" readonly/>
|
257 |
+
</div>
|
258 |
+
<div class="sd_key_container">
|
259 |
+
<p><?php echo $this->__('Key') ?></p>
|
260 |
+
<?php if ( ! $check_failed) { ?>
|
261 |
+
<input value="<?php echo $key_for_synchronisation ?>" onclick="this.select()" type="text" readonly/>
|
262 |
+
<?php } else { ?>
|
263 |
+
<span><?php echo $this->__('Please generate a new key') ?></span>
|
264 |
+
<?php } ?>
|
265 |
+
</div>
|
266 |
+
<p class="sd_key_button_container">
|
267 |
+
<input type="hidden" name="submit_parameter_key" value="1"/>
|
268 |
+
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>"/>
|
269 |
+
<input type="submit" class="sd_key_button" value="<?php echo $this->__('Generate a new key') ?>"/>
|
270 |
+
</p>
|
271 |
+
</form>
|
272 |
+
</div>
|
273 |
+
<div class="sd_step_buttons">
|
274 |
+
<div class="sd_step_buttons_left">
|
275 |
+
<input type="button" onclick="sdDisplayStep(2)" value="<?php echo $this->__('Previous') ?>"/>
|
276 |
+
</div>
|
277 |
+
<div class="sd_step3_right">
|
278 |
+
<?php echo $this->__('Read more') ?>, <a href="<?php echo $this->__('http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento') ?>" target="_blank"><?php echo $this->__('in the help section online') ?></a>
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
</div>
|
app/etc/modules/Sarbacane_Sarbacanedesktop.xml
CHANGED
@@ -27,4 +27,4 @@
|
|
27 |
<codePool>community</codePool>
|
28 |
</Sarbacane_Sarbacanedesktop>
|
29 |
</modules>
|
30 |
-
</config>
|
27 |
<codePool>community</codePool>
|
28 |
</Sarbacane_Sarbacanedesktop>
|
29 |
</modules>
|
30 |
+
</config>
|
app/locale/en_US/Sarbacane_Sarbacanedesktop.csv
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
"sarbacane","sarbacane"
|
2 |
"It's easy to manage your newsletter and email campaigns","It's easy to manage your newsletter and email campaigns"
|
3 |
"https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
|
@@ -14,8 +16,7 @@
|
|
14 |
"Create your account for free and start sending emails","Create your account for free and start sending emails"
|
15 |
"No strings attached","No strings attached"
|
16 |
"Why choose Sarbacane?","Why choose Sarbacane?"
|
17 |
-
"
|
18 |
-
"Trusted by over 20,000 users worldwide.","Trusted by over 20,000 users worldwide."
|
19 |
"Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)","Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)"
|
20 |
"All you need to succeed: design, customize, send, and follow-up on your campaigns","All you need to succeed: design, customize, send, and follow-up on your campaigns"
|
21 |
"A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...","A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips..."
|
@@ -52,6 +53,7 @@
|
|
52 |
"Enable the Magento 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-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
1 |
+
"Sarbacane Desktop","Sarbacane Desktop"
|
2 |
+
"Other","Other"
|
3 |
"sarbacane","sarbacane"
|
4 |
"It's easy to manage your newsletter and email campaigns","It's easy to manage your newsletter and email campaigns"
|
5 |
"https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
|
16 |
"Create your account for free and start sending emails","Create your account for free and start sending emails"
|
17 |
"No strings attached","No strings attached"
|
18 |
"Why choose Sarbacane?","Why choose Sarbacane?"
|
19 |
+
"Trusted by over 20,000 users worldwide","Trusted by over 20,000 users worldwide"
|
|
|
20 |
"Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)","Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)"
|
21 |
"All you need to succeed: design, customize, send, and follow-up on your campaigns","All you need to succeed: design, customize, send, and follow-up on your campaigns"
|
22 |
"A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...","A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips..."
|
53 |
"Enable the Magento 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:"
|
54 |
"Url","Url"
|
55 |
"Key","Key"
|
56 |
+
"Please generate a new key","Please generate a new key"
|
57 |
"Generate a new key","Generate a new key"
|
58 |
"Read more","Read more"
|
59 |
"http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
app/locale/fr_FR/Sarbacane_Sarbacanedesktop.csv
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
"sarbacane","sarbacane"
|
2 |
"It's easy to manage your newsletter and email campaigns","Gérez vos newsletters et emailing en toute simplicité"
|
3 |
"https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
|
@@ -14,8 +16,7 @@
|
|
14 |
"Create your account for free and start sending emails","Création de compte gratuit et premiers envois offerts"
|
15 |
"No strings attached","Offre sans engagement"
|
16 |
"Why choose Sarbacane?","Pourquoi choisir Sarbacane ?"
|
17 |
-
"
|
18 |
-
"Trusted by over 20,000 users worldwide.","Plus de 20 000 utilisateurs rien qu'en France déjà conquis par Sarbacane"
|
19 |
"Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)","Elue Meilleure Solution Emailing par Bsoco Awards (comparatif de solutions emailing)"
|
20 |
"All you need to succeed: design, customize, send, and follow-up on your campaigns","Tout ce dont vous avez besoin pour réussir : conception, personnalisation, envoi et suivi des retours de vos campagnes"
|
21 |
"A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...","Un support technique à votre écoute et de nombreuses ressources pour vous aider : vidéos, tutoriels, guides, conseils..."
|
@@ -24,7 +25,7 @@
|
|
24 |
"support@sarbacane.com","support@sarbacane.com"
|
25 |
"Tel:","Tel:"
|
26 |
"+33(0) 328 328 040","+33(0) 328 328 040"
|
27 |
-
"Website:","Site :
|
28 |
"http://www.sarbacane.com/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
29 |
"http://www.sarbacane.com","http://www.sarbacane.com"
|
30 |
"How to set up the module?","Comment configurer le module ?"
|
@@ -52,6 +53,7 @@
|
|
52 |
"Enable the Magento extension in our extensions menu, and then fill in the following fields:","Rendez-vous dans la section ''extensions'' et activez l'extension Magento, puis renseignez les éléments suivants :"
|
53 |
"Url","Url"
|
54 |
"Key","Clé"
|
|
|
55 |
"Generate a new key","Générer une nouvelle clé"
|
56 |
"Read more","Pour plus de détails"
|
57 |
"http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
1 |
+
"Sarbacane Desktop","Sarbacane Desktop"
|
2 |
+
"Other","Autre"
|
3 |
"sarbacane","sarbacane"
|
4 |
"It's easy to manage your newsletter and email campaigns","Gérez vos newsletters et emailing en toute simplicité"
|
5 |
"https://www.youtube.com/embed/eLMy2tSSYgE","https://www.youtube.com/embed/eLMy2tSSYgE"
|
16 |
"Create your account for free and start sending emails","Création de compte gratuit et premiers envois offerts"
|
17 |
"No strings attached","Offre sans engagement"
|
18 |
"Why choose Sarbacane?","Pourquoi choisir Sarbacane ?"
|
19 |
+
"Trusted by over 20,000 users worldwide","Plus de 20 000 utilisateurs rien qu'en France déjà conquis par Sarbacane"
|
|
|
20 |
"Awarded Best Emailing Solution by Bsoco Awards (an index that compares emailing solutions)","Elue Meilleure Solution Emailing par Bsoco Awards (comparatif de solutions emailing)"
|
21 |
"All you need to succeed: design, customize, send, and follow-up on your campaigns","Tout ce dont vous avez besoin pour réussir : conception, personnalisation, envoi et suivi des retours de vos campagnes"
|
22 |
"A tech heldpdesk and a variety of resources to help: videos, tutorials, manuals, tips...","Un support technique à votre écoute et de nombreuses ressources pour vous aider : vidéos, tutoriels, guides, conseils..."
|
25 |
"support@sarbacane.com","support@sarbacane.com"
|
26 |
"Tel:","Tel:"
|
27 |
"+33(0) 328 328 040","+33(0) 328 328 040"
|
28 |
+
"Website:","Site :"
|
29 |
"http://www.sarbacane.com/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
30 |
"http://www.sarbacane.com","http://www.sarbacane.com"
|
31 |
"How to set up the module?","Comment configurer le module ?"
|
53 |
"Enable the Magento extension in our extensions menu, and then fill in the following fields:","Rendez-vous dans la section ''extensions'' et activez l'extension Magento, puis renseignez les éléments suivants :"
|
54 |
"Url","Url"
|
55 |
"Key","Clé"
|
56 |
+
"Please generate a new key","Merci de générer une nouvelle clé"
|
57 |
"Generate a new key","Générer une nouvelle clé"
|
58 |
"Read more","Pour plus de détails"
|
59 |
"http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento","http://www.sarbacane.com/faq/extensions/configuration-plugin-magento/?utm_source=module-magento&utm_medium=plugin&utm_content=lien-sarbacane&utm_campaign=magento"
|
package.xml
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sarbacane_Sarbacanedesktop</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>
|
8 |
<extends/>
|
9 |
-
<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>
|
@@ -60,10 +60,10 @@
|
|
60 |
</ul></description>
|
61 |
<notes>We improved performance on synchronization.
|
62 |
It should be more efficient and nearly instant on most websites.</notes>
|
63 |
-
<authors><author><name>Sarbacane Software</name><user>
|
64 |
-
<date>
|
65 |
-
<time>
|
66 |
-
<contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="
|
67 |
<compatible/>
|
68 |
-
<dependencies><required><php><min>5.0.0</min><max>
|
69 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sarbacane_Sarbacanedesktop</name>
|
4 |
+
<version>1.0.0.8</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>
|
60 |
</ul></description>
|
61 |
<notes>We improved performance on synchronization.
|
62 |
It should be more efficient and nearly instant on most websites.</notes>
|
63 |
+
<authors><author><name>Sarbacane Software</name><user>sarbacane</user><email>connectors@sarbacane.com</email></author></authors>
|
64 |
+
<date>2017-06-19</date>
|
65 |
+
<time>13:14:06</time>
|
66 |
+
<contents><target name="magecommunity"><dir name="Sarbacane"><dir name="Sarbacanedesktop"><dir name="Block"><dir name="Adminhtml"><file name="Sarbacanedesktop.php" hash="37acc8335d82b2312609121c7ba7c3aa"/></dir></dir><dir name="Helper"><file name="Data.php" hash="fef9ce9208336fd6ac8ae05b6bcd005b"/></dir><dir name="Model"><file name="Observer.php" hash="9b16a9af99bda0a4d9dbe5e5cf8596db"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SarbacanedesktopController.php" hash="191d391986e63f5654c43a10ac9c56d1"/></dir><file name="IndexController.php" hash="e8f1e9e3e2881590474f9ebd1c02a514"/></dir><dir name="etc"><file name="config.xml" hash="77537c85b83b1acc510d48e2925f52a5"/></dir><dir name="sql"><dir name="sarbacanedesktop_setup"><file name="mysql4-upgrade-1.0.0.7-1.0.0.8.php" hash="27721deaf97fd972aa8540d4bfbb41ba"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><file name="sarbacanedesktop.css" hash="5cfd44b2883bede9f389f195dc65e6ff"/><dir name="images"><file name="sarbacanedesktop.png" hash="2038d3c503e8f59d14177a131bef7537"/></dir><file name="sarbacanedesktop.js" hash="15096b017322b4141926f7469600586c"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="sarbacanedesktop.xml" hash="8dbeb59dbc0a5d5a86256880a77b0189"/></dir><dir name="template"><dir name="sarbacanedesktop"><file name="sarbacanedesktop.phtml" hash="145cb3eafd17a8fc6c181ec33c0b0d7a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sarbacane_Sarbacanedesktop.xml" hash="2ad128064122d112a5b087c0967399d6"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Sarbacane_Sarbacanedesktop.csv" hash="3468b7d20d57c6a5d3d2ffa505f347f0"/></dir><dir name="en_US"><file name="Sarbacane_Sarbacanedesktop.csv" hash="ae45c5263eafa7057e1a4bb84ae55091"/></dir></target></contents>
|
67 |
<compatible/>
|
68 |
+
<dependencies><required><php><min>5.0.0</min><max>8.0.0</max></php></required></dependencies>
|
69 |
</package>
|
skin/adminhtml/default/default/images/{sd.png → sarbacanedesktop.png}
RENAMED
File without changes
|
skin/adminhtml/default/default/js/Sarbacane_SarbacaneDesktop/sarbacanedesktop.js
DELETED
@@ -1,95 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Magento
|
3 |
-
*
|
4 |
-
* NOTICE OF LICENSE
|
5 |
-
*
|
6 |
-
* This source file is subject to the Academic Free License (AFL 3.0)
|
7 |
-
* that is bundled with this package in the file LICENSE.txt.
|
8 |
-
* It is also available through the world-wide-web at this URL:
|
9 |
-
* http://opensource.org/licenses/afl-3.0.php
|
10 |
-
* If you did not receive a copy of the license and are unable to
|
11 |
-
* obtain it through the world-wide-web, please send an email
|
12 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
-
*
|
14 |
-
* @category Sarbacane
|
15 |
-
* @package Sarbacane_Sarbacanedesktop
|
16 |
-
* @author Sarbacane Software <contact@sarbacane.com>
|
17 |
-
* @copyright 2015 Sarbacane Software
|
18 |
-
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
-
*/
|
20 |
-
|
21 |
-
function changeOptionOrdersData(id_shop_c, value) {
|
22 |
-
if(value == true) {
|
23 |
-
document.getElementById('id_shop_' + id_shop_c).value=id_shop_c + '1';
|
24 |
-
}
|
25 |
-
else {
|
26 |
-
document.getElementById('id_shop_' + id_shop_c).value=id_shop_c + '0';
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
function changeOptionOrdersDataDisplay(id_shop_c, value) {
|
31 |
-
if(value == true) {
|
32 |
-
document.getElementById('customer_data_' + id_shop_c).disabled=false;
|
33 |
-
document.getElementById('id_shop_' + id_shop_c).value=id_shop_c + '0';
|
34 |
-
|
35 |
-
}
|
36 |
-
else {
|
37 |
-
document.getElementById('id_shop_' + id_shop_c).value='';
|
38 |
-
document.getElementById('customer_data_' + id_shop_c).disabled=true;
|
39 |
-
document.getElementById('customer_data_' + id_shop_c).checked=false;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
function sdUserYesNoDisplayButton(user_selection) {
|
44 |
-
Element.removeClassName("sd_step1 .sd_button","sd_step1_button");
|
45 |
-
}
|
46 |
-
|
47 |
-
function sdDisplayStep(step) {
|
48 |
-
var otherSteps = $$(".sd_step");
|
49 |
-
if(otherSteps != null && otherSteps.length > 0 ){
|
50 |
-
otherSteps.each(function(item,i){
|
51 |
-
Element.removeClassName(item,"sd_show_step");
|
52 |
-
});
|
53 |
-
}
|
54 |
-
Element.addClassName("sd_step"+step,"sd_show_step");
|
55 |
-
window.location.href = '#sd_step';
|
56 |
-
}
|
57 |
-
|
58 |
-
function sdInfoDataOrdersHover(id_shop_c) {
|
59 |
-
Element.addClassName('sd_tooltip_' + id_shop_c,"sd_tooltip_show");
|
60 |
-
}
|
61 |
-
|
62 |
-
function sdInfoDataOrdersOut(id_shop_c) {
|
63 |
-
Element.removeClassName('sd_tooltip_' + id_shop_c,"sd_tooltip_show");
|
64 |
-
// $('#sd_tooltip_' + id_shop_c).removeClass('sd_tooltip_show');
|
65 |
-
}
|
66 |
-
|
67 |
-
function sdInfoDataOrdersClick(id_shop_c) {
|
68 |
-
Element.toggleClassName('sd_tooltip_' + id_shop_c,"sd_tooltip_show");
|
69 |
-
// $('#sd_tooltip_' + id_shop_c).toggleClass('sd_tooltip_show');
|
70 |
-
}
|
71 |
-
var isAlreadyUser = false;
|
72 |
-
function showStep2(){
|
73 |
-
if($(sd_user_click_yes).checked){
|
74 |
-
$(sd_step1).removeClassName("sd_show_step");
|
75 |
-
$(sd_step2).addClassName("sd_show_step");
|
76 |
-
$("3_step_block").hide();
|
77 |
-
isAlreadyUser = true;
|
78 |
-
}else{
|
79 |
-
if($(sd_user_click_no).checked){
|
80 |
-
$(sd_step1).removeClassName("sd_show_step");
|
81 |
-
$(sd_step2).addClassName("sd_show_step");
|
82 |
-
$("1_step_block").hide();
|
83 |
-
}else{
|
84 |
-
}
|
85 |
-
}
|
86 |
-
}
|
87 |
-
function showStep3(){
|
88 |
-
$(sd_step2).removeClassName("sd_show_step");
|
89 |
-
$(sd_step3).addClassName("sd_show_step");
|
90 |
-
if(isAlreadyUser){
|
91 |
-
$("3_step_block").hide();
|
92 |
-
}else{
|
93 |
-
$("1_step_block").hide();
|
94 |
-
}
|
95 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skin/adminhtml/default/default/{css/Sarbacane_SarbacaneDesktop/sarbacanedesktop.css → sarbacanedesktop.css}
RENAMED
@@ -23,7 +23,7 @@
|
|
23 |
#sarbacanedesktop p, #sarbacanedesktop form p{margin:0 0 8.5px;padding:0;}
|
24 |
#sarbacanedesktop a{color:#f06800;}
|
25 |
#sarbacanedesktop .sd_header{padding-top:20px;padding-bottom:20px;}
|
26 |
-
#sarbacanedesktop .sd_logo_sarbacane, #sarbacanedesktop .sd_logo_mailify, #sarbacanedesktop .sd_picto1, #sarbacanedesktop .sd_picto2, #sarbacanedesktop .sd_picto3, #sarbacanedesktop .sd_picto4, #sarbacanedesktop .sd_info_container_left > div > div > p, #sarbacanedesktop .sd_info_line,#sarbacanedesktop .sd_step_line, #sarbacanedesktop .sd_step2_info, #sarbacanedesktop .sd_info_container_right{background-repeat:no-repeat;background-image:url('
|
27 |
#sarbacanedesktop .sd_logo_sarbacane{margin:auto;width:318px;height:45px;background-position:-150px -99px;}
|
28 |
#sarbacanedesktop .sd_logo_mailify{margin:auto;width:192px;height:55px;background-position:-469px -98px;}
|
29 |
#sarbacanedesktop .sd_separator{border-top:1px solid #ebedf2;padding-bottom:5px;margin-top:5px;}
|
@@ -73,9 +73,9 @@
|
|
73 |
#sarbacanedesktop .sd_step_buttons_left{float:left;width:340px;text-align:left;}
|
74 |
#sarbacanedesktop .sd_step_buttons_right{float:right;width:340px;text-align:right;}
|
75 |
#sarbacanedesktop .sd_step3_right{float:right;width:340px;text-align:right;padding-top:10px;}
|
76 |
-
#sarbacanedesktop .sd_step_buttons input[type="button"], #sarbacanedesktop .sd_step_buttons input[type="submit"], #sarbacanedesktop input[type="submit"].sd_key_button
|
77 |
#sarbacanedesktop .sd_step_buttons .sd_step_buttons_left input[type="button"], #sarbacanedesktop input[type="submit"].sd_key_button{background:#808080;}
|
78 |
-
#sarbacanedesktop .sd_step_buttons .sd_step_buttons_right input[type="submit"]
|
79 |
#sarbacanedesktop .sd_step1_instruction, #sarbacanedesktop .sd_step2_instruction{font-size:16px;text-align:center;}
|
80 |
#sarbacanedesktop .sd_step1_selection{padding:10px 0px;text-align:center;}
|
81 |
#sarbacanedesktop .sd_step1_selection span{padding:0 20px;}
|
@@ -102,6 +102,4 @@
|
|
102 |
#sarbacanedesktop .sd_tooltip_show{display:block;}
|
103 |
#sarbacanedesktop .sd_tooltip *{font-size:11px;line-height:13px;}
|
104 |
#sarbacanedesktop .sd_tooltip div{background:#858585;border:1px solid white;position:absolute;right:15px;width:360px;bottom:25px;padding:20px;}
|
105 |
-
.
|
106 |
-
display:none;
|
107 |
-
}
|
23 |
#sarbacanedesktop p, #sarbacanedesktop form p{margin:0 0 8.5px;padding:0;}
|
24 |
#sarbacanedesktop a{color:#f06800;}
|
25 |
#sarbacanedesktop .sd_header{padding-top:20px;padding-bottom:20px;}
|
26 |
+
#sarbacanedesktop .sd_logo_sarbacane, #sarbacanedesktop .sd_logo_mailify, #sarbacanedesktop .sd_picto1, #sarbacanedesktop .sd_picto2, #sarbacanedesktop .sd_picto3, #sarbacanedesktop .sd_picto4, #sarbacanedesktop .sd_info_container_left > div > div > p, #sarbacanedesktop .sd_info_line,#sarbacanedesktop .sd_step_line, #sarbacanedesktop .sd_step2_info, #sarbacanedesktop .sd_info_container_right{background-repeat:no-repeat;background-image:url('images/sarbacanedesktop.png');}
|
27 |
#sarbacanedesktop .sd_logo_sarbacane{margin:auto;width:318px;height:45px;background-position:-150px -99px;}
|
28 |
#sarbacanedesktop .sd_logo_mailify{margin:auto;width:192px;height:55px;background-position:-469px -98px;}
|
29 |
#sarbacanedesktop .sd_separator{border-top:1px solid #ebedf2;padding-bottom:5px;margin-top:5px;}
|
73 |
#sarbacanedesktop .sd_step_buttons_left{float:left;width:340px;text-align:left;}
|
74 |
#sarbacanedesktop .sd_step_buttons_right{float:right;width:340px;text-align:right;}
|
75 |
#sarbacanedesktop .sd_step3_right{float:right;width:340px;text-align:right;padding-top:10px;}
|
76 |
+
#sarbacanedesktop .sd_step_buttons input[type="button"], #sarbacanedesktop .sd_step_buttons input[type="submit"], #sarbacanedesktop input[type="submit"].sd_key_button, #sarbacanedesktop .sd_button{color:white;padding:10px 20px;border:none;cursor:pointer;}
|
77 |
#sarbacanedesktop .sd_step_buttons .sd_step_buttons_left input[type="button"], #sarbacanedesktop input[type="submit"].sd_key_button{background:#808080;}
|
78 |
+
#sarbacanedesktop .sd_step_buttons .sd_step_buttons_right input[type="submit"], #sarbacanedesktop .sd_button{background:#78a13a;}
|
79 |
#sarbacanedesktop .sd_step1_instruction, #sarbacanedesktop .sd_step2_instruction{font-size:16px;text-align:center;}
|
80 |
#sarbacanedesktop .sd_step1_selection{padding:10px 0px;text-align:center;}
|
81 |
#sarbacanedesktop .sd_step1_selection span{padding:0 20px;}
|
102 |
#sarbacanedesktop .sd_tooltip_show{display:block;}
|
103 |
#sarbacanedesktop .sd_tooltip *{font-size:11px;line-height:13px;}
|
104 |
#sarbacanedesktop .sd_tooltip div{background:#858585;border:1px solid white;position:absolute;right:15px;width:360px;bottom:25px;padding:20px;}
|
105 |
+
#sarbacanedesktop .sd_hidden{display:none;}
|
|
|
|
skin/adminhtml/default/default/sarbacanedesktop.js
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Magento
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
8 |
+
* It is also available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/afl-3.0.php
|
10 |
+
* If you did not receive a copy of the license and are unable to
|
11 |
+
* obtain it through the world-wide-web, please send an email
|
12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
13 |
+
*
|
14 |
+
* @category Sarbacane
|
15 |
+
* @package Sarbacane_Sarbacanedesktop
|
16 |
+
* @author Sarbacane Software <contact@sarbacane.com>
|
17 |
+
* @copyright 2015 Sarbacane Software
|
18 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
function changeOptionOrdersData(id_shop_c, value) {
|
22 |
+
if (value == true) {
|
23 |
+
document.getElementById('id_shop_' + id_shop_c).value = id_shop_c + '1';
|
24 |
+
}
|
25 |
+
else {
|
26 |
+
document.getElementById('id_shop_' + id_shop_c).value = id_shop_c + '0';
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
function changeOptionOrdersDataDisplay(id_shop_c, value) {
|
31 |
+
if (value == true) {
|
32 |
+
document.getElementById('customer_data_' + id_shop_c).disabled = false;
|
33 |
+
document.getElementById('id_shop_' + id_shop_c).value=id_shop_c + '0';
|
34 |
+
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
document.getElementById('id_shop_' + id_shop_c).value='';
|
38 |
+
document.getElementById('customer_data_' + id_shop_c).disabled = true;
|
39 |
+
document.getElementById('customer_data_' + id_shop_c).checked = false;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
function sdUserYesNoDisplayButton(user_selection) {
|
44 |
+
Element.removeClassName('sd_step1 .sd_button', 'sd_step1_button');
|
45 |
+
}
|
46 |
+
|
47 |
+
function sdDisplaySteps() {
|
48 |
+
window.location.href = '#sd_step';
|
49 |
+
}
|
50 |
+
|
51 |
+
function sdDisplayStep(step) {
|
52 |
+
$$('.sd_step').each(function(item) {
|
53 |
+
Element.removeClassName(item, 'sd_show_step');
|
54 |
+
});
|
55 |
+
Element.addClassName('sd_step' + step, 'sd_show_step');
|
56 |
+
window.location.href = '#sd_step';
|
57 |
+
}
|
58 |
+
|
59 |
+
function sdInfoDataOrdersHover(id_shop_c) {
|
60 |
+
Element.addClassName('sd_tooltip_' + id_shop_c, 'sd_tooltip_show');
|
61 |
+
}
|
62 |
+
|
63 |
+
function sdInfoDataOrdersOut(id_shop_c) {
|
64 |
+
Element.removeClassName('sd_tooltip_' + id_shop_c, 'sd_tooltip_show');
|
65 |
+
}
|
66 |
+
|
67 |
+
function sdInfoDataOrdersClick(id_shop_c) {
|
68 |
+
Element.toggleClassName('sd_tooltip_' + id_shop_c, 'sd_tooltip_show');
|
69 |
+
}
|
70 |
+
|
71 |
+
function sdErrorTryReinstall() {
|
72 |
+
Element.addClassName('sd_error_try_reinstall', 'sd_hidden');
|
73 |
+
Element.removeClassName('sd_error_try_reinstall_inactive', 'sd_hidden');
|
74 |
+
}
|