Version Notes
- Fixed package.
Download this release
Release Info
Developer | Thomas Nelson |
Extension | Mailigen_Synchronizer |
Version | 1.1.4 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.1.4
- app/code/community/Mailigen/Synchronizer/Block/Newsletter/Subscriber/Grid.php +35 -35
- app/code/community/Mailigen/Synchronizer/Helper/Customer.php +190 -165
- app/code/community/Mailigen/Synchronizer/Helper/Data.php +184 -184
- app/code/community/Mailigen/Synchronizer/Helper/Log.php +29 -29
- app/code/community/Mailigen/Synchronizer/Model/Customer.php +15 -8
- app/code/community/Mailigen/Synchronizer/Model/Customer/Merge/Field.php +6 -0
- app/code/community/Mailigen/Synchronizer/Model/List.php +105 -105
- app/code/community/Mailigen/Synchronizer/Model/Mailigen.php +13 -2
- app/code/community/Mailigen/Synchronizer/Model/Newsletter/Merge/Field.php +81 -0
- app/code/community/Mailigen/Synchronizer/Model/Newsletter/Subscriber.php +181 -181
- app/code/community/Mailigen/Synchronizer/Model/Observer.php +7 -3
- app/code/community/Mailigen/Synchronizer/etc/config.xml +194 -194
- app/etc/modules/Mailigen_Synchronizer.xml +9 -9
- package.xml +16 -16
app/code/community/Mailigen/Synchronizer/Block/Newsletter/Subscriber/Grid.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Newsletter_Subscriber_Grid
|
4 |
-
{
|
5 |
-
protected function _prepareLayout()
|
6 |
-
{
|
7 |
-
$this->setChild('sync_button',
|
8 |
-
$this->getLayout()->createBlock('adminhtml/widget_button')
|
9 |
-
->setData(array(
|
10 |
-
'label' => Mage::helper('adminhtml')->__('Bulk synchronize with Mailigen'),
|
11 |
-
'onclick' => "setLocation('{$this->getUrl('*/mailigen/syncNewsletter')}')",
|
12 |
-
'class' => 'task'
|
13 |
-
))
|
14 |
-
);
|
15 |
-
|
16 |
-
return parent::_prepareLayout();
|
17 |
-
}
|
18 |
-
|
19 |
-
public function getSyncButtonHtml()
|
20 |
-
{
|
21 |
-
return $this->getChildHtml('sync_button');
|
22 |
-
}
|
23 |
-
|
24 |
-
public function getMainButtonsHtml()
|
25 |
-
{
|
26 |
-
$html = parent::getMainButtonsHtml();
|
27 |
-
|
28 |
-
$enabled = $this->helper('mailigen_synchronizer')->isEnabled();
|
29 |
-
|
30 |
-
if ($enabled) {
|
31 |
-
$html .= $this->getSyncButtonHtml();
|
32 |
-
}
|
33 |
-
|
34 |
-
return $html;
|
35 |
-
}
|
36 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid extends Mage_Adminhtml_Block_Newsletter_Subscriber_Grid
|
4 |
+
{
|
5 |
+
protected function _prepareLayout()
|
6 |
+
{
|
7 |
+
$this->setChild('sync_button',
|
8 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
9 |
+
->setData(array(
|
10 |
+
'label' => Mage::helper('adminhtml')->__('Bulk synchronize with Mailigen'),
|
11 |
+
'onclick' => "setLocation('{$this->getUrl('*/mailigen/syncNewsletter')}')",
|
12 |
+
'class' => 'task'
|
13 |
+
))
|
14 |
+
);
|
15 |
+
|
16 |
+
return parent::_prepareLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getSyncButtonHtml()
|
20 |
+
{
|
21 |
+
return $this->getChildHtml('sync_button');
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getMainButtonsHtml()
|
25 |
+
{
|
26 |
+
$html = parent::getMainButtonsHtml();
|
27 |
+
|
28 |
+
$enabled = $this->helper('mailigen_synchronizer')->isEnabled();
|
29 |
+
|
30 |
+
if ($enabled) {
|
31 |
+
$html .= $this->getSyncButtonHtml();
|
32 |
+
}
|
33 |
+
|
34 |
+
return $html;
|
35 |
+
}
|
36 |
}
|
app/code/community/Mailigen/Synchronizer/Helper/Customer.php
CHANGED
@@ -1,166 +1,191 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Mailigen_Synchronizer
|
5 |
-
*
|
6 |
-
* @category Mailigen
|
7 |
-
* @package Mailigen_Synchronizer
|
8 |
-
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
-
*/
|
10 |
-
class Mailigen_Synchronizer_Helper_Customer extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var array
|
14 |
-
*/
|
15 |
-
protected $_storeLang = array();
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var null|array
|
19 |
-
*/
|
20 |
-
protected $_customerGroup = null;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var null
|
24 |
-
*/
|
25 |
-
protected $_website = null;
|
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 |
-
return
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @param $
|
110 |
-
* @return string
|
111 |
-
*/
|
112 |
-
public function
|
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 |
-
return
|
165 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mailigen_Synchronizer
|
5 |
+
*
|
6 |
+
* @category Mailigen
|
7 |
+
* @package Mailigen_Synchronizer
|
8 |
+
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
+
*/
|
10 |
+
class Mailigen_Synchronizer_Helper_Customer extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* @var array
|
14 |
+
*/
|
15 |
+
protected $_storeLang = array();
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var null|array
|
19 |
+
*/
|
20 |
+
protected $_customerGroup = null;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var null
|
24 |
+
*/
|
25 |
+
protected $_website = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var null
|
29 |
+
*/
|
30 |
+
protected $_customerGender = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var null
|
34 |
+
*/
|
35 |
+
protected $_countries = null;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
public $customerStatus = array(0 => 'Inactive', 1 => 'Active');
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var array
|
44 |
+
*/
|
45 |
+
public $customerIsSubscribed = array(
|
46 |
+
0 => 'Unsubscribed',
|
47 |
+
1 => 'Subscribed',
|
48 |
+
2 => 'Not Activated',
|
49 |
+
3 => 'Unsubscribed',
|
50 |
+
4 => 'Unconfirmed'
|
51 |
+
);
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param $date
|
55 |
+
* @return bool|string
|
56 |
+
*/
|
57 |
+
public function getFormattedDate($date)
|
58 |
+
{
|
59 |
+
if (is_numeric($date)) {
|
60 |
+
$date = date('d/m/Y', $date);
|
61 |
+
} elseif (is_string($date) && !empty($date)) {
|
62 |
+
$date = date('d/m/Y', strtotime($date));
|
63 |
+
} else {
|
64 |
+
$date = '';
|
65 |
+
}
|
66 |
+
return $date;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @return array
|
71 |
+
*/
|
72 |
+
public function getGenders()
|
73 |
+
{
|
74 |
+
if (is_null($this->_customerGender)) {
|
75 |
+
$genders = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(false);
|
76 |
+
foreach ($genders as $gender) {
|
77 |
+
$this->_customerGender[$gender['value']] = $gender['label'];
|
78 |
+
}
|
79 |
+
}
|
80 |
+
return $this->_customerGender;
|
81 |
+
}
|
82 |
+
/**
|
83 |
+
* @param $gender
|
84 |
+
* @return string
|
85 |
+
*/
|
86 |
+
public function getFormattedGender($gender)
|
87 |
+
{
|
88 |
+
$genders = $this->getGenders();
|
89 |
+
return (!is_null($gender) && isset($genders[$gender])) ? $genders[$gender] : '';
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @return array|null
|
94 |
+
*/
|
95 |
+
public function getCustomerGroups()
|
96 |
+
{
|
97 |
+
if (is_null($this->_customerGroup)) {
|
98 |
+
$this->_customerGroup = array();
|
99 |
+
/** @var $groups Mage_Customer_Model_Resource_Group_Collection */
|
100 |
+
$groups = Mage::getModel('customer/group')->getCollection();
|
101 |
+
foreach ($groups as $group) {
|
102 |
+
$this->_customerGroup[$group->getCustomerGroupId()] = $group->getCustomerGroupCode();
|
103 |
+
}
|
104 |
+
}
|
105 |
+
return $this->_customerGroup;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @param $groupId
|
110 |
+
* @return string
|
111 |
+
*/
|
112 |
+
public function getCustomerGroup($groupId)
|
113 |
+
{
|
114 |
+
$groups = $this->getCustomerGroups();
|
115 |
+
return isset($groups[$groupId]) ? $groups[$groupId] : '';
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* @param $status
|
120 |
+
* @return string
|
121 |
+
*/
|
122 |
+
public function getFormattedCustomerStatus($status)
|
123 |
+
{
|
124 |
+
return $status ? $this->customerStatus[1] : $this->customerStatus[0];
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @param $storeId
|
129 |
+
* @return mixed
|
130 |
+
*/
|
131 |
+
public function getStoreLanguage($storeId)
|
132 |
+
{
|
133 |
+
if (!isset($this->_storeLang[$storeId])) {
|
134 |
+
$this->_storeLang[$storeId] = substr(Mage::getStoreConfig('general/locale/code', $storeId), 0, 2);
|
135 |
+
}
|
136 |
+
return $this->_storeLang[$storeId];
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* @param $storeId
|
141 |
+
* @return mixed
|
142 |
+
*/
|
143 |
+
public function getWebsite($storeId)
|
144 |
+
{
|
145 |
+
if (!isset($this->_website[$storeId])) {
|
146 |
+
/** @var $store Mage_Core_Model_Store */
|
147 |
+
$store = Mage::getModel('core/store')->load($storeId);
|
148 |
+
$this->_website[$storeId] = $store->getWebsite();
|
149 |
+
}
|
150 |
+
return $this->_website[$storeId];
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* @return array
|
155 |
+
*/
|
156 |
+
public function getCountries()
|
157 |
+
{
|
158 |
+
if (is_null($this->_countries)) {
|
159 |
+
$countries = Mage::getResourceModel('directory/country_collection')->loadData()->toOptionArray(false);
|
160 |
+
foreach ($countries as $country) {
|
161 |
+
$this->_countries[$country['value']] = $country['label'];
|
162 |
+
}
|
163 |
+
}
|
164 |
+
return $this->_countries;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* @param $country
|
169 |
+
* @return string
|
170 |
+
*/
|
171 |
+
public function getFormattedCountry($country)
|
172 |
+
{
|
173 |
+
$countries = $this->getCountries();
|
174 |
+
return isset($countries[$country]) ? $countries[$country] : '';
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* @param $isSubscribed
|
179 |
+
* @return string
|
180 |
+
*/
|
181 |
+
public function getFormattedIsSubscribed($isSubscribed)
|
182 |
+
{
|
183 |
+
if (is_null($isSubscribed)) {
|
184 |
+
return $this->customerIsSubscribed[0];
|
185 |
+
} elseif (isset($this->customerIsSubscribed[$isSubscribed])) {
|
186 |
+
return $this->customerIsSubscribed[$isSubscribed];
|
187 |
+
} else {
|
188 |
+
return $this->customerIsSubscribed[0];
|
189 |
+
}
|
190 |
+
}
|
191 |
}
|
app/code/community/Mailigen/Synchronizer/Helper/Data.php
CHANGED
@@ -1,185 +1,185 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Mailigen_Synchronizer
|
5 |
-
*
|
6 |
-
* @category Mailigen
|
7 |
-
* @package Mailigen_Synchronizer
|
8 |
-
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
-
*/
|
10 |
-
class Mailigen_Synchronizer_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
-
const XML_PATH_ENABLED = 'mailigen_synchronizer/general/enabled';
|
13 |
-
const XML_PATH_API_KEY = 'mailigen_synchronizer/general/api_key';
|
14 |
-
const XML_PATH_NEWSLETTER_CONTACT_LIST = 'mailigen_synchronizer/newsletter/contact_list';
|
15 |
-
const XML_PATH_NEWSLETTER_NEW_LIST_TITLE = 'mailigen_synchronizer/newsletter/new_list_title';
|
16 |
-
const XML_PATH_NEWSLETTER_AUTOSYNC = 'mailigen_synchronizer/newsletter/autosync';
|
17 |
-
const XML_PATH_NEWSLETTER_HANDLE_DEFAULT_EMAILS = 'mailigen_synchronizer/newsletter/handle_default_emails';
|
18 |
-
const XML_PATH_CUSTOMERS_CONTACT_LIST = 'mailigen_synchronizer/customers/contact_list';
|
19 |
-
const XML_PATH_CUSTOMERS_NEW_LIST_TITLE = 'mailigen_synchronizer/customers/new_list_title';
|
20 |
-
const XML_PATH_CUSTOMERS_AUTOSYNC = 'mailigen_synchronizer/customers/autosync';
|
21 |
-
const XML_PATH_CUSTOMERS_MANUAL_SYNC = 'mailigen_synchronizer/customers/manual_sync';
|
22 |
-
const XML_PATH_CUSTOMERS_STOP_SYNC = 'mailigen_synchronizer/customers/stop_sync';
|
23 |
-
|
24 |
-
protected $_mgapi = null;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param null $storeId
|
28 |
-
* @return bool
|
29 |
-
*/
|
30 |
-
public function isEnabled($storeId = null)
|
31 |
-
{
|
32 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId);
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @param null $storeId
|
37 |
-
* @return mixed
|
38 |
-
*/
|
39 |
-
public function getApiKey($storeId = null)
|
40 |
-
{
|
41 |
-
return Mage::getStoreConfig(self::XML_PATH_API_KEY, $storeId);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @param null $storeId
|
46 |
-
* @return mixed
|
47 |
-
*/
|
48 |
-
public function getNewsletterContactList($storeId = null)
|
49 |
-
{
|
50 |
-
return Mage::getStoreConfig(self::XML_PATH_NEWSLETTER_CONTACT_LIST, $storeId);
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @param null $storeId
|
55 |
-
* @return bool
|
56 |
-
*/
|
57 |
-
public function canAutoSyncNewsletter($storeId = null)
|
58 |
-
{
|
59 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_NEWSLETTER_AUTOSYNC, $storeId);
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* @param null $storeId
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function canNewsletterHandleDefaultEmails($storeId = null)
|
67 |
-
{
|
68 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_NEWSLETTER_HANDLE_DEFAULT_EMAILS, $storeId);
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* @param null $storeId
|
73 |
-
* @return mixed
|
74 |
-
*/
|
75 |
-
public function getCustomersContactList($storeId = null)
|
76 |
-
{
|
77 |
-
return Mage::getStoreConfig(self::XML_PATH_CUSTOMERS_CONTACT_LIST, $storeId);
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* @param null $storeId
|
82 |
-
* @return bool
|
83 |
-
*/
|
84 |
-
public function canAutoSyncCustomers($storeId = null)
|
85 |
-
{
|
86 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMERS_AUTOSYNC, $storeId);
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @return MGAPI|null
|
91 |
-
*/
|
92 |
-
public function getMailigenApi()
|
93 |
-
{
|
94 |
-
if (is_null($this->_mgapi)) {
|
95 |
-
require_once Mage::getBaseDir('lib') . '/mailigen/MGAPI.class.php';
|
96 |
-
$this->_mgapi = new MGAPI($this->getApiKey());
|
97 |
-
}
|
98 |
-
|
99 |
-
return $this->_mgapi;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* @param int $start
|
104 |
-
*/
|
105 |
-
public function setManualSync($start = 1)
|
106 |
-
{
|
107 |
-
$config = new Mage_Core_Model_Config();
|
108 |
-
$config->saveConfig(self::XML_PATH_CUSTOMERS_MANUAL_SYNC, $start);
|
109 |
-
$config->cleanCache();
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* @return bool
|
114 |
-
*/
|
115 |
-
public function getManualSync()
|
116 |
-
{
|
117 |
-
return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMERS_MANUAL_SYNC);
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* @param int $stop
|
122 |
-
*/
|
123 |
-
public function setStopSync($stop = 1)
|
124 |
-
{
|
125 |
-
$config = new Mage_Core_Model_Config();
|
126 |
-
$config->saveConfig(self::XML_PATH_CUSTOMERS_STOP_SYNC, $stop);
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Get stop sync value directly from DB
|
131 |
-
*
|
132 |
-
* @return bool
|
133 |
-
*/
|
134 |
-
public function getStopSync()
|
135 |
-
{
|
136 |
-
/** @var $stopSyncConfigCollection Mage_Core_Model_Resource_Config_Data_Collection */
|
137 |
-
$stopSyncConfigCollection = Mage::getModel('core/config_data')->getCollection()
|
138 |
-
->addFieldToFilter('path', self::XML_PATH_CUSTOMERS_STOP_SYNC);
|
139 |
-
|
140 |
-
if ($stopSyncConfigCollection->getSize()) {
|
141 |
-
/** @var $stopSyncConfig Mage_Core_Model_Config_Data */
|
142 |
-
$stopSyncConfig = $stopSyncConfigCollection->getFirstItem();
|
143 |
-
$result = ($stopSyncConfig->getValue() == '1');
|
144 |
-
}
|
145 |
-
else {
|
146 |
-
$result = false;
|
147 |
-
}
|
148 |
-
|
149 |
-
return $result;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* @param $datetime
|
154 |
-
* @param bool $full
|
155 |
-
* @return string
|
156 |
-
*/
|
157 |
-
function time_elapsed_string($datetime, $full = false) {
|
158 |
-
$now = new DateTime;
|
159 |
-
$ago = new DateTime($datetime);
|
160 |
-
$diff = $now->diff($ago);
|
161 |
-
|
162 |
-
$diff->w = floor($diff->d / 7);
|
163 |
-
$diff->d -= $diff->w * 7;
|
164 |
-
|
165 |
-
$string = array(
|
166 |
-
'y' => 'year',
|
167 |
-
'm' => 'month',
|
168 |
-
'w' => 'week',
|
169 |
-
'd' => 'day',
|
170 |
-
'h' => 'hour',
|
171 |
-
'i' => 'minute',
|
172 |
-
's' => 'second',
|
173 |
-
);
|
174 |
-
foreach ($string as $k => &$v) {
|
175 |
-
if ($diff->$k) {
|
176 |
-
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
|
177 |
-
} else {
|
178 |
-
unset($string[$k]);
|
179 |
-
}
|
180 |
-
}
|
181 |
-
|
182 |
-
if (!$full) $string = array_slice($string, 0, 1);
|
183 |
-
return $string ? implode(', ', $string) . ' ago' : 'just now';
|
184 |
-
}
|
185 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mailigen_Synchronizer
|
5 |
+
*
|
6 |
+
* @category Mailigen
|
7 |
+
* @package Mailigen_Synchronizer
|
8 |
+
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
+
*/
|
10 |
+
class Mailigen_Synchronizer_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
const XML_PATH_ENABLED = 'mailigen_synchronizer/general/enabled';
|
13 |
+
const XML_PATH_API_KEY = 'mailigen_synchronizer/general/api_key';
|
14 |
+
const XML_PATH_NEWSLETTER_CONTACT_LIST = 'mailigen_synchronizer/newsletter/contact_list';
|
15 |
+
const XML_PATH_NEWSLETTER_NEW_LIST_TITLE = 'mailigen_synchronizer/newsletter/new_list_title';
|
16 |
+
const XML_PATH_NEWSLETTER_AUTOSYNC = 'mailigen_synchronizer/newsletter/autosync';
|
17 |
+
const XML_PATH_NEWSLETTER_HANDLE_DEFAULT_EMAILS = 'mailigen_synchronizer/newsletter/handle_default_emails';
|
18 |
+
const XML_PATH_CUSTOMERS_CONTACT_LIST = 'mailigen_synchronizer/customers/contact_list';
|
19 |
+
const XML_PATH_CUSTOMERS_NEW_LIST_TITLE = 'mailigen_synchronizer/customers/new_list_title';
|
20 |
+
const XML_PATH_CUSTOMERS_AUTOSYNC = 'mailigen_synchronizer/customers/autosync';
|
21 |
+
const XML_PATH_CUSTOMERS_MANUAL_SYNC = 'mailigen_synchronizer/customers/manual_sync';
|
22 |
+
const XML_PATH_CUSTOMERS_STOP_SYNC = 'mailigen_synchronizer/customers/stop_sync';
|
23 |
+
|
24 |
+
protected $_mgapi = null;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @param null $storeId
|
28 |
+
* @return bool
|
29 |
+
*/
|
30 |
+
public function isEnabled($storeId = null)
|
31 |
+
{
|
32 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $storeId);
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param null $storeId
|
37 |
+
* @return mixed
|
38 |
+
*/
|
39 |
+
public function getApiKey($storeId = null)
|
40 |
+
{
|
41 |
+
return Mage::getStoreConfig(self::XML_PATH_API_KEY, $storeId);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param null $storeId
|
46 |
+
* @return mixed
|
47 |
+
*/
|
48 |
+
public function getNewsletterContactList($storeId = null)
|
49 |
+
{
|
50 |
+
return Mage::getStoreConfig(self::XML_PATH_NEWSLETTER_CONTACT_LIST, $storeId);
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param null $storeId
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function canAutoSyncNewsletter($storeId = null)
|
58 |
+
{
|
59 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_NEWSLETTER_AUTOSYNC, $storeId);
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param null $storeId
|
64 |
+
* @return bool
|
65 |
+
*/
|
66 |
+
public function canNewsletterHandleDefaultEmails($storeId = null)
|
67 |
+
{
|
68 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_NEWSLETTER_HANDLE_DEFAULT_EMAILS, $storeId);
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @param null $storeId
|
73 |
+
* @return mixed
|
74 |
+
*/
|
75 |
+
public function getCustomersContactList($storeId = null)
|
76 |
+
{
|
77 |
+
return Mage::getStoreConfig(self::XML_PATH_CUSTOMERS_CONTACT_LIST, $storeId);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @param null $storeId
|
82 |
+
* @return bool
|
83 |
+
*/
|
84 |
+
public function canAutoSyncCustomers($storeId = null)
|
85 |
+
{
|
86 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMERS_AUTOSYNC, $storeId);
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @return MGAPI|null
|
91 |
+
*/
|
92 |
+
public function getMailigenApi()
|
93 |
+
{
|
94 |
+
if (is_null($this->_mgapi)) {
|
95 |
+
require_once Mage::getBaseDir('lib') . '/mailigen/MGAPI.class.php';
|
96 |
+
$this->_mgapi = new MGAPI($this->getApiKey());
|
97 |
+
}
|
98 |
+
|
99 |
+
return $this->_mgapi;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @param int $start
|
104 |
+
*/
|
105 |
+
public function setManualSync($start = 1)
|
106 |
+
{
|
107 |
+
$config = new Mage_Core_Model_Config();
|
108 |
+
$config->saveConfig(self::XML_PATH_CUSTOMERS_MANUAL_SYNC, $start);
|
109 |
+
$config->cleanCache();
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @return bool
|
114 |
+
*/
|
115 |
+
public function getManualSync()
|
116 |
+
{
|
117 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMERS_MANUAL_SYNC);
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @param int $stop
|
122 |
+
*/
|
123 |
+
public function setStopSync($stop = 1)
|
124 |
+
{
|
125 |
+
$config = new Mage_Core_Model_Config();
|
126 |
+
$config->saveConfig(self::XML_PATH_CUSTOMERS_STOP_SYNC, $stop);
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Get stop sync value directly from DB
|
131 |
+
*
|
132 |
+
* @return bool
|
133 |
+
*/
|
134 |
+
public function getStopSync()
|
135 |
+
{
|
136 |
+
/** @var $stopSyncConfigCollection Mage_Core_Model_Resource_Config_Data_Collection */
|
137 |
+
$stopSyncConfigCollection = Mage::getModel('core/config_data')->getCollection()
|
138 |
+
->addFieldToFilter('path', self::XML_PATH_CUSTOMERS_STOP_SYNC);
|
139 |
+
|
140 |
+
if ($stopSyncConfigCollection->getSize()) {
|
141 |
+
/** @var $stopSyncConfig Mage_Core_Model_Config_Data */
|
142 |
+
$stopSyncConfig = $stopSyncConfigCollection->getFirstItem();
|
143 |
+
$result = ($stopSyncConfig->getValue() == '1');
|
144 |
+
}
|
145 |
+
else {
|
146 |
+
$result = false;
|
147 |
+
}
|
148 |
+
|
149 |
+
return $result;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @param $datetime
|
154 |
+
* @param bool $full
|
155 |
+
* @return string
|
156 |
+
*/
|
157 |
+
function time_elapsed_string($datetime, $full = false) {
|
158 |
+
$now = new DateTime;
|
159 |
+
$ago = new DateTime($datetime);
|
160 |
+
$diff = $now->diff($ago);
|
161 |
+
|
162 |
+
$diff->w = floor($diff->d / 7);
|
163 |
+
$diff->d -= $diff->w * 7;
|
164 |
+
|
165 |
+
$string = array(
|
166 |
+
'y' => 'year',
|
167 |
+
'm' => 'month',
|
168 |
+
'w' => 'week',
|
169 |
+
'd' => 'day',
|
170 |
+
'h' => 'hour',
|
171 |
+
'i' => 'minute',
|
172 |
+
's' => 'second',
|
173 |
+
);
|
174 |
+
foreach ($string as $k => &$v) {
|
175 |
+
if ($diff->$k) {
|
176 |
+
$v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : '');
|
177 |
+
} else {
|
178 |
+
unset($string[$k]);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
if (!$full) $string = array_slice($string, 0, 1);
|
183 |
+
return $string ? implode(', ', $string) . ' ago' : 'just now';
|
184 |
+
}
|
185 |
}
|
app/code/community/Mailigen/Synchronizer/Helper/Log.php
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Mailigen_Synchronizer
|
5 |
-
*
|
6 |
-
* @category Mailigen
|
7 |
-
* @package Mailigen_Synchronizer
|
8 |
-
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
-
*/
|
10 |
-
class Mailigen_Synchronizer_Helper_Log extends Mage_Core_Helper_Abstract
|
11 |
-
{
|
12 |
-
const LOG_FILE = 'mailigen_synchronizer.log';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @param $message
|
16 |
-
* @param null $level
|
17 |
-
*/
|
18 |
-
public static function log($message, $level = null)
|
19 |
-
{
|
20 |
-
Mage::log($message, $level, self::LOG_FILE);
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param Exception $e
|
25 |
-
*/
|
26 |
-
public static function logException(Exception $e)
|
27 |
-
{
|
28 |
-
self::log("\n" . $e->__toString(), Zend_Log::ERR);
|
29 |
-
}
|
30 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mailigen_Synchronizer
|
5 |
+
*
|
6 |
+
* @category Mailigen
|
7 |
+
* @package Mailigen_Synchronizer
|
8 |
+
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
+
*/
|
10 |
+
class Mailigen_Synchronizer_Helper_Log extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
const LOG_FILE = 'mailigen_synchronizer.log';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @param $message
|
16 |
+
* @param null $level
|
17 |
+
*/
|
18 |
+
public static function log($message, $level = null)
|
19 |
+
{
|
20 |
+
Mage::log($message, $level, self::LOG_FILE);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param Exception $e
|
25 |
+
*/
|
26 |
+
public static function logException(Exception $e)
|
27 |
+
{
|
28 |
+
self::log("\n" . $e->__toString(), Zend_Log::ERR);
|
29 |
+
}
|
30 |
}
|
app/code/community/Mailigen/Synchronizer/Model/Customer.php
CHANGED
@@ -142,16 +142,23 @@ class Mailigen_Synchronizer_Model_Customer extends Mage_Core_Model_Abstract
|
|
142 |
/**
|
143 |
* Join Customer order info
|
144 |
*/
|
145 |
-
$customers->joinTable('mailigen_synchronizer/customer',
|
146 |
-
'lastorderdate',
|
147 |
-
'valueoflastorder',
|
148 |
-
'totalvalueoforders',
|
149 |
-
'totalnumberoforders',
|
150 |
-
'numberofitemsincart',
|
151 |
-
'valueofcurrentcart',
|
152 |
-
'lastitemincartaddingdate'
|
153 |
));
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
return $customers;
|
156 |
}
|
157 |
|
142 |
/**
|
143 |
* Join Customer order info
|
144 |
*/
|
145 |
+
$customers->joinTable('mailigen_synchronizer/customer', 'id = entity_id', array(
|
146 |
+
'lastorderdate' => 'lastorderdate',
|
147 |
+
'valueoflastorder' => 'valueoflastorder',
|
148 |
+
'totalvalueoforders' => 'totalvalueoforders',
|
149 |
+
'totalnumberoforders' => 'totalnumberoforders',
|
150 |
+
'numberofitemsincart' => 'numberofitemsincart',
|
151 |
+
'valueofcurrentcart' => 'valueofcurrentcart',
|
152 |
+
'lastitemincartaddingdate' => 'lastitemincartaddingdate'
|
153 |
));
|
154 |
|
155 |
+
/**
|
156 |
+
* Join Subscriber status
|
157 |
+
*/
|
158 |
+
$customers->joinTable('newsletter/subscriber', 'customer_id = entity_id', array(
|
159 |
+
'is_subscribed' => 'subscriber_status'
|
160 |
+
), null, 'left');
|
161 |
+
|
162 |
return $customers;
|
163 |
}
|
164 |
|
app/code/community/Mailigen/Synchronizer/Model/Customer/Merge/Field.php
CHANGED
@@ -112,6 +112,12 @@ class Mailigen_Synchronizer_Model_Customer_Merge_Field extends Mage_Core_Model_A
|
|
112 |
'req' => true,
|
113 |
'predefined_values' => $this->_getFormattedPredefinedValues($helper->customerStatus)
|
114 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
/**
|
116 |
* Customer orders info
|
117 |
*/
|
112 |
'req' => true,
|
113 |
'predefined_values' => $this->_getFormattedPredefinedValues($helper->customerStatus)
|
114 |
),
|
115 |
+
'ISSUBSCRIBED' => array(
|
116 |
+
'title' => 'Is subscribed',
|
117 |
+
'field_type' => 'dropdown',
|
118 |
+
'req' => true,
|
119 |
+
'predefined_values' => $this->_getFormattedPredefinedValues($helper->customerIsSubscribed)
|
120 |
+
),
|
121 |
/**
|
122 |
* Customer orders info
|
123 |
*/
|
app/code/community/Mailigen/Synchronizer/Model/List.php
CHANGED
@@ -1,105 +1,105 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Mailigen_Synchronizer
|
5 |
-
*
|
6 |
-
* @category Mailigen
|
7 |
-
* @package Mailigen_Synchronizer
|
8 |
-
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
-
*/
|
10 |
-
class Mailigen_Synchronizer_Model_List extends Mage_Core_Model_Abstract
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var null
|
14 |
-
*/
|
15 |
-
protected $_lists = null;
|
16 |
-
|
17 |
-
public function _construct()
|
18 |
-
{
|
19 |
-
parent::_construct();
|
20 |
-
$this->_init('mailigen_synchronizer/list');
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @param bool $load
|
25 |
-
* @return array|null
|
26 |
-
*/
|
27 |
-
public function getLists($load = false)
|
28 |
-
{
|
29 |
-
if (is_null($this->_lists) || $load) {
|
30 |
-
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
31 |
-
$this->_lists = $api->lists();
|
32 |
-
}
|
33 |
-
return $this->_lists;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @param bool $load
|
38 |
-
* @return array
|
39 |
-
*/
|
40 |
-
public function toOptionArray($load = false)
|
41 |
-
{
|
42 |
-
$lists = $this->getLists($load);
|
43 |
-
|
44 |
-
if (is_array($lists) && !empty($lists)) {
|
45 |
-
$array[] = array('label' => '--Create a new list--', 'value' => '');
|
46 |
-
foreach ($lists as $list) {
|
47 |
-
$array[] = array('label' => $list['name'], 'value' => $list['id']);
|
48 |
-
}
|
49 |
-
return $array;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* @param $newListName
|
55 |
-
* @return bool|string
|
56 |
-
*/
|
57 |
-
public function createNewList($newListName)
|
58 |
-
{
|
59 |
-
//Get the list with current lists
|
60 |
-
$lists = $this->toOptionArray();
|
61 |
-
|
62 |
-
//Check if a similar list name doesn't exists already.
|
63 |
-
$continue = true;
|
64 |
-
foreach ($lists as $list) {
|
65 |
-
if ($list['label'] == $newListName) {
|
66 |
-
$continue = false;
|
67 |
-
Mage::getSingleton('adminhtml/session')->addError("A list with name '$newListName' already exists");
|
68 |
-
break;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
//Only if a list with a similar name is not doesn't exists we move further.
|
73 |
-
if ($continue) {
|
74 |
-
|
75 |
-
/** @var $logger Mailigen_Synchronizer_Helper_Log */
|
76 |
-
$logger = Mage::helper('mailigen_synchronizer/log');
|
77 |
-
|
78 |
-
$options = array(
|
79 |
-
'permission_reminder' => ' ',
|
80 |
-
'notify_to' => Mage::getStoreConfig('trans_email/ident_general/email'),
|
81 |
-
'subscription_notify' => true,
|
82 |
-
'unsubscription_notify' => true,
|
83 |
-
'has_email_type_option' => true
|
84 |
-
);
|
85 |
-
|
86 |
-
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
87 |
-
$retval = $api->listCreate($newListName, $options);
|
88 |
-
|
89 |
-
if ($api->errorCode) {
|
90 |
-
$logger->log("Unable to create list. $api->errorCode: $api->errorMessage");
|
91 |
-
}
|
92 |
-
|
93 |
-
//We grab the list one more time
|
94 |
-
$lists = $this->toOptionArray(true);
|
95 |
-
foreach ($lists as $list) {
|
96 |
-
if ($list['label'] == $newListName) {
|
97 |
-
//We make the new submitted list default
|
98 |
-
return $list['value'];
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mailigen_Synchronizer
|
5 |
+
*
|
6 |
+
* @category Mailigen
|
7 |
+
* @package Mailigen_Synchronizer
|
8 |
+
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
+
*/
|
10 |
+
class Mailigen_Synchronizer_Model_List extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* @var null
|
14 |
+
*/
|
15 |
+
protected $_lists = null;
|
16 |
+
|
17 |
+
public function _construct()
|
18 |
+
{
|
19 |
+
parent::_construct();
|
20 |
+
$this->_init('mailigen_synchronizer/list');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param bool $load
|
25 |
+
* @return array|null
|
26 |
+
*/
|
27 |
+
public function getLists($load = false)
|
28 |
+
{
|
29 |
+
if (is_null($this->_lists) || $load) {
|
30 |
+
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
31 |
+
$this->_lists = $api->lists();
|
32 |
+
}
|
33 |
+
return $this->_lists;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param bool $load
|
38 |
+
* @return array
|
39 |
+
*/
|
40 |
+
public function toOptionArray($load = false)
|
41 |
+
{
|
42 |
+
$lists = $this->getLists($load);
|
43 |
+
|
44 |
+
if (is_array($lists) && !empty($lists)) {
|
45 |
+
$array[] = array('label' => '--Create a new list--', 'value' => '');
|
46 |
+
foreach ($lists as $list) {
|
47 |
+
$array[] = array('label' => $list['name'], 'value' => $list['id']);
|
48 |
+
}
|
49 |
+
return $array;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param $newListName
|
55 |
+
* @return bool|string
|
56 |
+
*/
|
57 |
+
public function createNewList($newListName)
|
58 |
+
{
|
59 |
+
//Get the list with current lists
|
60 |
+
$lists = $this->toOptionArray();
|
61 |
+
|
62 |
+
//Check if a similar list name doesn't exists already.
|
63 |
+
$continue = true;
|
64 |
+
foreach ($lists as $list) {
|
65 |
+
if ($list['label'] == $newListName) {
|
66 |
+
$continue = false;
|
67 |
+
Mage::getSingleton('adminhtml/session')->addError("A list with name '$newListName' already exists");
|
68 |
+
break;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
//Only if a list with a similar name is not doesn't exists we move further.
|
73 |
+
if ($continue) {
|
74 |
+
|
75 |
+
/** @var $logger Mailigen_Synchronizer_Helper_Log */
|
76 |
+
$logger = Mage::helper('mailigen_synchronizer/log');
|
77 |
+
|
78 |
+
$options = array(
|
79 |
+
'permission_reminder' => ' ',
|
80 |
+
'notify_to' => Mage::getStoreConfig('trans_email/ident_general/email'),
|
81 |
+
'subscription_notify' => true,
|
82 |
+
'unsubscription_notify' => true,
|
83 |
+
'has_email_type_option' => true
|
84 |
+
);
|
85 |
+
|
86 |
+
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
87 |
+
$retval = $api->listCreate($newListName, $options);
|
88 |
+
|
89 |
+
if ($api->errorCode) {
|
90 |
+
$logger->log("Unable to create list. $api->errorCode: $api->errorMessage");
|
91 |
+
}
|
92 |
+
|
93 |
+
//We grab the list one more time
|
94 |
+
$lists = $this->toOptionArray(true);
|
95 |
+
foreach ($lists as $list) {
|
96 |
+
if ($list['label'] == $newListName) {
|
97 |
+
//We make the new submitted list default
|
98 |
+
return $list['value'];
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Mailigen.php
CHANGED
@@ -35,6 +35,8 @@ class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract
|
|
35 |
|
36 |
public function syncNewsletter()
|
37 |
{
|
|
|
|
|
38 |
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
39 |
$listid = Mage::helper('mailigen_synchronizer')->getNewsletterContactList();
|
40 |
if (!$listid) {
|
@@ -44,6 +46,12 @@ class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract
|
|
44 |
/** @var $logger Mailigen_Synchronizer_Helper_Log */
|
45 |
$logger = Mage::helper('mailigen_synchronizer/log');
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
//First we pull all unsubscribers from Mailigen
|
48 |
$unsubscribers = $api->listMembers($listid, "unsubscribed", 0, 500);
|
49 |
|
@@ -91,7 +99,9 @@ class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract
|
|
91 |
$batch[] = array(
|
92 |
'EMAIL' => $subscriber->getSubscriberEmail(),
|
93 |
'FNAME' => $subscriber->getCustomerFirstname(),
|
94 |
-
'LNAME' => $subscriber->getCustomerLastname()
|
|
|
|
|
95 |
);
|
96 |
}
|
97 |
|
@@ -125,7 +135,7 @@ class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract
|
|
125 |
* Create or update Merge fields
|
126 |
*/
|
127 |
Mage::getModel('mailigen_synchronizer/customer_merge_field')->createMergeFields();
|
128 |
-
$logger->log('
|
129 |
|
130 |
|
131 |
/**
|
@@ -242,6 +252,7 @@ class Mailigen_Synchronizer_Model_Mailigen extends Mage_Core_Model_Abstract
|
|
242 |
'LASTLOGIN' => $helper->getFormattedDate($customer->getLastLoginAt()),
|
243 |
'CLIENTID' => $customer->getId(),
|
244 |
'STATUSOFUSER' => $helper->getFormattedCustomerStatus($customer->getIsActive()),
|
|
|
245 |
/**
|
246 |
* Customer orders info
|
247 |
*/
|
35 |
|
36 |
public function syncNewsletter()
|
37 |
{
|
38 |
+
/** @var $helper Mailigen_Synchronizer_Helper_Customer */
|
39 |
+
$helper = Mage::helper('mailigen_synchronizer/customer');
|
40 |
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
41 |
$listid = Mage::helper('mailigen_synchronizer')->getNewsletterContactList();
|
42 |
if (!$listid) {
|
46 |
/** @var $logger Mailigen_Synchronizer_Helper_Log */
|
47 |
$logger = Mage::helper('mailigen_synchronizer/log');
|
48 |
|
49 |
+
/**
|
50 |
+
* Create or update Merge fields
|
51 |
+
*/
|
52 |
+
Mage::getModel('mailigen_synchronizer/newsletter_merge_field')->createMergeFields();
|
53 |
+
$logger->log('Newsletter merge fields created and updated');
|
54 |
+
|
55 |
//First we pull all unsubscribers from Mailigen
|
56 |
$unsubscribers = $api->listMembers($listid, "unsubscribed", 0, 500);
|
57 |
|
99 |
$batch[] = array(
|
100 |
'EMAIL' => $subscriber->getSubscriberEmail(),
|
101 |
'FNAME' => $subscriber->getCustomerFirstname(),
|
102 |
+
'LNAME' => $subscriber->getCustomerLastname(),
|
103 |
+
'STOREID' => $subscriber->getStoreId(),
|
104 |
+
'STORELANGUAGE' => $helper->getStoreLanguage($subscriber->getStoreId()),
|
105 |
);
|
106 |
}
|
107 |
|
135 |
* Create or update Merge fields
|
136 |
*/
|
137 |
Mage::getModel('mailigen_synchronizer/customer_merge_field')->createMergeFields();
|
138 |
+
$logger->log('Customer merge fields created and updated');
|
139 |
|
140 |
|
141 |
/**
|
252 |
'LASTLOGIN' => $helper->getFormattedDate($customer->getLastLoginAt()),
|
253 |
'CLIENTID' => $customer->getId(),
|
254 |
'STATUSOFUSER' => $helper->getFormattedCustomerStatus($customer->getIsActive()),
|
255 |
+
'ISSUBSCRIBED' => $helper->getFormattedIsSubscribed($customer->getData('is_subscribed')),
|
256 |
/**
|
257 |
* Customer orders info
|
258 |
*/
|
app/code/community/Mailigen/Synchronizer/Model/Newsletter/Merge/Field.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Mailigen_Synchronizer
|
5 |
+
*
|
6 |
+
* @category Mailigen
|
7 |
+
* @package Mailigen_Synchronizer
|
8 |
+
* @author Maksim Soldatjonok <maksold@gmail.com>
|
9 |
+
*/
|
10 |
+
class Mailigen_Synchronizer_Model_Newsletter_Merge_Field extends Mage_Core_Model_Abstract
|
11 |
+
{
|
12 |
+
/**
|
13 |
+
* Subscriber fields
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
protected function _getMergeFieldsConfig()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
'STOREID' => array(
|
20 |
+
'title' => 'Store id',
|
21 |
+
'field_type' => 'text',
|
22 |
+
'req' => true
|
23 |
+
),
|
24 |
+
'STORELANGUAGE' => array(
|
25 |
+
'title' => 'Store language',
|
26 |
+
'field_type' => 'text',
|
27 |
+
'req' => true
|
28 |
+
)
|
29 |
+
);
|
30 |
+
}
|
31 |
+
|
32 |
+
public function createMergeFields()
|
33 |
+
{
|
34 |
+
/** @var $helper Mailigen_Synchronizer_Helper_Data */
|
35 |
+
$helper = Mage::helper('mailigen_synchronizer');
|
36 |
+
$api = $helper->getMailigenApi();
|
37 |
+
$listId = $helper->getNewsletterContactList();
|
38 |
+
if (empty($listId)) {
|
39 |
+
Mage::throwException("Newsletter contact list isn't selected");
|
40 |
+
}
|
41 |
+
|
42 |
+
$createdFields = $this->_getCreatedMergeFields();
|
43 |
+
$newFields = $this->_getMergeFieldsConfig();
|
44 |
+
|
45 |
+
foreach ($newFields as $tag => $options) {
|
46 |
+
if (!isset($createdFields[$tag])) {
|
47 |
+
/**
|
48 |
+
* Create new merge field
|
49 |
+
*/
|
50 |
+
$name = $options['title'];
|
51 |
+
$api->listMergeVarAdd($listId, $tag, $name, $options);
|
52 |
+
if ($api->errorCode) {
|
53 |
+
Mage::throwException("Unable to add merge var. $api->errorCode: $api->errorMessage");
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
protected function _getCreatedMergeFields()
|
63 |
+
{
|
64 |
+
/** @var $helper Mailigen_Synchronizer_Helper_Data */
|
65 |
+
$helper = Mage::helper('mailigen_synchronizer');
|
66 |
+
$api = $helper->getMailigenApi();
|
67 |
+
$listId = $helper->getNewsletterContactList();
|
68 |
+
|
69 |
+
$createdMergeFields = array();
|
70 |
+
$tmpCreatedMergeFields = $api->listMergeVars($listId);
|
71 |
+
if ($api->errorCode) {
|
72 |
+
Mage::throwException("Unable to load merge vars. $api->errorCode: $api->errorMessage");
|
73 |
+
}
|
74 |
+
|
75 |
+
foreach ($tmpCreatedMergeFields as $mergeField) {
|
76 |
+
$createdMergeFields[$mergeField['tag']] = $mergeField;
|
77 |
+
}
|
78 |
+
|
79 |
+
return $createdMergeFields;
|
80 |
+
}
|
81 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Newsletter/Subscriber.php
CHANGED
@@ -1,181 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Mailigen_Synchronizer_Model_Newsletter_Subscriber extends Mage_Newsletter_Model_Subscriber
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* @param $email
|
7 |
-
* @return mixed
|
8 |
-
* @throws Exception
|
9 |
-
*/
|
10 |
-
public function subscribe($email)
|
11 |
-
{
|
12 |
-
$this->loadByEmail($email);
|
13 |
-
$customerSession = Mage::getSingleton('customer/session');
|
14 |
-
|
15 |
-
if (!$this->getId()) {
|
16 |
-
$this->setSubscriberConfirmCode($this->randomSequence());
|
17 |
-
}
|
18 |
-
|
19 |
-
$isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
|
20 |
-
$isOwnSubscribes = false;
|
21 |
-
$ownerId = Mage::getModel('customer/customer')
|
22 |
-
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
23 |
-
->loadByEmail($email)
|
24 |
-
->getId();
|
25 |
-
$isSubscribeOwnEmail = $customerSession->isLoggedIn() && $ownerId == $customerSession->getId();
|
26 |
-
|
27 |
-
if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED
|
28 |
-
|| $this->getStatus() == self::STATUS_NOT_ACTIVE
|
29 |
-
) {
|
30 |
-
if ($isConfirmNeed === true) {
|
31 |
-
// if user subscribes own login email - confirmation is not needed
|
32 |
-
$isOwnSubscribes = $isSubscribeOwnEmail;
|
33 |
-
if ($isOwnSubscribes == true) {
|
34 |
-
$this->setStatus(self::STATUS_SUBSCRIBED);
|
35 |
-
} else {
|
36 |
-
$this->setStatus(self::STATUS_NOT_ACTIVE);
|
37 |
-
}
|
38 |
-
} else {
|
39 |
-
$this->setStatus(self::STATUS_SUBSCRIBED);
|
40 |
-
}
|
41 |
-
$this->setSubscriberEmail($email);
|
42 |
-
}
|
43 |
-
|
44 |
-
if ($isSubscribeOwnEmail) {
|
45 |
-
$this->setStoreId($customerSession->getCustomer()->getStoreId());
|
46 |
-
$this->setCustomerId($customerSession->getCustomerId());
|
47 |
-
} else {
|
48 |
-
$this->setStoreId(Mage::app()->getStore()->getId());
|
49 |
-
$this->setCustomerId(0);
|
50 |
-
}
|
51 |
-
|
52 |
-
$this->setIsStatusChanged(true);
|
53 |
-
|
54 |
-
try {
|
55 |
-
$this->save();
|
56 |
-
|
57 |
-
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
58 |
-
if (!$send_flag) {
|
59 |
-
if ($isConfirmNeed === true
|
60 |
-
&& $isOwnSubscribes === false
|
61 |
-
) {
|
62 |
-
$this->sendConfirmationRequestEmail();
|
63 |
-
} else {
|
64 |
-
$this->sendConfirmationSuccessEmail();
|
65 |
-
}
|
66 |
-
|
67 |
-
}
|
68 |
-
|
69 |
-
return $this->getStatus();
|
70 |
-
} catch (Exception $e) {
|
71 |
-
throw new Exception($e->getMessage());
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Unsubscribes loaded subscription
|
78 |
-
* @return $this
|
79 |
-
*/
|
80 |
-
public function unsubscribe()
|
81 |
-
{
|
82 |
-
if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) {
|
83 |
-
Mage::throwException(Mage::helper('newsletter')->__('Invalid subscription confirmation code.'));
|
84 |
-
}
|
85 |
-
|
86 |
-
$this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED)
|
87 |
-
->save();
|
88 |
-
|
89 |
-
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
90 |
-
if (!$send_flag) {
|
91 |
-
$this->sendUnsubscriptionEmail();
|
92 |
-
}
|
93 |
-
|
94 |
-
return $this;
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Saving customer subscription status
|
99 |
-
*
|
100 |
-
* @param Mage_Customer_Model_Customer $customer
|
101 |
-
* @return Mage_Newsletter_Model_Subscriber
|
102 |
-
*/
|
103 |
-
public function subscribeCustomer($customer)
|
104 |
-
{
|
105 |
-
$this->loadByCustomer($customer);
|
106 |
-
|
107 |
-
if ($customer->getImportMode()) {
|
108 |
-
$this->setImportMode(true);
|
109 |
-
}
|
110 |
-
|
111 |
-
if (!$customer->getIsSubscribed() && !$this->getId()) {
|
112 |
-
// If subscription flag not set or customer is not a subscriber
|
113 |
-
// and no subscribe below
|
114 |
-
return $this;
|
115 |
-
}
|
116 |
-
|
117 |
-
if (!$this->getId()) {
|
118 |
-
$this->setSubscriberConfirmCode($this->randomSequence());
|
119 |
-
}
|
120 |
-
|
121 |
-
/*
|
122 |
-
* Logical mismatch between customer registration confirmation code and customer password confirmation
|
123 |
-
*/
|
124 |
-
$confirmation = null;
|
125 |
-
if ($customer->isConfirmationRequired() && ($customer->getConfirmation() != $customer->getPassword())) {
|
126 |
-
$confirmation = $customer->getConfirmation();
|
127 |
-
}
|
128 |
-
|
129 |
-
$sendInformationEmail = false;
|
130 |
-
if ($customer->hasIsSubscribed()) {
|
131 |
-
$status = $customer->getIsSubscribed()
|
132 |
-
? (!is_null($confirmation) ? self::STATUS_UNCONFIRMED : self::STATUS_SUBSCRIBED)
|
133 |
-
: self::STATUS_UNSUBSCRIBED;
|
134 |
-
/**
|
135 |
-
* If subscription status has been changed then send email to the customer
|
136 |
-
*/
|
137 |
-
if ($status != self::STATUS_UNCONFIRMED && $status != $this->getStatus()) {
|
138 |
-
$sendInformationEmail = true;
|
139 |
-
}
|
140 |
-
} elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && (is_null($confirmation))) {
|
141 |
-
$status = self::STATUS_SUBSCRIBED;
|
142 |
-
$sendInformationEmail = true;
|
143 |
-
} else {
|
144 |
-
$status = ($this->getStatus() == self::STATUS_NOT_ACTIVE ? self::STATUS_UNSUBSCRIBED : $this->getStatus());
|
145 |
-
}
|
146 |
-
|
147 |
-
if ($status != $this->getStatus()) {
|
148 |
-
$this->setIsStatusChanged(true);
|
149 |
-
}
|
150 |
-
|
151 |
-
$this->setStatus($status);
|
152 |
-
|
153 |
-
if (!$this->getId()) {
|
154 |
-
$storeId = $customer->getStoreId();
|
155 |
-
if ($customer->getStoreId() == 0) {
|
156 |
-
$storeId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
|
157 |
-
}
|
158 |
-
$this->setStoreId($storeId)
|
159 |
-
->setCustomerId($customer->getId())
|
160 |
-
->setEmail($customer->getEmail());
|
161 |
-
} else {
|
162 |
-
$this->setStoreId($customer->getStoreId())
|
163 |
-
->setEmail($customer->getEmail());
|
164 |
-
}
|
165 |
-
|
166 |
-
$this->save();
|
167 |
-
$sendSubscription = $customer->getData('sendSubscription') || $sendInformationEmail;
|
168 |
-
if (is_null($sendSubscription) xor $sendSubscription) {
|
169 |
-
|
170 |
-
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
171 |
-
if (!$send_flag) {
|
172 |
-
if ($this->getIsStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
|
173 |
-
$this->sendUnsubscriptionEmail();
|
174 |
-
} elseif ($this->getIsStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
|
175 |
-
$this->sendConfirmationSuccessEmail();
|
176 |
-
}
|
177 |
-
}
|
178 |
-
}
|
179 |
-
return $this;
|
180 |
-
}
|
181 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mailigen_Synchronizer_Model_Newsletter_Subscriber extends Mage_Newsletter_Model_Subscriber
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @param $email
|
7 |
+
* @return mixed
|
8 |
+
* @throws Exception
|
9 |
+
*/
|
10 |
+
public function subscribe($email)
|
11 |
+
{
|
12 |
+
$this->loadByEmail($email);
|
13 |
+
$customerSession = Mage::getSingleton('customer/session');
|
14 |
+
|
15 |
+
if (!$this->getId()) {
|
16 |
+
$this->setSubscriberConfirmCode($this->randomSequence());
|
17 |
+
}
|
18 |
+
|
19 |
+
$isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
|
20 |
+
$isOwnSubscribes = false;
|
21 |
+
$ownerId = Mage::getModel('customer/customer')
|
22 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
23 |
+
->loadByEmail($email)
|
24 |
+
->getId();
|
25 |
+
$isSubscribeOwnEmail = $customerSession->isLoggedIn() && $ownerId == $customerSession->getId();
|
26 |
+
|
27 |
+
if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED
|
28 |
+
|| $this->getStatus() == self::STATUS_NOT_ACTIVE
|
29 |
+
) {
|
30 |
+
if ($isConfirmNeed === true) {
|
31 |
+
// if user subscribes own login email - confirmation is not needed
|
32 |
+
$isOwnSubscribes = $isSubscribeOwnEmail;
|
33 |
+
if ($isOwnSubscribes == true) {
|
34 |
+
$this->setStatus(self::STATUS_SUBSCRIBED);
|
35 |
+
} else {
|
36 |
+
$this->setStatus(self::STATUS_NOT_ACTIVE);
|
37 |
+
}
|
38 |
+
} else {
|
39 |
+
$this->setStatus(self::STATUS_SUBSCRIBED);
|
40 |
+
}
|
41 |
+
$this->setSubscriberEmail($email);
|
42 |
+
}
|
43 |
+
|
44 |
+
if ($isSubscribeOwnEmail) {
|
45 |
+
$this->setStoreId($customerSession->getCustomer()->getStoreId());
|
46 |
+
$this->setCustomerId($customerSession->getCustomerId());
|
47 |
+
} else {
|
48 |
+
$this->setStoreId(Mage::app()->getStore()->getId());
|
49 |
+
$this->setCustomerId(0);
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->setIsStatusChanged(true);
|
53 |
+
|
54 |
+
try {
|
55 |
+
$this->save();
|
56 |
+
|
57 |
+
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
58 |
+
if (!$send_flag) {
|
59 |
+
if ($isConfirmNeed === true
|
60 |
+
&& $isOwnSubscribes === false
|
61 |
+
) {
|
62 |
+
$this->sendConfirmationRequestEmail();
|
63 |
+
} else {
|
64 |
+
$this->sendConfirmationSuccessEmail();
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
return $this->getStatus();
|
70 |
+
} catch (Exception $e) {
|
71 |
+
throw new Exception($e->getMessage());
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Unsubscribes loaded subscription
|
78 |
+
* @return $this
|
79 |
+
*/
|
80 |
+
public function unsubscribe()
|
81 |
+
{
|
82 |
+
if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) {
|
83 |
+
Mage::throwException(Mage::helper('newsletter')->__('Invalid subscription confirmation code.'));
|
84 |
+
}
|
85 |
+
|
86 |
+
$this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED)
|
87 |
+
->save();
|
88 |
+
|
89 |
+
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
90 |
+
if (!$send_flag) {
|
91 |
+
$this->sendUnsubscriptionEmail();
|
92 |
+
}
|
93 |
+
|
94 |
+
return $this;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Saving customer subscription status
|
99 |
+
*
|
100 |
+
* @param Mage_Customer_Model_Customer $customer
|
101 |
+
* @return Mage_Newsletter_Model_Subscriber
|
102 |
+
*/
|
103 |
+
public function subscribeCustomer($customer)
|
104 |
+
{
|
105 |
+
$this->loadByCustomer($customer);
|
106 |
+
|
107 |
+
if ($customer->getImportMode()) {
|
108 |
+
$this->setImportMode(true);
|
109 |
+
}
|
110 |
+
|
111 |
+
if (!$customer->getIsSubscribed() && !$this->getId()) {
|
112 |
+
// If subscription flag not set or customer is not a subscriber
|
113 |
+
// and no subscribe below
|
114 |
+
return $this;
|
115 |
+
}
|
116 |
+
|
117 |
+
if (!$this->getId()) {
|
118 |
+
$this->setSubscriberConfirmCode($this->randomSequence());
|
119 |
+
}
|
120 |
+
|
121 |
+
/*
|
122 |
+
* Logical mismatch between customer registration confirmation code and customer password confirmation
|
123 |
+
*/
|
124 |
+
$confirmation = null;
|
125 |
+
if ($customer->isConfirmationRequired() && ($customer->getConfirmation() != $customer->getPassword())) {
|
126 |
+
$confirmation = $customer->getConfirmation();
|
127 |
+
}
|
128 |
+
|
129 |
+
$sendInformationEmail = false;
|
130 |
+
if ($customer->hasIsSubscribed()) {
|
131 |
+
$status = $customer->getIsSubscribed()
|
132 |
+
? (!is_null($confirmation) ? self::STATUS_UNCONFIRMED : self::STATUS_SUBSCRIBED)
|
133 |
+
: self::STATUS_UNSUBSCRIBED;
|
134 |
+
/**
|
135 |
+
* If subscription status has been changed then send email to the customer
|
136 |
+
*/
|
137 |
+
if ($status != self::STATUS_UNCONFIRMED && $status != $this->getStatus()) {
|
138 |
+
$sendInformationEmail = true;
|
139 |
+
}
|
140 |
+
} elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && (is_null($confirmation))) {
|
141 |
+
$status = self::STATUS_SUBSCRIBED;
|
142 |
+
$sendInformationEmail = true;
|
143 |
+
} else {
|
144 |
+
$status = ($this->getStatus() == self::STATUS_NOT_ACTIVE ? self::STATUS_UNSUBSCRIBED : $this->getStatus());
|
145 |
+
}
|
146 |
+
|
147 |
+
if ($status != $this->getStatus()) {
|
148 |
+
$this->setIsStatusChanged(true);
|
149 |
+
}
|
150 |
+
|
151 |
+
$this->setStatus($status);
|
152 |
+
|
153 |
+
if (!$this->getId()) {
|
154 |
+
$storeId = $customer->getStoreId();
|
155 |
+
if ($customer->getStoreId() == 0) {
|
156 |
+
$storeId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
|
157 |
+
}
|
158 |
+
$this->setStoreId($storeId)
|
159 |
+
->setCustomerId($customer->getId())
|
160 |
+
->setEmail($customer->getEmail());
|
161 |
+
} else {
|
162 |
+
$this->setStoreId($customer->getStoreId())
|
163 |
+
->setEmail($customer->getEmail());
|
164 |
+
}
|
165 |
+
|
166 |
+
$this->save();
|
167 |
+
$sendSubscription = $customer->getData('sendSubscription') || $sendInformationEmail;
|
168 |
+
if (is_null($sendSubscription) xor $sendSubscription) {
|
169 |
+
|
170 |
+
$send_flag = Mage::helper('mailigen_synchronizer')->canNewsletterHandleDefaultEmails();
|
171 |
+
if (!$send_flag) {
|
172 |
+
if ($this->getIsStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
|
173 |
+
$this->sendUnsubscriptionEmail();
|
174 |
+
} elseif ($this->getIsStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
|
175 |
+
$this->sendConfirmationSuccessEmail();
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
return $this;
|
180 |
+
}
|
181 |
+
}
|
app/code/community/Mailigen/Synchronizer/Model/Observer.php
CHANGED
@@ -23,7 +23,8 @@ class Mailigen_Synchronizer_Model_Observer
|
|
23 |
$logger = Mage::helper('mailigen_synchronizer/log');
|
24 |
|
25 |
if ($enabled && $statusChange == true) {
|
26 |
-
|
|
|
27 |
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
28 |
$listid = Mage::helper('mailigen_synchronizer')->getNewsletterContactList();
|
29 |
|
@@ -48,12 +49,15 @@ class Mailigen_Synchronizer_Model_Observer
|
|
48 |
|
49 |
//if is a customer we also grab firstname and lastname
|
50 |
if ($observer['subscriber']->getCustomerId()) {
|
51 |
-
$
|
52 |
-
$customer
|
53 |
|
54 |
$merge_vars['FNAME'] = $customer->getFirstname();
|
55 |
$merge_vars['LNAME'] = $customer->getLastname();
|
|
|
|
|
56 |
|
|
|
57 |
}
|
58 |
|
59 |
if ($data['subscriber_status'] === 1) {
|
23 |
$logger = Mage::helper('mailigen_synchronizer/log');
|
24 |
|
25 |
if ($enabled && $statusChange == true) {
|
26 |
+
/** @var $helper Mailigen_Synchronizer_Helper_Customer */
|
27 |
+
$helper = Mage::helper('mailigen_synchronizer/customer');
|
28 |
$api = Mage::helper('mailigen_synchronizer')->getMailigenApi();
|
29 |
$listid = Mage::helper('mailigen_synchronizer')->getNewsletterContactList();
|
30 |
|
49 |
|
50 |
//if is a customer we also grab firstname and lastname
|
51 |
if ($observer['subscriber']->getCustomerId()) {
|
52 |
+
$customerId = $observer['subscriber']->getCustomerId();
|
53 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
54 |
|
55 |
$merge_vars['FNAME'] = $customer->getFirstname();
|
56 |
$merge_vars['LNAME'] = $customer->getLastname();
|
57 |
+
$merge_vars['STOREID'] = $customer->getStoreId();
|
58 |
+
$merge_vars['STORELANGUAGE'] = $helper->getStoreLanguage($customer->getStoreId());
|
59 |
|
60 |
+
Mage::getModel('mailigen_synchronizer/customer')->setCustomerNotSynced($customerId);
|
61 |
}
|
62 |
|
63 |
if ($data['subscriber_status'] === 1) {
|
app/code/community/Mailigen/Synchronizer/etc/config.xml
CHANGED
@@ -1,194 +1,194 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Mailigen_Synchronizer>
|
5 |
-
<version>1.1.
|
6 |
-
</Mailigen_Synchronizer>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<helpers>
|
10 |
-
<mailigen_synchronizer>
|
11 |
-
<class>Mailigen_Synchronizer_Helper</class>
|
12 |
-
</mailigen_synchronizer>
|
13 |
-
</helpers>
|
14 |
-
<blocks>
|
15 |
-
<mailigen_synchronizer>
|
16 |
-
<class>Mailigen_Synchronizer_Block</class>
|
17 |
-
</mailigen_synchronizer>
|
18 |
-
<adminhtml>
|
19 |
-
<rewrite>
|
20 |
-
<newsletter_subscriber_grid>Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid</newsletter_subscriber_grid>
|
21 |
-
</rewrite>
|
22 |
-
</adminhtml>
|
23 |
-
</blocks>
|
24 |
-
<models>
|
25 |
-
<mailigen_synchronizer>
|
26 |
-
<class>Mailigen_Synchronizer_Model</class>
|
27 |
-
<resourceModel>mailigen_synchronizer_resource</resourceModel>
|
28 |
-
</mailigen_synchronizer>
|
29 |
-
<mailigen_synchronizer_resource>
|
30 |
-
<class>Mailigen_Synchronizer_Model_Resource</class>
|
31 |
-
<entities>
|
32 |
-
<customer>
|
33 |
-
<table>mailigen_synchronizer_customer</table>
|
34 |
-
</customer>
|
35 |
-
</entities>
|
36 |
-
</mailigen_synchronizer_resource>
|
37 |
-
<newsletter>
|
38 |
-
<rewrite>
|
39 |
-
<subscriber>Mailigen_Synchronizer_Model_Newsletter_Subscriber</subscriber>
|
40 |
-
</rewrite>
|
41 |
-
</newsletter>
|
42 |
-
</models>
|
43 |
-
<resources>
|
44 |
-
<mailigen_synchronizer_setup>
|
45 |
-
<setup>
|
46 |
-
<module>Mailigen_Synchronizer</module>
|
47 |
-
<class>Mage_Core_Model_Resource_Setup</class>
|
48 |
-
</setup>
|
49 |
-
<connection>
|
50 |
-
<use>core_setup</use>
|
51 |
-
</connection>
|
52 |
-
</mailigen_synchronizer_setup>
|
53 |
-
<mailigen_synchronizer_write>
|
54 |
-
<connection>
|
55 |
-
<use>core_write</use>
|
56 |
-
</connection>
|
57 |
-
</mailigen_synchronizer_write>
|
58 |
-
<mailigen_synchronizer_read>
|
59 |
-
<connection>
|
60 |
-
<use>core_read</use>
|
61 |
-
</connection>
|
62 |
-
</mailigen_synchronizer_read>
|
63 |
-
</resources>
|
64 |
-
<events>
|
65 |
-
<newsletter_subscriber_save_commit_after>
|
66 |
-
<observers>
|
67 |
-
<newsletter_subscriber_newsletter_subscriber_create_after>
|
68 |
-
<type>singleton</type>
|
69 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
70 |
-
<method>newsletterSubscriberSaveCommitAfter</method>
|
71 |
-
</newsletter_subscriber_newsletter_subscriber_create_after>
|
72 |
-
</observers>
|
73 |
-
</newsletter_subscriber_save_commit_after>
|
74 |
-
<admin_system_config_changed_section_mailigen_synchronizer>
|
75 |
-
<observers>
|
76 |
-
<newsletter_subscriber_admin_system_config_changed_section_mailigen_synchronizer>
|
77 |
-
<type>singleton</type>
|
78 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
79 |
-
<method>adminSystemConfigChangedSectionMailigenSettings</method>
|
80 |
-
</newsletter_subscriber_admin_system_config_changed_section_mailigen_synchronizer>
|
81 |
-
</observers>
|
82 |
-
</admin_system_config_changed_section_mailigen_synchronizer>
|
83 |
-
<customer_delete_after>
|
84 |
-
<observers>
|
85 |
-
<mailigen_synchronizer_customer_delete_after>
|
86 |
-
<type>singleton</type>
|
87 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
88 |
-
<method>customerDeleteAfter</method>
|
89 |
-
</mailigen_synchronizer_customer_delete_after>
|
90 |
-
</observers>
|
91 |
-
</customer_delete_after>
|
92 |
-
<customer_save_after>
|
93 |
-
<observers>
|
94 |
-
<mailigen_synchronizer_customer_save_after>
|
95 |
-
<type>singleton</type>
|
96 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
97 |
-
<method>customerSaveAfter</method>
|
98 |
-
</mailigen_synchronizer_customer_save_after>
|
99 |
-
</observers>
|
100 |
-
</customer_save_after>
|
101 |
-
<customer_address_save_after>
|
102 |
-
<observers>
|
103 |
-
<mailigen_synchronizer_customer_address_save_after>
|
104 |
-
<type>singleton</type>
|
105 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
106 |
-
<method>customerAddressSaveAfter</method>
|
107 |
-
</mailigen_synchronizer_customer_address_save_after>
|
108 |
-
</observers>
|
109 |
-
</customer_address_save_after>
|
110 |
-
<customer_login>
|
111 |
-
<observers>
|
112 |
-
<mailigen_synchronizer_customer_login>
|
113 |
-
<type>singleton</type>
|
114 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
115 |
-
<method>customerLogin</method>
|
116 |
-
</mailigen_synchronizer_customer_login>
|
117 |
-
</observers>
|
118 |
-
</customer_login>
|
119 |
-
<sales_order_save_after>
|
120 |
-
<observers>
|
121 |
-
<mailigen_synchronizer_sales_order_save_after>
|
122 |
-
<type>singleton</type>
|
123 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
124 |
-
<method>salesOrderSaveAfter</method>
|
125 |
-
</mailigen_synchronizer_sales_order_save_after>
|
126 |
-
</observers>
|
127 |
-
</sales_order_save_after>
|
128 |
-
</events>
|
129 |
-
</global>
|
130 |
-
<admin>
|
131 |
-
<routers>
|
132 |
-
<adminhtml>
|
133 |
-
<args>
|
134 |
-
<modules>
|
135 |
-
<newsletter_subscriber before="Mage_Adminhtml">Mailigen_Synchronizer_Adminhtml</newsletter_subscriber>
|
136 |
-
</modules>
|
137 |
-
</args>
|
138 |
-
</adminhtml>
|
139 |
-
</routers>
|
140 |
-
</admin>
|
141 |
-
<adminhtml>
|
142 |
-
<acl>
|
143 |
-
<resources>
|
144 |
-
<all>
|
145 |
-
<title>Allow Everything</title>
|
146 |
-
</all>
|
147 |
-
<admin>
|
148 |
-
<children>
|
149 |
-
<system>
|
150 |
-
<children>
|
151 |
-
<config>
|
152 |
-
<children>
|
153 |
-
<mailigen_synchronizer>
|
154 |
-
<title>Mailigen - Settings</title>
|
155 |
-
</mailigen_synchronizer>
|
156 |
-
</children>
|
157 |
-
</config>
|
158 |
-
</children>
|
159 |
-
</system>
|
160 |
-
</children>
|
161 |
-
</admin>
|
162 |
-
</resources>
|
163 |
-
</acl>
|
164 |
-
<events>
|
165 |
-
<adminhtml_widget_container_html_before>
|
166 |
-
<observers>
|
167 |
-
<mailigen_synchronizer_adminhtml_widget_container_html_before>
|
168 |
-
<type>singleton</type>
|
169 |
-
<class>Mailigen_Synchronizer_Model_Observer</class>
|
170 |
-
<method>adminhtmlWidgetContainerHtmlBefore</method>
|
171 |
-
</mailigen_synchronizer_adminhtml_widget_container_html_before>
|
172 |
-
</observers>
|
173 |
-
</adminhtml_widget_container_html_before>
|
174 |
-
</events>
|
175 |
-
</adminhtml>
|
176 |
-
<default>
|
177 |
-
<mailigen_synchronizer>
|
178 |
-
<general>
|
179 |
-
<cron_string>0 1 * * *</cron_string>
|
180 |
-
</general>
|
181 |
-
</mailigen_synchronizer>
|
182 |
-
</default>
|
183 |
-
<crontab>
|
184 |
-
<jobs>
|
185 |
-
<mailigen_synchronizer>
|
186 |
-
<schedule>
|
187 |
-
<config_path>mailigen_synchronizer/general/cron_string</config_path>
|
188 |
-
</schedule>
|
189 |
-
<run><model>mailigen_synchronizer/observer::daily_sync</model></run>
|
190 |
-
</mailigen_synchronizer>
|
191 |
-
</jobs>
|
192 |
-
</crontab>
|
193 |
-
</config>
|
194 |
-
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mailigen_Synchronizer>
|
5 |
+
<version>1.1.4</version>
|
6 |
+
</Mailigen_Synchronizer>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<mailigen_synchronizer>
|
11 |
+
<class>Mailigen_Synchronizer_Helper</class>
|
12 |
+
</mailigen_synchronizer>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<mailigen_synchronizer>
|
16 |
+
<class>Mailigen_Synchronizer_Block</class>
|
17 |
+
</mailigen_synchronizer>
|
18 |
+
<adminhtml>
|
19 |
+
<rewrite>
|
20 |
+
<newsletter_subscriber_grid>Mailigen_Synchronizer_Block_Newsletter_Subscriber_Grid</newsletter_subscriber_grid>
|
21 |
+
</rewrite>
|
22 |
+
</adminhtml>
|
23 |
+
</blocks>
|
24 |
+
<models>
|
25 |
+
<mailigen_synchronizer>
|
26 |
+
<class>Mailigen_Synchronizer_Model</class>
|
27 |
+
<resourceModel>mailigen_synchronizer_resource</resourceModel>
|
28 |
+
</mailigen_synchronizer>
|
29 |
+
<mailigen_synchronizer_resource>
|
30 |
+
<class>Mailigen_Synchronizer_Model_Resource</class>
|
31 |
+
<entities>
|
32 |
+
<customer>
|
33 |
+
<table>mailigen_synchronizer_customer</table>
|
34 |
+
</customer>
|
35 |
+
</entities>
|
36 |
+
</mailigen_synchronizer_resource>
|
37 |
+
<newsletter>
|
38 |
+
<rewrite>
|
39 |
+
<subscriber>Mailigen_Synchronizer_Model_Newsletter_Subscriber</subscriber>
|
40 |
+
</rewrite>
|
41 |
+
</newsletter>
|
42 |
+
</models>
|
43 |
+
<resources>
|
44 |
+
<mailigen_synchronizer_setup>
|
45 |
+
<setup>
|
46 |
+
<module>Mailigen_Synchronizer</module>
|
47 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
48 |
+
</setup>
|
49 |
+
<connection>
|
50 |
+
<use>core_setup</use>
|
51 |
+
</connection>
|
52 |
+
</mailigen_synchronizer_setup>
|
53 |
+
<mailigen_synchronizer_write>
|
54 |
+
<connection>
|
55 |
+
<use>core_write</use>
|
56 |
+
</connection>
|
57 |
+
</mailigen_synchronizer_write>
|
58 |
+
<mailigen_synchronizer_read>
|
59 |
+
<connection>
|
60 |
+
<use>core_read</use>
|
61 |
+
</connection>
|
62 |
+
</mailigen_synchronizer_read>
|
63 |
+
</resources>
|
64 |
+
<events>
|
65 |
+
<newsletter_subscriber_save_commit_after>
|
66 |
+
<observers>
|
67 |
+
<newsletter_subscriber_newsletter_subscriber_create_after>
|
68 |
+
<type>singleton</type>
|
69 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
70 |
+
<method>newsletterSubscriberSaveCommitAfter</method>
|
71 |
+
</newsletter_subscriber_newsletter_subscriber_create_after>
|
72 |
+
</observers>
|
73 |
+
</newsletter_subscriber_save_commit_after>
|
74 |
+
<admin_system_config_changed_section_mailigen_synchronizer>
|
75 |
+
<observers>
|
76 |
+
<newsletter_subscriber_admin_system_config_changed_section_mailigen_synchronizer>
|
77 |
+
<type>singleton</type>
|
78 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
79 |
+
<method>adminSystemConfigChangedSectionMailigenSettings</method>
|
80 |
+
</newsletter_subscriber_admin_system_config_changed_section_mailigen_synchronizer>
|
81 |
+
</observers>
|
82 |
+
</admin_system_config_changed_section_mailigen_synchronizer>
|
83 |
+
<customer_delete_after>
|
84 |
+
<observers>
|
85 |
+
<mailigen_synchronizer_customer_delete_after>
|
86 |
+
<type>singleton</type>
|
87 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
88 |
+
<method>customerDeleteAfter</method>
|
89 |
+
</mailigen_synchronizer_customer_delete_after>
|
90 |
+
</observers>
|
91 |
+
</customer_delete_after>
|
92 |
+
<customer_save_after>
|
93 |
+
<observers>
|
94 |
+
<mailigen_synchronizer_customer_save_after>
|
95 |
+
<type>singleton</type>
|
96 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
97 |
+
<method>customerSaveAfter</method>
|
98 |
+
</mailigen_synchronizer_customer_save_after>
|
99 |
+
</observers>
|
100 |
+
</customer_save_after>
|
101 |
+
<customer_address_save_after>
|
102 |
+
<observers>
|
103 |
+
<mailigen_synchronizer_customer_address_save_after>
|
104 |
+
<type>singleton</type>
|
105 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
106 |
+
<method>customerAddressSaveAfter</method>
|
107 |
+
</mailigen_synchronizer_customer_address_save_after>
|
108 |
+
</observers>
|
109 |
+
</customer_address_save_after>
|
110 |
+
<customer_login>
|
111 |
+
<observers>
|
112 |
+
<mailigen_synchronizer_customer_login>
|
113 |
+
<type>singleton</type>
|
114 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
115 |
+
<method>customerLogin</method>
|
116 |
+
</mailigen_synchronizer_customer_login>
|
117 |
+
</observers>
|
118 |
+
</customer_login>
|
119 |
+
<sales_order_save_after>
|
120 |
+
<observers>
|
121 |
+
<mailigen_synchronizer_sales_order_save_after>
|
122 |
+
<type>singleton</type>
|
123 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
124 |
+
<method>salesOrderSaveAfter</method>
|
125 |
+
</mailigen_synchronizer_sales_order_save_after>
|
126 |
+
</observers>
|
127 |
+
</sales_order_save_after>
|
128 |
+
</events>
|
129 |
+
</global>
|
130 |
+
<admin>
|
131 |
+
<routers>
|
132 |
+
<adminhtml>
|
133 |
+
<args>
|
134 |
+
<modules>
|
135 |
+
<newsletter_subscriber before="Mage_Adminhtml">Mailigen_Synchronizer_Adminhtml</newsletter_subscriber>
|
136 |
+
</modules>
|
137 |
+
</args>
|
138 |
+
</adminhtml>
|
139 |
+
</routers>
|
140 |
+
</admin>
|
141 |
+
<adminhtml>
|
142 |
+
<acl>
|
143 |
+
<resources>
|
144 |
+
<all>
|
145 |
+
<title>Allow Everything</title>
|
146 |
+
</all>
|
147 |
+
<admin>
|
148 |
+
<children>
|
149 |
+
<system>
|
150 |
+
<children>
|
151 |
+
<config>
|
152 |
+
<children>
|
153 |
+
<mailigen_synchronizer>
|
154 |
+
<title>Mailigen - Settings</title>
|
155 |
+
</mailigen_synchronizer>
|
156 |
+
</children>
|
157 |
+
</config>
|
158 |
+
</children>
|
159 |
+
</system>
|
160 |
+
</children>
|
161 |
+
</admin>
|
162 |
+
</resources>
|
163 |
+
</acl>
|
164 |
+
<events>
|
165 |
+
<adminhtml_widget_container_html_before>
|
166 |
+
<observers>
|
167 |
+
<mailigen_synchronizer_adminhtml_widget_container_html_before>
|
168 |
+
<type>singleton</type>
|
169 |
+
<class>Mailigen_Synchronizer_Model_Observer</class>
|
170 |
+
<method>adminhtmlWidgetContainerHtmlBefore</method>
|
171 |
+
</mailigen_synchronizer_adminhtml_widget_container_html_before>
|
172 |
+
</observers>
|
173 |
+
</adminhtml_widget_container_html_before>
|
174 |
+
</events>
|
175 |
+
</adminhtml>
|
176 |
+
<default>
|
177 |
+
<mailigen_synchronizer>
|
178 |
+
<general>
|
179 |
+
<cron_string>0 1 * * *</cron_string>
|
180 |
+
</general>
|
181 |
+
</mailigen_synchronizer>
|
182 |
+
</default>
|
183 |
+
<crontab>
|
184 |
+
<jobs>
|
185 |
+
<mailigen_synchronizer>
|
186 |
+
<schedule>
|
187 |
+
<config_path>mailigen_synchronizer/general/cron_string</config_path>
|
188 |
+
</schedule>
|
189 |
+
<run><model>mailigen_synchronizer/observer::daily_sync</model></run>
|
190 |
+
</mailigen_synchronizer>
|
191 |
+
</jobs>
|
192 |
+
</crontab>
|
193 |
+
</config>
|
194 |
+
|
app/etc/modules/Mailigen_Synchronizer.xml
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Mailigen_Synchronizer>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
</Mailigen_Synchronizer>
|
8 |
-
</modules>
|
9 |
-
</config>
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mailigen_Synchronizer>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Mailigen_Synchronizer>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mailigen_Synchronizer</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Two-way sync for Magneto newsletter subscribers and one-way sync for Magnento customers</summary>
|
10 |
-
<description>This extension enables a two-way synchronization between your Magento email newsletter subscriber list and your Mailigen email list, and one-way synchronization between your Magento customer list and your Mailigen email list. It is easy and quick to install and configure, no complex actions or knowledge of programming needed
|
11 |
-
|
12 |
-
Feature-rich synchronization
|
13 |
-
|
14 |
-
- Automatic synchronization between your Magento email subscriber list and one of your Mailigen email lists. When users subscribe to the newsletter in Magento, they will be added to the selected Mailigen contact list
|
15 |
-
- Two-way synchronization when it comes to subscriber status change. When users unsubscribe from your Magento list, they will be removed also from your Mailigen list. And vice versa, users will be removed from your Magento list when unsubscribed from your Mailigen list
|
16 |
-
- Automatic synchronization between your Magento customer list and one of your Mailigen email lists. When customer registers in Magento, they will be added to the selected Mailigen contact list
|
17 |
-
- One-way Magento customers synchronization. All customer information (customer address, last login date, items in cart, orders information) from Magento store will be synced with selected Mailigen contact list
|
18 |
-
|
19 |
-
For more detailed information, instructions and usage of this extension, please visit Mailigen Integrations page or contact our support team
|
20 |
-
|
21 |
Mailigen provides email and integrated marketing services covering full email automation. See a full integration list in Mailigen Integrations page.</description>
|
22 |
-
<notes>-
|
23 |
<authors><author><name>Thomas Nelson</name><user>mailigen</user><email>info@mailigen.com</email></author></authors>
|
24 |
-
<date>2015-
|
25 |
-
<time>
|
26 |
-
<contents><target name="magecommunity"><dir name="Mailigen"><dir name="Synchronizer"><dir name="Block"><dir name="Adminhtml"><dir name="Sync"><file name="Information.php" hash="0ab1c0f348bebc09b8d4463aa915b0ba"/></dir></dir><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="
|
27 |
<compatible/>
|
28 |
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
29 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mailigen_Synchronizer</name>
|
4 |
+
<version>1.1.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License (GPL)</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Two-way sync for Magneto newsletter subscribers and one-way sync for Magnento customers</summary>
|
10 |
+
<description>This extension enables a two-way synchronization between your Magento email newsletter subscriber list and your Mailigen email list, and one-way synchronization between your Magento customer list and your Mailigen email list. It is easy and quick to install and configure, no complex actions or knowledge of programming needed.&#xD;
|
11 |
+
&#xD;
|
12 |
+
Feature-rich synchronization&#xD;
|
13 |
+
&#xD;
|
14 |
+
- Automatic synchronization between your Magento email subscriber list and one of your Mailigen email lists. When users subscribe to the newsletter in Magento, they will be added to the selected Mailigen contact list.&#xD;
|
15 |
+
- Two-way synchronization when it comes to subscriber status change. When users unsubscribe from your Magento list, they will be removed also from your Mailigen list. And vice versa, users will be removed from your Magento list when unsubscribed from your Mailigen list.&#xD;
|
16 |
+
- Automatic synchronization between your Magento customer list and one of your Mailigen email lists. When customer registers in Magento, they will be added to the selected Mailigen contact list.&#xD;
|
17 |
+
- One-way Magento customers synchronization. All customer information (customer address, last login date, items in cart, orders information) from Magento store will be synced with selected Mailigen contact list.&#xD;
|
18 |
+
&#xD;
|
19 |
+
For more detailed information, instructions and usage of this extension, please visit Mailigen Integrations page or contact our support team.&#xD;
|
20 |
+
&#xD;
|
21 |
Mailigen provides email and integrated marketing services covering full email automation. See a full integration list in Mailigen Integrations page.</description>
|
22 |
+
<notes>- Fixed package.</notes>
|
23 |
<authors><author><name>Thomas Nelson</name><user>mailigen</user><email>info@mailigen.com</email></author></authors>
|
24 |
+
<date>2015-06-12</date>
|
25 |
+
<time>18:37:23</time>
|
26 |
+
<contents><target name="magecommunity"><dir name="Mailigen"><dir name="Synchronizer"><dir name="Block"><dir name="Adminhtml"><dir name="Sync"><file name="Information.php" hash="0ab1c0f348bebc09b8d4463aa915b0ba"/></dir></dir><dir name="Newsletter"><dir name="Subscriber"><file name="Grid.php" hash="1a975840b9f1704644cb8228468ad743"/></dir></dir></dir><dir name="Helper"><file name="Customer.php" hash="6ee6ba8694c7d6179ebd0c488bebbed7"/><file name="Data.php" hash="4194f61cf155d06a76c8a37b3b74cec1"/><file name="Log.php" hash="c9cd510436bb0e03750fc8c26ca3860c"/></dir><dir name="Model"><dir name="Customer"><dir name="Merge"><file name="Field.php" hash="68314df0847063e4053ffb505087b7ea"/></dir></dir><file name="Customer.php" hash="50b7d9768124f3bd9f6da86067a49494"/><file name="List.php" hash="329edb291f38861b7f2b1a79e01a4896"/><file name="Mailigen.php" hash="daff240193f3d2fd7af9f3952cc9a6f8"/><dir name="Newsletter"><dir name="Merge"><file name="Field.php" hash="ee54a87b79a9c4274c02722db4d65a16"/></dir><file name="Subscriber.php" hash="0be821ef351f8c9ed9811c1b0054b3a2"/></dir><file name="Observer.php" hash="df26816554a80d8b6dfd503a64dd1d8c"/><dir name="Resource"><dir name="Customer"><file name="Collection.php" hash="350fd71cb6db7688a932530256856533"/></dir><file name="Customer.php" hash="bb95830ef5e95b4a361a858d081ff4f8"/><dir name="Iterator"><file name="Batched.php" hash="d2b0ec0268773422de00cb6766083753"/></dir></dir><file name="Schedule.php" hash="e1c494dce9652566ae679a2032c86769"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Customer"><file name="List.php" hash="5370ca37cb8d4f0a268e3ef2e9f4c673"/></dir><dir name="Newsletter"><file name="List.php" hash="05f2ce9cb0954a35cc87f7899164beaa"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="MailigenController.php" hash="772672a78be5385faa660bded0157ddc"/></dir></dir><dir name="data"><dir name="mailigen_synchronizer_setup"><file name="data-install-1.1.0.php" hash="30f1fdb649862fcbbd943aeb7ce65c7f"/></dir></dir><dir name="etc"><file name="config.xml" hash="5c163f8362780fe7d68c1445cfc72b79"/><file name="system.xml" hash="52ba369f2ae3d11a0b5c71e101ec743a"/></dir><dir name="sql"><dir name="mailigen_synchronizer_setup"><file name="install-1.1.0.php" hash="57ee87c647fca4c728f9ee988be84231"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mailigen_Synchronizer.xml" hash="4c1560ac5f7042f57bfcf13a0e49bc00"/></dir></target><target name="magelib"><dir name="mailigen"><file name="MGAPI.class.php" hash="16b7712206e95bf61c2cf6f92ef71583"/></dir></target></contents>
|
27 |
<compatible/>
|
28 |
<dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php></required></dependencies>
|
29 |
</package>
|