Version Notes
Version 1.0.1 stable
Download this release
Release Info
Developer | Sinabs |
Extension | MessageBusiness_ContactsSync |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/community/MessageBusiness/ContactsSync/Block/Adminhtml/Sync/Button.php +106 -0
- app/code/community/MessageBusiness/ContactsSync/Block/System/Config/Form/Fieldset/Import.php +47 -0
- app/code/community/MessageBusiness/ContactsSync/Block/System/Config/Form/Fieldset/Service.php +46 -0
- app/code/community/MessageBusiness/ContactsSync/Helper/Data.php +147 -0
- app/code/community/MessageBusiness/ContactsSync/Helper/MbApi.php +579 -0
- app/code/community/MessageBusiness/ContactsSync/Model/Observer.php +66 -0
- app/code/community/MessageBusiness/ContactsSync/Model/System/Config/Source/Newsletter/Subscription.php +60 -0
- app/code/community/MessageBusiness/ContactsSync/Model/System/Config/Source/Synchro/Type.php +60 -0
- app/code/community/MessageBusiness/ContactsSync/controllers/Adminhtml/AjaxController.php +77 -0
- app/code/community/MessageBusiness/ContactsSync/controllers/InterfaceController.php +359 -0
- app/code/community/MessageBusiness/ContactsSync/etc/config.xml +132 -0
- app/code/community/MessageBusiness/ContactsSync/etc/system.xml +143 -0
- package.xml +6 -6
app/code/community/MessageBusiness/ContactsSync/Block/Adminhtml/Sync/Button.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Block_Adminhtml_sync_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Set le template du bouton de lancement de l'importation
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
parent::_construct();
|
35 |
+
$this->setTemplate('contactssync/system/config/sync/run.phtml');
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Retourne l'élément HTML
|
40 |
+
*
|
41 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
45 |
+
{
|
46 |
+
return $this->_toHtml();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Retourne le HTML du bouton
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function getButtonHtml()
|
55 |
+
{
|
56 |
+
$label = $this->helper('adminhtml')->__('Start import');
|
57 |
+
$strInfos = '';
|
58 |
+
$jsAction = 'runSync';
|
59 |
+
|
60 |
+
$infos = Mage::helper('contactssync/mbApi')->getDataValue(3)->GetAccountDataAttributeResult;
|
61 |
+
|
62 |
+
if (strpos($infos, 'running') !== false) {
|
63 |
+
$label = $this->helper('adminhtml')->__('Stop the current import');
|
64 |
+
$strInfos = $this->helper('adminhtml')->__('Import in progress');
|
65 |
+
$jsAction = 'stopSync';
|
66 |
+
}
|
67 |
+
else if (intval(substr($infos, 0, 4)) > 0) {
|
68 |
+
$label = $this->helper('adminhtml')->__('Start import');
|
69 |
+
$strInfos = $this->helper('adminhtml')->__('Last Import Date (UTC)') . ' : ' . str_replace('running', '', $infos) ;
|
70 |
+
$jsAction = 'runSync';
|
71 |
+
}
|
72 |
+
|
73 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
74 |
+
->setData(array(
|
75 |
+
'id' => 'sync_button',
|
76 |
+
'label' => $label,
|
77 |
+
'onclick' => 'javascript:' . $jsAction . '(); return false;'
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
return $button->toHtml() . '<br /><br />' . $strInfos;
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Retourne le lien vers l'action du controller admin
|
87 |
+
*
|
88 |
+
* @see Sinabs_Adminhtml_AjaxController
|
89 |
+
* @return string
|
90 |
+
*/
|
91 |
+
public function getAjaxSyncUrl()
|
92 |
+
{
|
93 |
+
return Mage::getSingleton('adminhtml/url')->getUrl('adminmb/ajax/runSync');
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Retourne le lien vers l'action du controller admin
|
98 |
+
*
|
99 |
+
* @see Sinabs_Adminhtml_AjaxController
|
100 |
+
* @return string
|
101 |
+
*/
|
102 |
+
public function getAjaxStopSyncUrl()
|
103 |
+
{
|
104 |
+
return Mage::getSingleton('adminhtml/url')->getUrl('adminmb/ajax/stopSync');
|
105 |
+
}
|
106 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Block/System/Config/Form/Fieldset/Import.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Block_System_Config_Form_Fieldset_Import extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Retourne le contenu HTML du fieldset
|
30 |
+
*
|
31 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
35 |
+
{
|
36 |
+
$html = $this->_getHeaderHtml($element);
|
37 |
+
$html .= Mage::helper('core')->__('Each day, the module imports the data used to manage your marketing operations.');
|
38 |
+
|
39 |
+
foreach ($element->getSortedElements() as $field) {
|
40 |
+
$html.= $field->toHtml();
|
41 |
+
}
|
42 |
+
|
43 |
+
$html .= $this->_getFooterHtml($element);
|
44 |
+
|
45 |
+
return $html;
|
46 |
+
}
|
47 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Block/System/Config/Form/Fieldset/Service.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Block_System_Config_Form_Fieldset_Service extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Retourne le contenu de l'onglet d'information
|
30 |
+
*
|
31 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
35 |
+
{
|
36 |
+
$html = $this->_getHeaderHtml($element);
|
37 |
+
$html .= Mage::helper('core')->__(
|
38 |
+
'Find all information regarding credentials on %s. as well as possible usages of the Message Business module for Magento. If you do not have an account on Message Business, %s.',
|
39 |
+
'<a href="http://campus.message-business.com" target="_blank">' . Mage::helper('core')->__('Campus Business User') . '</a>',
|
40 |
+
'<a href="http://www.message-business.com/decouvrez_Message_Business_sans_engagement_et_gratuitement.aspx" target="_blank">' . Mage::helper('core')->__('now signup to have a free evaluation of Message Business') . '</a>'
|
41 |
+
);
|
42 |
+
$html.= $this->_getFooterHtml($element);
|
43 |
+
|
44 |
+
return $html;
|
45 |
+
}
|
46 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Helper/Data.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Helper_Data extends Mage_Core_Helper_Abstract
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Section prefix
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
const XML_PATH_PREFIX = 'mb_contactssync';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Account Number
|
36 |
+
*
|
37 |
+
*/
|
38 |
+
const XML_PATH_ACCOUNT_NUMBER = 'mb_contactssync/account/account_number';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Apikey
|
42 |
+
*
|
43 |
+
*/
|
44 |
+
const XML_PATH_ACCOUNT_APIKEY = 'mb_contactssync/account/apikey';
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Access Key
|
48 |
+
*
|
49 |
+
*/
|
50 |
+
const XML_PATH_ACCOUNT_ACCESSKEY = 'mb_contactssync/accesskey';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Accept interface level
|
54 |
+
*
|
55 |
+
*/
|
56 |
+
const XML_PATH_SYNC_ACCEPT_INTERFACE_LEVEL = 'mb_contactssync/sync/accept_interface_level';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Type de synchronisation
|
60 |
+
*
|
61 |
+
*/
|
62 |
+
const XML_PATH_SYNC_FULL_EXTRACT = 'mb_contactssync/sync/full_extract';
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Accept interface option
|
66 |
+
*
|
67 |
+
*/
|
68 |
+
const XML_PATH_SYNC_ACCEPT_INTERFACE_OPTION = 'mb_contactssync/sync/accept_interface_option';
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Run Sync
|
72 |
+
*
|
73 |
+
*/
|
74 |
+
const XML_PATH_SYNC_RUN_SYNC = 'mb_contactssync/sync/run_sync';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Newsletter synchronisation
|
78 |
+
*
|
79 |
+
*/
|
80 |
+
const XML_PATH_NEWSLETTER_SUBSCRIPTION = 'mb_contactssync/newsletter/subscription';
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Optinid
|
84 |
+
*
|
85 |
+
*/
|
86 |
+
const XML_PATH_SYNC_FIELDS_OPTINID = 'mb_contactssync/fields/optinid';
|
87 |
+
|
88 |
+
/**
|
89 |
+
* optinid yes
|
90 |
+
*
|
91 |
+
*/
|
92 |
+
const XML_PATH_SYNC_FIELDS_OPTINIDYES = 'mb_contactssync/fields/optinidyes';
|
93 |
+
|
94 |
+
/**
|
95 |
+
* optinid no
|
96 |
+
*
|
97 |
+
*/
|
98 |
+
const XML_PATH_SYNC_FIELDS_OPTINIDNO = 'mb_contactssync/fields/optinidno';
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Customer ID
|
102 |
+
*
|
103 |
+
*/
|
104 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_CUSTOMERID = 'mb_contactssync/fields/magento_customerid';
|
105 |
+
|
106 |
+
/**
|
107 |
+
* ORders total
|
108 |
+
*
|
109 |
+
*/
|
110 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSTOTAL = 'mb_contactssync/fields/magento_orderstotal';
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Orders count
|
114 |
+
*
|
115 |
+
*/
|
116 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSCOUNT = 'mb_contactssync/fields/magento_orderscount';
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Last canceled cart date
|
120 |
+
*
|
121 |
+
*/
|
122 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_LASTCANCELEDCARTDATE = 'mb_contactssync/fields/magento_lastcanceledcartdate';
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Last connection
|
126 |
+
*
|
127 |
+
*/
|
128 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_LASTCONNECTION = 'mb_contactssync/fields/magento_lastconnection';
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Last order date
|
132 |
+
*
|
133 |
+
*/
|
134 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_LASTORDERDATE = 'mb_contactssync/fields/magento_lastorderdate';
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Last delivery date
|
138 |
+
*
|
139 |
+
*/
|
140 |
+
const XML_PATH_SYNC_FIELDS_MAGENTO_LASTDELIVERYDATE = 'mb_contactssync/fields/magento_lastdeliverydate';
|
141 |
+
|
142 |
+
/**
|
143 |
+
* last command
|
144 |
+
*
|
145 |
+
*/
|
146 |
+
const XML_PATH_SYNC_LASTCMD = 'mb_contactssync/fields/lastcmd';
|
147 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Helper/MbApi.php
ADDED
@@ -0,0 +1,579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Helper_MbApi extends Mage_Core_Helper_Abstract
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* URL du WSDL de Message Business
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
const MB_WSDL = 'https://services.message-business.com/v3/api/PublicInterface.svc/wsdl';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Numéro du compte
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
private $accountNumber;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* ApiKey
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
private $apikey;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* __construct
|
50 |
+
*
|
51 |
+
*/
|
52 |
+
public function __construct()
|
53 |
+
{
|
54 |
+
$this->accountNumber = Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_ACCOUNT_NUMBER);
|
55 |
+
$this->apikey = Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_ACCOUNT_APIKEY);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Sauvegarde des paramètres d'authentification
|
60 |
+
*
|
61 |
+
* @return mixed
|
62 |
+
*/
|
63 |
+
public function saveAuthConfig()
|
64 |
+
{
|
65 |
+
if ($this->setPrivateKey()) {
|
66 |
+
$this->setBaseUrl();
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Import / configuration de Message Business
|
72 |
+
*
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function runImport()
|
76 |
+
{
|
77 |
+
try {
|
78 |
+
|
79 |
+
$this->setResultFields();
|
80 |
+
|
81 |
+
// Création des champs optin
|
82 |
+
$this->createOptinFields();
|
83 |
+
|
84 |
+
// Création des champs personnalisés
|
85 |
+
$this->createAdditionalFields();
|
86 |
+
$this->createSegments();
|
87 |
+
|
88 |
+
// Version synchro complète
|
89 |
+
if(Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_ACCEPT_INTERFACE_LEVEL) == MessageBusiness_ContactsSync_Model_System_Config_Source_Synchro_Type::SYNC_COMPLETE) {
|
90 |
+
$this->createAdditionalFieldsFull();
|
91 |
+
$this->createSegmentsFull();
|
92 |
+
}
|
93 |
+
|
94 |
+
// Synchro des contacts
|
95 |
+
$this->syncContacts();
|
96 |
+
|
97 |
+
} catch (Exception $e) {
|
98 |
+
//Mage::getSingleton('core/session')->addError($e->getMessage());
|
99 |
+
}
|
100 |
+
|
101 |
+
return $result;
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Import / configuration de Message Business
|
107 |
+
*
|
108 |
+
* @return mixed
|
109 |
+
*/
|
110 |
+
public function stopImport()
|
111 |
+
{
|
112 |
+
try {
|
113 |
+
$this->getSoapClient()->SetAccountDataAttribute(array(
|
114 |
+
'accountId' => $this->accountNumber,
|
115 |
+
'apiKey' => $this->apikey,
|
116 |
+
'dataId' => 2,
|
117 |
+
'dataValue' => 'stop extract'
|
118 |
+
));
|
119 |
+
sleep(3);
|
120 |
+
} catch (Exception $e) {
|
121 |
+
//Mage::getSingleton('core/session')->addError($e->getMessage());
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Paramétrage et envoi de la commande d'import Message Business
|
128 |
+
*
|
129 |
+
*/
|
130 |
+
private function syncContacts()
|
131 |
+
{
|
132 |
+
try {
|
133 |
+
$fullExtract = (Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FULL_EXTRACT)) ? ' full' : '';
|
134 |
+
$withOptinSync = (Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_ACCEPT_INTERFACE_OPTION)) ? ' withoptinsync' : '';
|
135 |
+
$offset = new DateTime('now');
|
136 |
+
$offset = $offset->format('Z');
|
137 |
+
$cmd = 'start extract'.$withOptinSync.''.$fullExtract.' offset='.$offset.' culture=' . Mage::getStoreConfig('general/country/default') . '-' . Mage::getStoreConfig('general/locale/code');
|
138 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_LASTCMD, $cmd);
|
139 |
+
|
140 |
+
$this->getSoapClient()->SetAccountDataAttribute(array(
|
141 |
+
'accountId' => $this->accountNumber,
|
142 |
+
'apiKey' => $this->apikey,
|
143 |
+
'dataId' => 2,
|
144 |
+
'dataValue' => $cmd));
|
145 |
+
sleep(3);
|
146 |
+
} catch (Exception $e) {
|
147 |
+
//Mage::getSingleton('core/session')->addError($e->getMessage());
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Récupération et set des champs personnalisés
|
153 |
+
*
|
154 |
+
*/
|
155 |
+
private function setResultFields()
|
156 |
+
{
|
157 |
+
$this->resultFields = $this->getSoapClient()->GetAccountContactAttributes(array(
|
158 |
+
'accountId' => $this->accountNumber,
|
159 |
+
'apiKey' => $this->apikey))
|
160 |
+
->GetAccountContactAttributesResult;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Création des champs personnalisés d'optin
|
165 |
+
*
|
166 |
+
* @return true
|
167 |
+
*/
|
168 |
+
private function createOptinFields()
|
169 |
+
{
|
170 |
+
if (is_null(Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID))) {
|
171 |
+
// Champ principal optin
|
172 |
+
$optinid = $this->getSoapClient()->AddAccountContactAttribute(array(
|
173 |
+
'accountId' => $this->accountNumber,
|
174 |
+
'apiKey' => $this->apikey,
|
175 |
+
'name' => Mage::helper('core')->__('[MG] Newsletter subscriber'),
|
176 |
+
'format' => 'SingleSelection|magento_optin'))
|
177 |
+
->AddAccountContactAttributeResult;
|
178 |
+
|
179 |
+
// Optinidno
|
180 |
+
$optinidno = $this->getSoapClient()->AddAccountContactAttributeValue(array(
|
181 |
+
'accountId' => $this->accountNumber,
|
182 |
+
'apiKey' => $this->apikey,
|
183 |
+
'attributeId' => $optinid,
|
184 |
+
'value' => Mage::helper('core')->__('No'),
|
185 |
+
'index' => '0'))
|
186 |
+
->AddAccountContactAttributeValueResult;
|
187 |
+
|
188 |
+
// Optinidyes
|
189 |
+
$optinidyes = $this->getSoapClient()->AddAccountContactAttributeValue(array(
|
190 |
+
'accountId' => $this->accountNumber,
|
191 |
+
'apiKey' => $this->apikey,
|
192 |
+
'attributeId' => $optinid,
|
193 |
+
'value' => Mage::helper('core')->__('Yes'),
|
194 |
+
'index' => '1'))
|
195 |
+
->AddAccountContactAttributeValueResult;
|
196 |
+
|
197 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID, $optinid);
|
198 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDYES, $optinidyes);
|
199 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDNO, $optinidno);
|
200 |
+
Mage::getConfig()->reinit();
|
201 |
+
}
|
202 |
+
|
203 |
+
return true;
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Création des champs personnalisés dans Message Business
|
208 |
+
*
|
209 |
+
*/
|
210 |
+
private function createAdditionalFields()
|
211 |
+
{
|
212 |
+
$doc = new DOMDocument();
|
213 |
+
$doc->loadXML($this->resultFields);
|
214 |
+
$xpath = new DOMXPath($doc);
|
215 |
+
|
216 |
+
$fields = array();
|
217 |
+
|
218 |
+
if (Mage::getStoreConfig('customer/address/dob_show') == 'opt' ||
|
219 |
+
Mage::getStoreConfig('customer/address/dob_show') == 'req') {
|
220 |
+
$fields[] = array('magento_birthday', '[MG] Date of Birth', 'DateTime');
|
221 |
+
}
|
222 |
+
|
223 |
+
foreach($fields as $field) {
|
224 |
+
$query = "//Fields/Field[@Description='".$field[0]."']";
|
225 |
+
$entries = $xpath->query($query);
|
226 |
+
if ($entries->length == 0) {
|
227 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_PREFIX . '/fields/' . $field[0],
|
228 |
+
$this->getSoapClient()->AddAccountContactAttribute(array(
|
229 |
+
'accountId' => $this->accountNumber,
|
230 |
+
'apiKey' => $this->apikey,
|
231 |
+
'name' => Mage::helper('core')->__($field[1]),
|
232 |
+
'format' => $field[2].'|'.$field[0]))
|
233 |
+
->AddAccountContactAttributeResult);
|
234 |
+
}
|
235 |
+
}
|
236 |
+
Mage::getConfig()->reinit();
|
237 |
+
return true;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Création des champs personnalisés dans Message Business (version Full)
|
242 |
+
*
|
243 |
+
*/
|
244 |
+
private function createAdditionalFieldsFull()
|
245 |
+
{
|
246 |
+
$doc = new DOMDocument();
|
247 |
+
$doc->loadXML($this->resultFields);
|
248 |
+
$xpath = new DOMXPath($doc);
|
249 |
+
|
250 |
+
$fields = array(
|
251 |
+
array('magento_dateadd', '[MG] Date of Registration', 'DateTime'),
|
252 |
+
array('magento_customerid', '[MG] Customer ID in Magento', 'ShortText'),
|
253 |
+
array('magento_lastconnection', '[MG] Date of Last Customer Login', 'DateTime'),
|
254 |
+
array('magento_lastcancelledcartdate', '[MG] Last Date of Abandoned Shopping cart', 'DateTime'),
|
255 |
+
array('magento_lastdeliverydate', '[MG] Date of Last Delivery', 'DateTime'),
|
256 |
+
array('magento_lastorderdate', '[MG] Date of Last Order', 'DateTime'),
|
257 |
+
array('magento_lastordertotal', '[MG] Amount of Last Order', 'Number'),
|
258 |
+
array('magento_firstorderdate', '[MG] Date of First Order', 'DateTime'),
|
259 |
+
array('magento_ordersfrequency', '[MG] Average frequency between Orders (days)', 'Number'),
|
260 |
+
array('magento_orderstotal', '[MG] Total Orders Amount', 'Number'),
|
261 |
+
array('magento_orderscount', '[MG] Total Orders', 'Number')
|
262 |
+
);
|
263 |
+
|
264 |
+
foreach($fields as $field) {
|
265 |
+
$query = "//Fields/Field[@Description='".$field[0]."']";
|
266 |
+
$entries = $xpath->query($query);
|
267 |
+
if ($entries->length == 0) {
|
268 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_PREFIX . '/fields/' . $field[0],
|
269 |
+
$this->getSoapClient()->AddAccountContactAttribute(array(
|
270 |
+
'accountId' => $this->accountNumber,
|
271 |
+
'apiKey' => $this->apikey,
|
272 |
+
'name' => Mage::helper('core')->__($field[1]),
|
273 |
+
'format' => $field[2].'|'.$field[0]))
|
274 |
+
->AddAccountContactAttributeResult);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
Mage::getConfig()->reinit();
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Création des segments
|
283 |
+
*
|
284 |
+
* @return true
|
285 |
+
*/
|
286 |
+
private function createSegments()
|
287 |
+
{
|
288 |
+
$result = $this->getSoapClient()->GetAccountSegments(array(
|
289 |
+
'accountId' => $this->accountNumber,
|
290 |
+
'apiKey' => $this->apikey))
|
291 |
+
->GetAccountSegmentsResult;
|
292 |
+
$doc = new DOMDocument();
|
293 |
+
$doc->loadXML($result);
|
294 |
+
$xpath = new DOMXPath($doc);
|
295 |
+
|
296 |
+
$segments = array(
|
297 |
+
array(
|
298 |
+
'name' => 'Newsletter Subcribers - All [MG]',
|
299 |
+
'mode' => 'Intersection',
|
300 |
+
'id' => 'magento_subscribers',
|
301 |
+
'details' => '<Criterias><Criteria guid="f8bd77f7-800b-4425-bc05-93e409533636" reference="selection-equals-list" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID) . '" op="selection-equals-list" is="true" value1="0,' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDYES) . ',0" value2="" /></Criterias>'
|
302 |
+
)
|
303 |
+
);
|
304 |
+
|
305 |
+
foreach($segments as $segment) {
|
306 |
+
$query = "//Segments/Segment[@Description='".$segment['id']."']";
|
307 |
+
$entries = $xpath->query($query);
|
308 |
+
if ($entries->length == 0) {
|
309 |
+
$res = $this->getSoapClient()->AddAccountSegment(array(
|
310 |
+
'accountId' => $this->accountNumber,
|
311 |
+
'apiKey' => $this->apikey,
|
312 |
+
'name' => Mage::helper('core')->__($segment['name']) . ' [MG]',
|
313 |
+
'mode' => $segment['mode'].'|'.$segment['id'],
|
314 |
+
'details' => $segment['details']));
|
315 |
+
}
|
316 |
+
}
|
317 |
+
return true;
|
318 |
+
}
|
319 |
+
|
320 |
+
/**
|
321 |
+
* Création des segments (version full)
|
322 |
+
*
|
323 |
+
*/
|
324 |
+
private function createSegmentsFull()
|
325 |
+
{
|
326 |
+
$result = $this->getSoapClient()->GetAccountSegments(array(
|
327 |
+
'accountId' => $this->accountNumber,
|
328 |
+
'apiKey' => $this->apikey))
|
329 |
+
->GetAccountSegmentsResult;
|
330 |
+
$doc = new DOMDocument();
|
331 |
+
$doc->loadXML($result);
|
332 |
+
$xpath = new DOMXPath($doc);
|
333 |
+
|
334 |
+
$segments = array(
|
335 |
+
array(
|
336 |
+
'name' => 'Registered Newsletter - Customers [MG]',
|
337 |
+
'mode' => 'Intersection',
|
338 |
+
'id' => 'magento_subscriberscustomers',
|
339 |
+
'details' => '<Criterias><Criteria guid="f8bd77f7-800b-4425-bc05-93e409533636" reference="selection-equals-list" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID) . '" op="selection-equals-list" is="true" value1="0,' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDYES) . ',0" value2="" /><Criteria guid="e2eced35-0a19-4d35-8fa4-a377e6cd15f1" reference="str-containssomething" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_CUSTOMERID) . '" op="str-containssomething" is="true" value1="" value2="" /></Criterias>'
|
340 |
+
),
|
341 |
+
array(
|
342 |
+
'name' => 'Registered Newsletter - Not Customers [MG]',
|
343 |
+
'mode' => 'Intersection',
|
344 |
+
'id' => 'magento_subscribersnotcustomers',
|
345 |
+
'details' => '<Criterias><Criteria guid="f8bd77f7-800b-4425-bc05-93e409533636" reference="selection-equals-list" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID) . '" op="selection-equals-list" is="true" value1="0,' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDYES) . ',0" value2="" /><Criteria guid="e2eced35-0a19-4d35-8fa4-a377e6cd15f1" reference="!str-containssomething" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_CUSTOMERID) . '" op="str-containssomething" is="false" value1="" value2="" /></Criterias>'
|
346 |
+
),
|
347 |
+
array(
|
348 |
+
'name' => 'Customers - All [MG]',
|
349 |
+
'mode' => 'Intersection',
|
350 |
+
'id' => 'magento_customers',
|
351 |
+
'details' => '<Criterias><Criteria guid="e2eced35-0a19-4d35-8fa4-a377e6cd15f1" reference="str-containssomething" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_CUSTOMERID) . '" op="str-containssomething" is="true" value1="" value2="" /></Criterias>'
|
352 |
+
),
|
353 |
+
array(
|
354 |
+
'name' => 'Customers - Without Revenue [MG]',
|
355 |
+
'mode' => 'Intersection',
|
356 |
+
'id' => 'magento_customerswithoutpurchases',
|
357 |
+
'details' => '<Criterias><Criteria guid="28c30297-4706-48af-8afb-b1216c9a394a" reference="num-equals" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSTOTAL) . '" op="num-equals" is="true" value1="0" value2="" /></Criterias>'
|
358 |
+
),
|
359 |
+
array(
|
360 |
+
'name' => 'Customers - With Revenue [MG]',
|
361 |
+
'mode' => 'Intersection',
|
362 |
+
'id' => 'magento_customerswithpurchases',
|
363 |
+
'details' => '<Criterias><Criteria guid="28c30297-4706-48af-8afb-b1216c9a394a" reference="num-higher-strict" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSTOTAL) . '" op="num-higher-strict" is="true" value1="0" value2="" /></Criterias>'
|
364 |
+
),
|
365 |
+
array(
|
366 |
+
'name' => 'Customers [MG] First purchase',
|
367 |
+
'mode' => 'Intersection',
|
368 |
+
'id' => 'magento_customersnew',
|
369 |
+
'details' => '<Criterias><Criteria guid="383dcf98-82af-4962-a73f-30c0fda09c46" reference="num-equals" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSCOUNT) . '" op="num-equals" is="true" value1="1" value2="" /><Criteria guid="28c30297-4706-48af-8afb-b1216c9a394a" reference="num-higher-strict" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSTOTAL) . '" op="num-higher-strict" is="true" value1="0" value2="" /></Criterias>'
|
370 |
+
),
|
371 |
+
array(
|
372 |
+
'name' => 'Customers [MG] 2 Purchases and More',
|
373 |
+
'mode' => 'Intersection',
|
374 |
+
'id' => 'magento_customersnotnew',
|
375 |
+
'details' => '<Criterias><Criteria guid="7f508a38-1426-4f7b-bacd-7c6fd5186ead" reference="num-higher" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSCOUNT) . '" op="num-higher" is="true" value1="2" value2="" /><Criteria guid="28c30297-4706-48af-8afb-b1216c9a394a" reference="num-higher-strict" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSTOTAL) . '" op="num-higher-strict" is="true" value1="0" value2="" /></Criterias>'
|
376 |
+
),
|
377 |
+
array(
|
378 |
+
'name' => 'Customers [MG] with cancelled carts (over 2 days)',
|
379 |
+
'mode' => 'Intersection',
|
380 |
+
'id' => 'magento_customerscancelled',
|
381 |
+
'details' => '<Criterias><Criteria guid="68e3188d-29d7-4bda-9755-cc47d6078f1f" reference="num-higher" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSCOUNT) . '" op="num-higher" is="true" value1="1" value2="" /><Criteria guid="2f0a2931-754c-4082-8bb5-268772669906" reference="date-containssomething" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTCANCELEDCARTDATE) . '" op="date-containssomething" is="true" value1="" value2="" /></Criterias>'
|
382 |
+
),
|
383 |
+
array(
|
384 |
+
'name' => 'Contacts [MG] and Customers [MG] with cancelled carts (over 2 days)',
|
385 |
+
'mode' => 'Intersection',
|
386 |
+
'id' => 'magento_contactscancelled',
|
387 |
+
'details' => '<Criterias><Criteria guid="2f0a2931-754c-4082-8bb5-268772669906" reference="date-containssomething" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTCANCELEDCARTDATE) . '" op="date-containssomething" is="true" value1="" value2="" /></Criterias>'
|
388 |
+
),
|
389 |
+
array(
|
390 |
+
'name' => 'Customers [MG] Motivated (30 days)',
|
391 |
+
'mode' => 'Intersection',
|
392 |
+
'id' => 'magento_contactsmotivated',
|
393 |
+
'details' => '<Criterias><Criteria guid="458a4bfe-7706-4fb6-bde1-8f2d56ff8f26" reference="date-before-less-absnow" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTCONNECTION) . '" op="date-before-less-absnow" is="true" value1="30" value2="" /><Criteria guid="d1917c79-8fc6-45d5-bfb2-a4256a881dff" reference="date-before-more-absnow" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTORDERDATE) . '" op="date-before-more-absnow" is="true" value1="30" value2="" /></Criterias>'
|
394 |
+
),
|
395 |
+
array(
|
396 |
+
'name' => 'Customers [MG] Delivered (last 7 days)',
|
397 |
+
'mode' => 'Intersection',
|
398 |
+
'id' => 'magento_customersdelivered',
|
399 |
+
'details' => '<Criterias><Criteria guid="44cf1ecd-8126-49ff-af2e-675743c78f37" reference="date-before-more-absnow" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTDELIVERYDATE) . '" op="date-before-more-absnow" is="true" value1="7" value2="" /></Criterias>'
|
400 |
+
),
|
401 |
+
array(
|
402 |
+
'name' => 'Customers [MG] 90 days without order',
|
403 |
+
'mode' => 'Intersection',
|
404 |
+
'id' => 'magento_customersnorecentorder',
|
405 |
+
'details' => '<Criterias><Criteria guid="79f1bb64-46d7-436a-a24f-1ebd9a5eafab" reference="num-higher" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_ORDERSCOUNT) . '" op="num-higher" is="true" value1="1" value2="" /><Criteria guid="974fd0b9-cea2-4045-bf1e-5f09a5b21610" reference="date-before-more-absnow" type="ContactAttribute" id="' . Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_MAGENTO_LASTDELIVERYDATE) . '" op="date-before-more-absnow" is="true" value1="90" value2="" /></Criterias>'
|
406 |
+
)
|
407 |
+
);
|
408 |
+
|
409 |
+
foreach($segments as $segment) {
|
410 |
+
$query = "//Segments/Segment[@Description='".$segment['id']."']";
|
411 |
+
$entries = $xpath->query($query);
|
412 |
+
if ($entries->length == 0) {
|
413 |
+
$res = $this->getSoapClient()->AddAccountSegment(array(
|
414 |
+
'accountId' => $this->accountNumber,
|
415 |
+
'apiKey' => $this->apikey,
|
416 |
+
'name' => Mage::helper('core')->__($segment['name']),
|
417 |
+
'mode' => $segment['mode'].'|'.$segment['id'],
|
418 |
+
'details' => $segment['details']));
|
419 |
+
}
|
420 |
+
}
|
421 |
+
return true;
|
422 |
+
}
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Génération de l'accessKey
|
426 |
+
*
|
427 |
+
* @return mixed
|
428 |
+
*/
|
429 |
+
public function generateAccesskey($length = 32)
|
430 |
+
{
|
431 |
+
$str = 'abcdefghijkmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
432 |
+
for ($i = 0, $passwd = ''; $i < $length; $i++) {
|
433 |
+
$passwd .= substr($str, mt_rand(0, strlen($str) - 1), 1);
|
434 |
+
}
|
435 |
+
Mage::getModel('core/config')->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_ACCOUNT_ACCESSKEY, $passwd);
|
436 |
+
return $passwd;
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Récupération de l'accesskey
|
441 |
+
*
|
442 |
+
* @return mixed|null
|
443 |
+
*/
|
444 |
+
public function getAccessKey()
|
445 |
+
{
|
446 |
+
$accessKey = Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_ACCOUNT_ACCESSKEY);
|
447 |
+
if (is_null($accessKey)) {
|
448 |
+
$accessKey = $this->generateAccesskey();
|
449 |
+
}
|
450 |
+
return $accessKey;
|
451 |
+
}
|
452 |
+
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Récupération d'une valeur MB par son dataId
|
456 |
+
*
|
457 |
+
* @return mixed
|
458 |
+
*/
|
459 |
+
public function getDataValue($dataId)
|
460 |
+
{
|
461 |
+
return $this->callApi('GetAccountDataAttribute', array(
|
462 |
+
'accountId' => $this->accountNumber,
|
463 |
+
'apiKey' => $this->apikey,
|
464 |
+
'dataId' => $dataId
|
465 |
+
));
|
466 |
+
}
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Enregistrement de l'URL de l'instance Magento dans Message Business
|
470 |
+
*
|
471 |
+
* @return mixed
|
472 |
+
*/
|
473 |
+
public function setBaseUrl()
|
474 |
+
{
|
475 |
+
try {
|
476 |
+
return $this->getSoapClient()->SetAccountDataAttribute(array(
|
477 |
+
'accountId' => $this->accountNumber,
|
478 |
+
'apiKey' => $this->apikey,
|
479 |
+
'dataId' => 0,
|
480 |
+
'dataValue' => Mage::getBaseUrl() . '[MAGENTO]'
|
481 |
+
));
|
482 |
+
} catch (Exception $e) {
|
483 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__("An error has occurred"));
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Enregistrement de l'apiKey dans Message Business
|
489 |
+
*
|
490 |
+
* @return mixed
|
491 |
+
*/
|
492 |
+
public function setPrivateKey()
|
493 |
+
{
|
494 |
+
try {
|
495 |
+
return $this->getSoapClient()->SetAccountDataAttribute(array(
|
496 |
+
'accountId' => $this->accountNumber,
|
497 |
+
'apiKey' => $this->apikey,
|
498 |
+
'dataId' => 1,
|
499 |
+
'dataValue' => $this->getAccessKey()
|
500 |
+
));
|
501 |
+
} catch (Exception $e) {
|
502 |
+
$message = "An error has occurred";
|
503 |
+
if (strpos($e->getMessage(), 'Account not existing') !== false) {
|
504 |
+
$message = "The specified Message Business account number is not known. This may be an error in typing the account number or this account is no longer existing.";
|
505 |
+
} else if (strpos($e->getMessage(), 'Account not activated or validated') !== false) {
|
506 |
+
$message = "The specified Message Business account is not yet activated. Please login, and activate the specified account before continuing the configuration of the module.";
|
507 |
+
} else if (strpos($e->getMessage(), 'Account hasn\'t any API key') !== false ||
|
508 |
+
strpos($e->getMessage(), 'Account has an empty API key') !== false) {
|
509 |
+
$message = "There's no API key currently set for this Message Business account. Please login, then go the the section More > Your Settings > Language and Interface and generate a new API key Note: The new API key will be available one hour after its generation.";
|
510 |
+
} else if (strpos($e->getMessage(), 'Account does not have the specified API key') !== false) {
|
511 |
+
$message = "The API key you have typed does not match one the keys of the specified Message Business account. Please login, then go to the section More > Your Settings > Language and Interface and copy an already existing API key or generate a new one. Note: The new API key will be available one hour after its generation.";
|
512 |
+
}
|
513 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('core')->__($message));
|
514 |
+
return false;
|
515 |
+
}
|
516 |
+
|
517 |
+
}
|
518 |
+
|
519 |
+
|
520 |
+
/**
|
521 |
+
* Push d'un email optin dans Message Business
|
522 |
+
*
|
523 |
+
* @return mixed
|
524 |
+
*/
|
525 |
+
public function pushOptin($email, $status)
|
526 |
+
{
|
527 |
+
$contactDatas = $this->getSoapClient()->SetContactData(
|
528 |
+
array(
|
529 |
+
'accountId' => $this->accountNumber,
|
530 |
+
'apiKey' => $this->apikey,
|
531 |
+
'contactKey' => $email,
|
532 |
+
'attributeId' => Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINID),
|
533 |
+
'data' => ($status === true) ? Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDYES) : Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FIELDS_OPTINIDNO),
|
534 |
+
'createIfKeyNotExisting'=>'true'
|
535 |
+
)
|
536 |
+
);
|
537 |
+
|
538 |
+
$contactDatas = $this->getSoapClient()->SetContactData(
|
539 |
+
array(
|
540 |
+
'accountId' => $this->accountNumber,
|
541 |
+
'apiKey' => $this->apikey,
|
542 |
+
'contactKey' => $email,
|
543 |
+
'attributeId' => 'emailoptin',
|
544 |
+
'data' => 'yes1',
|
545 |
+
'createIfKeyNotExisting'=>'true'
|
546 |
+
)
|
547 |
+
);
|
548 |
+
|
549 |
+
return true;
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Appel de l'API Message Business
|
554 |
+
*
|
555 |
+
* @param string $action
|
556 |
+
* @param array $args
|
557 |
+
* @return mixed
|
558 |
+
*/
|
559 |
+
public function callApi($action, array $args = array())
|
560 |
+
{
|
561 |
+
try {
|
562 |
+
$result = $this->getSoapClient()->$action($args);
|
563 |
+
} catch (Exception $e) {
|
564 |
+
//Mage::getSingleton('core/session')->addError($e->getMessage());
|
565 |
+
}
|
566 |
+
|
567 |
+
return $result;
|
568 |
+
}
|
569 |
+
|
570 |
+
/**
|
571 |
+
* Retourne l'objet SoapClient de Message Business
|
572 |
+
*
|
573 |
+
* @return SoapClient
|
574 |
+
*/
|
575 |
+
public function getSoapClient()
|
576 |
+
{
|
577 |
+
return new SoapClient(self::MB_WSDL);
|
578 |
+
}
|
579 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Model/Observer.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Model_Observer
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Vérification des identifiants Message Business
|
31 |
+
*
|
32 |
+
* @param Varien_Event_Observer $observer
|
33 |
+
* @return MessageBusiness_ContactsSync_Model_Observer
|
34 |
+
*/
|
35 |
+
public function saveConfig($observer)
|
36 |
+
{
|
37 |
+
Mage::helper('contactssync/mbApi')->saveAuthConfig();
|
38 |
+
return $this;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Souscription ou désabonnement à la Newsletter
|
43 |
+
*
|
44 |
+
* @param Varien_Event_Observer $observer
|
45 |
+
* @return MessageBusiness_ContactsSync_Model_Observer
|
46 |
+
*/
|
47 |
+
public function newsletterSubscriberChange($observer)
|
48 |
+
{
|
49 |
+
$subscriber = $observer->getEvent()->getSubscriber();
|
50 |
+
|
51 |
+
if (Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_NEWSLETTER_SUBSCRIPTION) == MessageBusiness_ContactsSync_Model_System_Config_Source_Newsletter_Subscription::SUBSCRIBE_YES) {
|
52 |
+
switch ($subscriber->getStatus()) {
|
53 |
+
case Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED: // souscription à la newsletter
|
54 |
+
Mage::helper('contactssync/mbApi')->pushOptin($subscriber->getEmail(), true);
|
55 |
+
break;
|
56 |
+
case Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED: // désinscription à la newsletter (non géré)
|
57 |
+
Mage::helper('contactssync/mbApi')->pushOptin($subscriber->getEmail(), false);
|
58 |
+
break;
|
59 |
+
default:
|
60 |
+
break;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Model/System/Config/Source/Newsletter/Subscription.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Model_System_Config_Source_Newsletter_Subscription
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Synchronisation simple
|
30 |
+
*
|
31 |
+
* @var int
|
32 |
+
*/
|
33 |
+
const SUBSCRIBE_YES = 1;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Synchronisation complète
|
37 |
+
*
|
38 |
+
* @var int
|
39 |
+
*/
|
40 |
+
const SUBSCRIBE_NO = 2;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retourne les différents type de synchronisation
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function toOptionArray()
|
48 |
+
{
|
49 |
+
return array(
|
50 |
+
array(
|
51 |
+
'label' => Mage::helper('core')->__('Subscribe contacts in Message Business when subscribed in Magento newsletter'),
|
52 |
+
'value' => self::SUBSCRIBE_YES
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'label' => Mage::helper('core')->__('Do not subscribe contacts in Message Business'),
|
56 |
+
'value' => self::SUBSCRIBE_NO
|
57 |
+
)
|
58 |
+
);
|
59 |
+
}
|
60 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/Model/System/Config/Source/Synchro/Type.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Model_System_Config_Source_Synchro_Type
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Synchronisation simple
|
30 |
+
*
|
31 |
+
* @var int
|
32 |
+
*/
|
33 |
+
const SYNC_SIMPLE = 1;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Synchronisation complète
|
37 |
+
*
|
38 |
+
* @var int
|
39 |
+
*/
|
40 |
+
const SYNC_COMPLETE = 2;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Retourne les différents type de synchronisation
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function toOptionArray()
|
48 |
+
{
|
49 |
+
return array(
|
50 |
+
array(
|
51 |
+
'label' => Mage::helper('core')->__('Import includes contact (email, name, ...), as well as customer data (Revenue, frequency)'),
|
52 |
+
'value' => self::SYNC_COMPLETE
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'label' => Mage::helper('core')->__('Import only contact details (email, name, ...)'),
|
56 |
+
'value' => self::SYNC_SIMPLE
|
57 |
+
)
|
58 |
+
);
|
59 |
+
}
|
60 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/controllers/Adminhtml/AjaxController.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_Adminhtml_AjaxController extends Mage_Adminhtml_Controller_Action
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Lancement de la synchronisation
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
public function runSyncAction()
|
33 |
+
{
|
34 |
+
$response = array();
|
35 |
+
$this->_setConfig();
|
36 |
+
Mage::getConfig()->reinit();
|
37 |
+
try {
|
38 |
+
$fields = Mage::helper('contactssync/mbApi')->runImport();
|
39 |
+
$response['result'] = $fields;
|
40 |
+
} catch (Exception $e) {
|
41 |
+
$response['error'] = $e->getMessage();
|
42 |
+
}
|
43 |
+
|
44 |
+
$this->getResponse()->setBody(Zend_Json::encode($response));
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Lancement de la synchronisation
|
49 |
+
*
|
50 |
+
*/
|
51 |
+
public function stopSyncAction()
|
52 |
+
{
|
53 |
+
$response = array();
|
54 |
+
|
55 |
+
try {
|
56 |
+
$fields = Mage::helper('contactssync/mbApi')->stopImport();
|
57 |
+
$response['result'] = $fields;
|
58 |
+
} catch (Exception $e) {
|
59 |
+
$response['error'] = $e->getMessage();
|
60 |
+
}
|
61 |
+
|
62 |
+
$this->getResponse()->setBody(Zend_Json::encode($response));
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Enregistrement des valeurs courantes du formulaire de configuration de l'import
|
67 |
+
*
|
68 |
+
*/
|
69 |
+
private function _setConfig()
|
70 |
+
{
|
71 |
+
Mage::getConfig()->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_ACCEPT_INTERFACE_OPTION, $this->getRequest()->getParam('acceptInterfaceOption'));
|
72 |
+
Mage::getConfig()->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_ACCEPT_INTERFACE_LEVEL, $this->getRequest()->getParam('acceptInterfaceLevel'));
|
73 |
+
Mage::getConfig()->saveConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_FULL_EXTRACT, $this->getRequest()->getParam('fullExtract'));
|
74 |
+
|
75 |
+
Mage::getConfig()->reinit();
|
76 |
+
}
|
77 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/controllers/InterfaceController.php
ADDED
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_AFL.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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category MessageBusiness
|
22 |
+
* @package MessageBusiness_ContactsSync
|
23 |
+
* @author Sinabs - http://www.sinabs.fr
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
class MessageBusiness_ContactsSync_InterfaceController extends Mage_Core_Controller_Front_Action
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Ips autorisées à accéder à l'interface Message Business
|
30 |
+
*
|
31 |
+
* @var array
|
32 |
+
*/
|
33 |
+
private $_ipAlloweds = array(
|
34 |
+
'217.174.192.16',
|
35 |
+
'217.174.192.17',
|
36 |
+
'217.174.192.18',
|
37 |
+
'217.174.192.19',
|
38 |
+
'217.174.192.20',
|
39 |
+
'217.174.192.21',
|
40 |
+
'217.174.192.22',
|
41 |
+
'217.174.192.23',
|
42 |
+
'127.0.0.1'
|
43 |
+
);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* XML Object
|
47 |
+
*
|
48 |
+
* @var DOMDocument
|
49 |
+
*/
|
50 |
+
private $_xml;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Intercepte les méthodes de l'interface qui ne sont pas implémentées
|
54 |
+
*
|
55 |
+
* @param string $method
|
56 |
+
* @param array $args
|
57 |
+
*/
|
58 |
+
public function __call($method, $args)
|
59 |
+
{
|
60 |
+
throw new Exception("Unknown or bad parameters");
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Centralise l'appel au méthodes de l'interface
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public function callAction()
|
68 |
+
{
|
69 |
+
$this->_xml = new DOMDocument('1.0', 'UTF-8');
|
70 |
+
|
71 |
+
try {
|
72 |
+
$this->_isAccess();
|
73 |
+
call_user_func(array($this, '_' . strtolower($this->getRequest()->getParam('request'))));
|
74 |
+
} catch (Exception $e) {
|
75 |
+
$eError = $this->_xml->createElement('error', $e->getMessage());
|
76 |
+
$this->_xml->appendChild($eError);
|
77 |
+
}
|
78 |
+
|
79 |
+
$this->getResponse()
|
80 |
+
->clearHeaders()
|
81 |
+
->setHeader('Content-Type', 'text/xml')
|
82 |
+
->setBody($this->_xml->saveXML());
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Vérification de l'accès à l'interface Magento
|
87 |
+
*
|
88 |
+
*/
|
89 |
+
private function _isAccess()
|
90 |
+
{
|
91 |
+
if (!in_array(Mage::helper('core/http')->getRemoteAddr(), $this->_ipAlloweds)) {
|
92 |
+
throw new Exception("Access denied for this I0 : " . Mage::helper('core/http')->getRemoteAddr());
|
93 |
+
}
|
94 |
+
|
95 |
+
if($this->getRequest()->getParam('accesskey') != Mage::helper('contactssync/mbApi')->getAccessKey()) {
|
96 |
+
throw new Exception("Invalid accesskey");
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Vérifie si le client est abonné à la newsletter
|
102 |
+
*
|
103 |
+
* @param string $email
|
104 |
+
* @param int $idCustomer
|
105 |
+
* @return bool
|
106 |
+
*/
|
107 |
+
private function _isOptin($email, $idCustomer)
|
108 |
+
{
|
109 |
+
return Mage::getModel('newsletter/subscriber')->loadByEmail($email, $idCustomer)->isSubscribed() ? 1 : 0;
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Mise à jour des optin
|
114 |
+
*
|
115 |
+
*/
|
116 |
+
protected function _updateOptin()
|
117 |
+
{
|
118 |
+
$request = $this->getRequest();
|
119 |
+
$email = $request->getParam('email');
|
120 |
+
$value = $request->getParam('value');
|
121 |
+
$id = $request->getParam('id');
|
122 |
+
|
123 |
+
if ($email == null || $value == null || $id == null) {
|
124 |
+
throw new Exception("Unknown or bad parameters");
|
125 |
+
}
|
126 |
+
|
127 |
+
$newsletter = Mage::getModel('newsletter/subscriber')
|
128 |
+
->loadByEmail($email, $id)
|
129 |
+
->setStatus($value == 0 ? Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED : Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
|
130 |
+
->save();
|
131 |
+
|
132 |
+
$element = $this->_xml->createElement('result', 'update optin done for ' . $newsletter->getCustomerId() . ' with ' . $value);
|
133 |
+
$this->_xml->appendChild($element);
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Retourne l'ensemble des inscrits à la newsletter
|
138 |
+
*
|
139 |
+
*/
|
140 |
+
protected function _allSubscribers()
|
141 |
+
{
|
142 |
+
$collection = Mage::getModel('newsletter/subscriber')
|
143 |
+
->getCollection()
|
144 |
+
->useOnlySubscribed();
|
145 |
+
|
146 |
+
if ($collection->count() > 0) {
|
147 |
+
$subscribers = $this->_xml->createElement('subscribers');
|
148 |
+
|
149 |
+
foreach ($collection as $customer) {
|
150 |
+
$subscribe = $this->_xml->createElement('subscriber');
|
151 |
+
$email = $this->_xml->createElement('email', $customer->getEmail());
|
152 |
+
$value = $this->_xml->createElement('value', $customer->getStatus());
|
153 |
+
|
154 |
+
$subscribe->appendChild($email);
|
155 |
+
$subscribe->appendChild($value);
|
156 |
+
$subscribers->appendChild($subscribe);
|
157 |
+
$this->_xml->appendChild($subscribers);
|
158 |
+
}
|
159 |
+
} else {
|
160 |
+
$this->_xml->appendChild($this->_xml->createElement('subscribers'));
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Retourne l'identifiant Magento de tout les clients
|
166 |
+
*
|
167 |
+
* @param string
|
168 |
+
*/
|
169 |
+
protected function _allCustomerIds($date = null)
|
170 |
+
{
|
171 |
+
$customers = Mage::getModel('customer/customer')
|
172 |
+
->getCollection()
|
173 |
+
->addAttributeToSelect('id');
|
174 |
+
|
175 |
+
$orders = array();
|
176 |
+
if ($date != null) {
|
177 |
+
$customers->addAttributeToFilter(array(
|
178 |
+
array(
|
179 |
+
'attribute' => 'created_at',
|
180 |
+
'from' => $date
|
181 |
+
),
|
182 |
+
array(
|
183 |
+
'attribute' => 'updated_at',
|
184 |
+
'from' => $date
|
185 |
+
)
|
186 |
+
));
|
187 |
+
|
188 |
+
$orders = Mage::getModel('sales/order')
|
189 |
+
->getCollection()
|
190 |
+
->addAttributeToSelect('customer_id');
|
191 |
+
|
192 |
+
$orders->addAttributeToFilter(array(
|
193 |
+
'attribute' => 'created_at',
|
194 |
+
'from' => $date
|
195 |
+
));
|
196 |
+
}
|
197 |
+
|
198 |
+
$arrCustomers = array();
|
199 |
+
if ($customers->count() > 0) {
|
200 |
+
$nCustomers = $this->_xml->createElement('customers');
|
201 |
+
foreach ($customers as $customer) {
|
202 |
+
$arrCustomers[$customer->getId()] = true;
|
203 |
+
$nCustomer = $this->_xml->createElement('customer');
|
204 |
+
$nId = $this->_xml->createElement('id', $customer->getId());
|
205 |
+
$nCustomer->appendChild($nId);
|
206 |
+
$nCustomers->appendChild($nCustomer);
|
207 |
+
$this->_xml->appendChild($nCustomers);
|
208 |
+
}
|
209 |
+
foreach($orders as $order) {
|
210 |
+
if (!isset($arrCustomers[$order->getCustomerId()])) {
|
211 |
+
$nCustomer = $this->_xml->createElement('customer');
|
212 |
+
$nId = $this->_xml->createElement('id', $order->getCustomerId());
|
213 |
+
$nCustomer->appendChild($nId);
|
214 |
+
$nCustomers->appendChild($nCustomer);
|
215 |
+
$this->_xml->appendChild($nCustomers);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
} else {
|
219 |
+
$this->_xml->appendChild($this->_xml->createElement('customers'));
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Retourne l'identifiant Magento de tous les clients depuis une date
|
225 |
+
*
|
226 |
+
*/
|
227 |
+
protected function _recentCustomerIds()
|
228 |
+
{
|
229 |
+
$this->_allCustomerIds($this->getRequest()->getParam('date', date('Y-m-d')));
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Retourne les données consolidées d'un client Magento
|
234 |
+
*
|
235 |
+
*/
|
236 |
+
protected function _customerData()
|
237 |
+
{
|
238 |
+
$idCustomer = $this->getRequest()->getParam('customerid');
|
239 |
+
|
240 |
+
if(empty($idCustomer)) {
|
241 |
+
throw new Exception("Empty id");
|
242 |
+
}
|
243 |
+
|
244 |
+
$customer = Mage::getModel('customer/customer')->load($idCustomer);
|
245 |
+
|
246 |
+
$eCustomers = $this->_xml->createElement('customers');
|
247 |
+
$eCustomer = $this->_xml->createElement('customer');
|
248 |
+
$eCustomers->appendChild($eCustomer);
|
249 |
+
|
250 |
+
$eId = $this->_xml->createElement('id', $customer->getId());
|
251 |
+
$eCustomer->appendChild($eId);
|
252 |
+
|
253 |
+
$eGender = $this->_xml->createElement('id_gender', $customer->getGender() ? $customer->getGender() : '');
|
254 |
+
$eCustomer->appendChild($eGender);
|
255 |
+
|
256 |
+
$eFirstname = $this->_xml->createElement('firstname', $customer->getFirstname());
|
257 |
+
$eCustomer->appendChild($eFirstname);
|
258 |
+
|
259 |
+
$eLastname = $this->_xml->createElement('lastname', $customer->getLastname());
|
260 |
+
$eCustomer->appendChild($eLastname);
|
261 |
+
|
262 |
+
$eEmail = $this->_xml->createElement('email', $customer->getEmail());
|
263 |
+
$eCustomer->appendChild($eEmail);
|
264 |
+
|
265 |
+
$eBirthday = $this->_xml->createElement('birthday', $customer->getDob() ? $customer->getDob() : '');
|
266 |
+
$eCustomer->appendChild($eBirthday);
|
267 |
+
|
268 |
+
$eDateAdd = $this->_xml->createElement('date_add', $customer->getCreatedAt());
|
269 |
+
$eCustomer->appendChild($eDateAdd);
|
270 |
+
|
271 |
+
$eOptin = $this->_xml->createElement('optin', '0');
|
272 |
+
$eCustomer->appendChild($eOptin);
|
273 |
+
|
274 |
+
$eOptin = $this->_xml->createElement('newsletter', $this->_isOptin($customer->getEmail(), $customer->getId()));
|
275 |
+
$eCustomer->appendChild($eOptin);
|
276 |
+
|
277 |
+
$eAddresses = $this->_xml->createElement('addresses');
|
278 |
+
|
279 |
+
foreach ($customer->getAddresses() as $address) {
|
280 |
+
$eAddress = $this->_xml->createElement('address');
|
281 |
+
|
282 |
+
$i = 0;
|
283 |
+
foreach ($address->getStreet() as $street) {
|
284 |
+
$i++;
|
285 |
+
$eAddress->appendChild($this->_xml->createElement('address' . $i, $street));
|
286 |
+
}
|
287 |
+
|
288 |
+
if ($i < 2) {
|
289 |
+
$eAddress->appendChild($this->_xml->createElement('address2', ''));
|
290 |
+
}
|
291 |
+
|
292 |
+
$eAddress->appendChild($this->_xml->createElement('postcode', $address->getPostcode()));
|
293 |
+
$eAddress->appendChild($this->_xml->createElement('city', $address->getCity()));
|
294 |
+
$eAddress->appendChild($this->_xml->createElement('country', $address->getCountryId()));
|
295 |
+
$eAddress->appendChild($this->_xml->createElement('phone', $address->getTelephone()));
|
296 |
+
$eAddress->appendChild($this->_xml->createElement('phone_mobile'));
|
297 |
+
|
298 |
+
$eAddress->appendChild($this->_xml->createElement('company', $address->getcompany() ? $address->getcompany() : ''));
|
299 |
+
|
300 |
+
$eAddresses->appendChild($eAddress);
|
301 |
+
}
|
302 |
+
|
303 |
+
$eCustomer->appendChild($eAddresses);
|
304 |
+
|
305 |
+
if (Mage::getStoreConfig(MessageBusiness_ContactsSync_Helper_Data::XML_PATH_SYNC_ACCEPT_INTERFACE_LEVEL) == MessageBusiness_ContactsSync_Model_System_Config_Source_Synchro_Type::SYNC_COMPLETE) {
|
306 |
+
$logCustomer = Mage::getModel('log/customer')->load($idCustomer);
|
307 |
+
$eLastConnection = $this->_xml->createElement('last_connection', $logCustomer->getLoginAt());
|
308 |
+
$eCustomer->appendChild($eLastConnection);
|
309 |
+
|
310 |
+
$eLastCancelledCartDate = $this->_xml->createElement('last_cancelledcartdate', $this->_getLastCanceledCartDate($idCustomer));
|
311 |
+
$eCustomer->appendChild($eLastCancelledCartDate);
|
312 |
+
|
313 |
+
if (count($this->_getOrders($idCustomer)) > 0) {
|
314 |
+
$eOrders = $this->_xml->createElement('orders');
|
315 |
+
foreach ($this->_getOrders($idCustomer) as $o) {
|
316 |
+
$eOrder = $this->_xml->createElement('order');
|
317 |
+
$eOrder->appendChild($this->_xml->createElement('total_paid', $o->getGrandTotal()));
|
318 |
+
$eOrder->appendChild($this->_xml->createElement('invoice_date', $o->getCreatedAt()));
|
319 |
+
$eOrder->appendChild($this->_xml->createElement('delivery_date', $o->getCreatedAt()));
|
320 |
+
$eOrders->appendChild($eOrder);
|
321 |
+
}
|
322 |
+
$eCustomer->appendChild($eOrders);
|
323 |
+
}
|
324 |
+
|
325 |
+
|
326 |
+
}
|
327 |
+
$this->_xml->appendChild($eCustomers);
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Retourne la date du dernier panier abandonné d'un client
|
332 |
+
*
|
333 |
+
* @param int $idCustomer
|
334 |
+
* @return string
|
335 |
+
*/
|
336 |
+
private function _getLastCanceledCartDate($idCustomer)
|
337 |
+
{
|
338 |
+
$abandonedCartCollection = Mage::getResourceModel('reports/quote_collection')
|
339 |
+
->prepareForAbandonedReport(array(1))
|
340 |
+
->addFieldToFilter('main_table.customer_id', $idCustomer);
|
341 |
+
|
342 |
+
foreach ($abandonedCartCollection as $cart) {
|
343 |
+
return $cart->getCreatedAt();
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Retourne toutes les commandes d'un client
|
349 |
+
*
|
350 |
+
* @param int $idCustomer
|
351 |
+
* @return Mage_Sales_Model_Resource_Order_Collection
|
352 |
+
*/
|
353 |
+
private function _getOrders($idCustomer)
|
354 |
+
{
|
355 |
+
return Mage::getModel('sales/order')
|
356 |
+
->getCollection()
|
357 |
+
->addFieldToFilter('customer_id', array('eq' => $idCustomer));
|
358 |
+
}
|
359 |
+
}
|
app/code/community/MessageBusiness/ContactsSync/etc/config.xml
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category MessageBusiness
|
23 |
+
* @package MessageBusiness_ContactsSync
|
24 |
+
* @author Sinabs - http://www.sinabs.fr
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<MessageBusiness_ContactsSync>
|
31 |
+
<version>0.1</version>
|
32 |
+
</MessageBusiness_ContactsSync>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<contactssync>
|
37 |
+
<class>MessageBusiness_ContactsSync_Model</class>
|
38 |
+
</contactssync>
|
39 |
+
</models>
|
40 |
+
<helpers>
|
41 |
+
<contactssync>
|
42 |
+
<class>MessageBusiness_ContactsSync_Helper</class>
|
43 |
+
</contactssync>
|
44 |
+
</helpers>
|
45 |
+
<blocks>
|
46 |
+
<contactssync>
|
47 |
+
<class>MessageBusiness_ContactsSync_Block</class>
|
48 |
+
</contactssync>
|
49 |
+
</blocks>
|
50 |
+
<events>
|
51 |
+
<admin_system_config_changed_section_contactssync>
|
52 |
+
<observers>
|
53 |
+
<contactssync>
|
54 |
+
<type>singleton</type>
|
55 |
+
<class>contactssync/observer</class>
|
56 |
+
<method>saveConfig</method>
|
57 |
+
</contactssync>
|
58 |
+
</observers>
|
59 |
+
</admin_system_config_changed_section_contactssync>
|
60 |
+
<newsletter_subscriber_save_before>
|
61 |
+
<observers>
|
62 |
+
<contactssync_subscriber>
|
63 |
+
<type>singleton</type>
|
64 |
+
<class>contactssync/observer</class>
|
65 |
+
<method>newsletterSubscriberChange</method>
|
66 |
+
</contactssync_subscriber>
|
67 |
+
</observers>
|
68 |
+
</newsletter_subscriber_save_before>
|
69 |
+
</events>
|
70 |
+
</global>
|
71 |
+
<default>
|
72 |
+
<contactssync>
|
73 |
+
<sync>
|
74 |
+
<sync_type>1</sync_type>
|
75 |
+
<sync_mode>2</sync_mode>
|
76 |
+
<optin_activate>1</optin_activate>
|
77 |
+
</sync>
|
78 |
+
</contactssync>
|
79 |
+
</default>
|
80 |
+
<frontend>
|
81 |
+
<routers>
|
82 |
+
<contactssync>
|
83 |
+
<use>standard</use>
|
84 |
+
<args>
|
85 |
+
<module>MessageBusiness_ContactsSync</module>
|
86 |
+
<frontName>messagebusiness</frontName>
|
87 |
+
</args>
|
88 |
+
</contactssync>
|
89 |
+
</routers>
|
90 |
+
</frontend>
|
91 |
+
<admin>
|
92 |
+
<routers>
|
93 |
+
<contactssync_admin>
|
94 |
+
<use>admin</use>
|
95 |
+
<args>
|
96 |
+
<module>MessageBusiness_ContactsSync_Adminhtml</module>
|
97 |
+
<frontName>adminmb</frontName>
|
98 |
+
</args>
|
99 |
+
</contactssync_admin>
|
100 |
+
</routers>
|
101 |
+
</admin>
|
102 |
+
<adminhtml>
|
103 |
+
<acl>
|
104 |
+
<resources>
|
105 |
+
<admin>
|
106 |
+
<children>
|
107 |
+
<system>
|
108 |
+
<children>
|
109 |
+
<config>
|
110 |
+
<children>
|
111 |
+
<mb_contactssync translate="title" module="contactssync">
|
112 |
+
<title>Section Message Business</title>
|
113 |
+
</mb_contactssync>
|
114 |
+
</children>
|
115 |
+
</config>
|
116 |
+
</children>
|
117 |
+
</system>
|
118 |
+
</children>
|
119 |
+
</admin>
|
120 |
+
</resources>
|
121 |
+
</acl>
|
122 |
+
<translate>
|
123 |
+
<modules>
|
124 |
+
<MessageBusiness_ContactsSync>
|
125 |
+
<files>
|
126 |
+
<default>MessageBusiness_ContactsSync.csv</default>
|
127 |
+
</files>
|
128 |
+
</MessageBusiness_ContactsSync>
|
129 |
+
</modules>
|
130 |
+
</translate>
|
131 |
+
</adminhtml>
|
132 |
+
</config>
|
app/code/community/MessageBusiness/ContactsSync/etc/system.xml
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category MessageBusiness
|
23 |
+
* @package MessageBusiness_ContactsSync
|
24 |
+
* @author Sinabs - http://www.sinabs.fr
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<mb_contactssync translate="label" module="contactssync">
|
31 |
+
<label>Message Business</label>
|
32 |
+
<tab>customer</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>101</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<groups>
|
39 |
+
<account translate="label">
|
40 |
+
<label>Credentials of your account on Message Business</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>10</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<account_number translate="label">
|
48 |
+
<label>Account number</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>10</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</account_number>
|
55 |
+
<apikey translate="label">
|
56 |
+
<label>Account API key</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>20</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</apikey>
|
63 |
+
</fields>
|
64 |
+
</account>
|
65 |
+
<sync translate="label">
|
66 |
+
<label>Import contacts between databases</label>
|
67 |
+
<frontend_type>text</frontend_type>
|
68 |
+
<frontend_model>contactssync/system_config_form_fieldset_import</frontend_model>
|
69 |
+
<sort_order>20</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
<fields>
|
74 |
+
<accept_interface_level translate="label">
|
75 |
+
<label>Imported Datas</label>
|
76 |
+
<frontend_type>select</frontend_type>
|
77 |
+
<source_model>contactssync/system_config_source_synchro_type</source_model>
|
78 |
+
<sort_order>10</sort_order>
|
79 |
+
<show_in_default>1</show_in_default>
|
80 |
+
<show_in_website>1</show_in_website>
|
81 |
+
<show_in_store>1</show_in_store>
|
82 |
+
</accept_interface_level>
|
83 |
+
<full_extract translate="label,comment">
|
84 |
+
<label>Full Importation</label>
|
85 |
+
<comment><![CDATA[Reimport all data. Be careful, this import may take some extra time (By default, after the initial import, we import only the modified data).]]></comment>
|
86 |
+
<frontend_type>select</frontend_type>
|
87 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
88 |
+
<sort_order>30</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
</full_extract>
|
93 |
+
<accept_interface_option translate="label">
|
94 |
+
<label>Updating Magento Newsletter Opt-in</label>
|
95 |
+
<comment><![CDATA[Update newsletter subscription et Partners Optin between Message Business Account and Magento site (recommended).]]></comment>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
98 |
+
<sort_order>40</sort_order>
|
99 |
+
<show_in_default>1</show_in_default>
|
100 |
+
<show_in_website>1</show_in_website>
|
101 |
+
<show_in_store>1</show_in_store>
|
102 |
+
</accept_interface_option>
|
103 |
+
<run_sync translate="label,comment">
|
104 |
+
<frontend_type>button</frontend_type>
|
105 |
+
<frontend_model>contactssync/adminhtml_sync_button</frontend_model>
|
106 |
+
<sort_order>50</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
</run_sync>
|
111 |
+
</fields>
|
112 |
+
</sync>
|
113 |
+
<newsletter translate="label">
|
114 |
+
<label>Newsletter Subscription Form</label>
|
115 |
+
<frontend_type>text</frontend_type>
|
116 |
+
<sort_order>30</sort_order>
|
117 |
+
<show_in_default>1</show_in_default>
|
118 |
+
<show_in_website>1</show_in_website>
|
119 |
+
<show_in_store>1</show_in_store>
|
120 |
+
<fields>
|
121 |
+
<subscription>
|
122 |
+
<frontend_type>select</frontend_type>
|
123 |
+
<source_model>contactssync/system_config_source_newsletter_subscription</source_model>
|
124 |
+
<sort_order>10</sort_order>
|
125 |
+
<show_in_default>1</show_in_default>
|
126 |
+
<show_in_website>1</show_in_website>
|
127 |
+
<show_in_store>1</show_in_store>
|
128 |
+
</subscription>
|
129 |
+
</fields>
|
130 |
+
</newsletter>
|
131 |
+
<infos translate="label">
|
132 |
+
<label>At your service</label>
|
133 |
+
<frontend_type>text</frontend_type>
|
134 |
+
<frontend_model>contactssync/system_config_form_fieldset_service</frontend_model>
|
135 |
+
<sort_order>40</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
</infos>
|
140 |
+
</groups>
|
141 |
+
</mb_contactssync>
|
142 |
+
</sections>
|
143 |
+
</config>
|
package.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MessageBusiness_ContactsSync</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license>AFL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Importer automatiquement les données clients et les inscrits newsletter dans votre compte Message Business.</summary>
|
@@ -12,11 +12,11 @@ Cet extension ne se limite pas à simplement récupérer l'adresse e
|
|
12 |
En s'appuyant sur ces données consolidées, votre compte Message Business sera alors automatiquement configuré et vos principaux segments déjà créés (clients 1er achat, inactif, etc...). Vous pourrez en créer d'autres aisément !
|
13 |
Disposant de données fiabilisées, vous pourrez immédiatement piloter des actions marketing efficaces et automatisables sans connaissance informatique.
|
14 |
Cette extension gratuite est au service de votre relation client et du développement de votre chiffre d'affaires !</description>
|
15 |
-
<notes>Version 1.0.
|
16 |
<authors><author><name>Sinabs</name><user>sinabs_fr</user><email>tech@sinabs.fr</email></author></authors>
|
17 |
<date>2013-01-14</date>
|
18 |
-
<time>
|
19 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="contactssync"><dir name="system"><dir name="config"><dir name="sync"><file name="run.phtml" hash="84f7277b47e7558141de460978cdfe48"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MessageBusiness_ContactsSync.xml" hash="676b5fb5c19515a258e2b43238036f93"/></dir></target><target name="magelocale"><dir><dir name="es_ES"><file name="MessageBusiness_ContactsSync.csv" hash="c3d6a031b3af5cb46717c704be3024e5"/></dir><dir name="fr_FR"><file name="MessageBusiness_ContactsSync.csv" hash="fb1767163a68929194d94103d854c7d0"/></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
-
<dependencies><required><php><min>5.
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>MessageBusiness_ContactsSync</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>Academic Free License (AFL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Importer automatiquement les données clients et les inscrits newsletter dans votre compte Message Business.</summary>
|
12 |
En s'appuyant sur ces données consolidées, votre compte Message Business sera alors automatiquement configuré et vos principaux segments déjà créés (clients 1er achat, inactif, etc...). Vous pourrez en créer d'autres aisément !
|
13 |
Disposant de données fiabilisées, vous pourrez immédiatement piloter des actions marketing efficaces et automatisables sans connaissance informatique.
|
14 |
Cette extension gratuite est au service de votre relation client et du développement de votre chiffre d'affaires !</description>
|
15 |
+
<notes>Version 1.0.1 stable</notes>
|
16 |
<authors><author><name>Sinabs</name><user>sinabs_fr</user><email>tech@sinabs.fr</email></author></authors>
|
17 |
<date>2013-01-14</date>
|
18 |
+
<time>20:49:38</time>
|
19 |
+
<contents><target name="magecommunity"><dir name="MessageBusiness"><dir name="ContactsSync"><dir name="Block"><dir name="Adminhtml"><dir name="Sync"><file name="Button.php" hash="96d7a43f3d073e5c96a50f291545bb34"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><file name="Import.php" hash="147849470cc11da6e1ad8db84a9d60be"/><file name="Service.php" hash="edc7e67b19116bfbc395b78db4e31f89"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f00e2f239b64651da9d8f1b567638458"/><file name="MbApi.php" hash="4a11d589b8780a08147a2b4020e7e577"/></dir><dir name="Model"><file name="Observer.php" hash="b1dae04f0118f1c0ed5dc5e88c3892aa"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Newsletter"><file name="Subscription.php" hash="a956948f3aef0b31ea4b46e1a1446216"/></dir><dir name="Synchro"><file name="Type.php" hash="6da69e17398b78eadf9a26e2fa945f8c"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="bc1787b697890b9926709b1a0d4bb5e8"/></dir><file name="InterfaceController.php" hash="57c7a3aae5b67b2efbc1d20e4318b5d7"/></dir><dir name="etc"><file name="config.xml" hash="d7bfa2606dce8f115f3fb03db18b1390"/><file name="system.xml" hash="4dc173ab5ab4ecb009b7a8f7441b366a"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="contactssync"><dir name="system"><dir name="config"><dir name="sync"><file name="run.phtml" hash="84f7277b47e7558141de460978cdfe48"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MessageBusiness_ContactsSync.xml" hash="676b5fb5c19515a258e2b43238036f93"/></dir></target><target name="magelocale"><dir><dir name="es_ES"><file name="MessageBusiness_ContactsSync.csv" hash="c3d6a031b3af5cb46717c704be3024e5"/></dir><dir name="fr_FR"><file name="MessageBusiness_ContactsSync.csv" hash="fb1767163a68929194d94103d854c7d0"/></dir></dir></target></contents>
|
20 |
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|