Conlabz_CrConnect - Version 3.1.5

Version Notes

Bugfix: Customer registration as newsletter subscriber

Download this release

Release Info

Developer Conlabz GmbH
Extension Conlabz_CrConnect
Version 3.1.5
Comparing to
See all releases


Code changes from version 3.1.4 to 3.1.5

Files changed (26) hide show
  1. app/code/community/Conlabz/CrConnect/Block/Customer/Newsletter.php +9 -16
  2. app/code/community/Conlabz/CrConnect/Helper/Data.php +36 -40
  3. app/code/community/Conlabz/CrConnect/Model/Api.php +131 -157
  4. app/code/community/Conlabz/CrConnect/Model/Checkout/Observer.php +18 -20
  5. app/code/community/Conlabz/CrConnect/Model/Observer.php +66 -92
  6. app/code/community/Conlabz/CrConnect/Model/Search.php +7 -14
  7. app/code/community/Conlabz/CrConnect/Model/Subscriber.php +6 -15
  8. app/code/community/Conlabz/CrConnect/Test/Config/ActivationXml.php +12 -0
  9. app/code/community/Conlabz/CrConnect/controllers/AccountController.php +0 -144
  10. app/code/community/Conlabz/CrConnect/controllers/Adminhtml/{ConfigController.php → CrconfigController.php} +11 -18
  11. app/code/community/Conlabz/CrConnect/controllers/Adminhtml/CrconnectController.php +6 -9
  12. app/code/community/Conlabz/CrConnect/controllers/HookController.php +20 -20
  13. app/code/community/Conlabz/CrConnect/controllers/ManageController.php +3 -5
  14. app/code/community/Conlabz/CrConnect/controllers/SearchController.php +16 -8
  15. app/code/community/Conlabz/CrConnect/controllers/SubscriberController.php +0 -6
  16. app/code/community/Conlabz/CrConnect/controllers/UnsubscribeController.php +8 -8
  17. app/code/community/Conlabz/CrConnect/etc/config.xml +28 -14
  18. app/code/community/Conlabz/CrConnect/etc/jstranslator.xml +15 -0
  19. app/design/adminhtml/default/default/layout/crconnect.xml +7 -7
  20. app/design/adminhtml/default/default/template/crconnect/config.phtml +15 -0
  21. app/design/adminhtml/default/default/template/crconnect/config/header.phtml +0 -19
  22. app/design/adminhtml/default/default/template/crconnect/newsletter/subscriber/list.phtml +119 -118
  23. app/design/adminhtml/default/default/template/crconnect/system/config/form/field/cr_array_groups.phtml +108 -134
  24. app/design/frontend/base/default/layout/crconnect.xml +8 -15
  25. app/etc/modules/Conlabz_CrConnect.xml +4 -1
  26. package.xml +5 -5
app/code/community/Conlabz/CrConnect/Block/Customer/Newsletter.php CHANGED
@@ -1,49 +1,42 @@
1
  <?php
2
  class Conlabz_CrConnect_Block_Customer_Newsletter extends Mage_Customer_Block_Newsletter
3
  {
4
-
5
  private $_api;
6
-
7
  public function __construct()
8
  {
9
  $this->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
10
  $this->_api = Mage::getModel('crconnect/api');
11
-
12
  parent::__construct();
13
  }
14
-
15
  public function getCustomerGroupName()
16
  {
17
-
18
  $groupName = Mage::getModel('customer/group')->load($this->getCustomerGroupId())->getCode();
19
-
20
  }
21
- /*
 
22
  * Check if Customer Group not default
23
- *
24
  * @return bool
25
  */
26
  public function isDefaultGroupUser()
27
  {
28
-
29
  return Mage::helper("crconnect")->isDefaultGroupUser($this->getCustomerGroupId());
30
-
31
  }
32
-
33
  public function isDefaultSubscribed()
34
  {
35
-
36
  return $this->_api->isSubscribed(Mage::getSingleton('customer/session')->getCustomer()->getEmail());
37
-
38
  }
39
-
40
  public function isCustomSubscribed()
41
  {
42
-
43
  return $this->_api->isSubscribed(
44
  Mage::getSingleton('customer/session')->getCustomer()->getEmail(),
45
  Mage::getSingleton('customer/session')->getCustomerGroupId()
46
  );
47
-
48
  }
49
  }
1
  <?php
2
  class Conlabz_CrConnect_Block_Customer_Newsletter extends Mage_Customer_Block_Newsletter
3
  {
 
4
  private $_api;
5
+
6
  public function __construct()
7
  {
8
  $this->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
9
  $this->_api = Mage::getModel('crconnect/api');
10
+
11
  parent::__construct();
12
  }
13
+
14
  public function getCustomerGroupName()
15
  {
 
16
  $groupName = Mage::getModel('customer/group')->load($this->getCustomerGroupId())->getCode();
17
+ return $groupName;
18
  }
19
+
20
+ /**
21
  * Check if Customer Group not default
22
+ *
23
  * @return bool
24
  */
25
  public function isDefaultGroupUser()
26
  {
 
27
  return Mage::helper("crconnect")->isDefaultGroupUser($this->getCustomerGroupId());
 
28
  }
29
+
30
  public function isDefaultSubscribed()
31
  {
 
32
  return $this->_api->isSubscribed(Mage::getSingleton('customer/session')->getCustomer()->getEmail());
 
33
  }
34
+
35
  public function isCustomSubscribed()
36
  {
 
37
  return $this->_api->isSubscribed(
38
  Mage::getSingleton('customer/session')->getCustomer()->getEmail(),
39
  Mage::getSingleton('customer/session')->getCustomerGroupId()
40
  );
 
41
  }
42
  }
app/code/community/Conlabz/CrConnect/Helper/Data.php CHANGED
@@ -10,7 +10,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
10
  const XML_SYNC_ORDERS_CONFIG_PATH = "crroot/crconnect/sync_orders";
11
  const XML_SYNC_ORDERS_EMAILS_CONFIG_PATH = "crroot/crconnect/sync_orders_emails";
12
  const XML_SYNC_ORDERS_M2E_PATH = "crroot/crconnect/m2e_sync";
13
-
14
  const XML_GROUP_SEPARATION_CONFIG_PATH = "crroot/crconnect/auto_separate";
15
  const XML_GROUP_KEYS = "crroot/crconnect/groups_keys";
16
  const XML_PATH_LOGGED_CONFIRM_EMAIL_TEMPLATE = 'crroot/crconnect/confirm_newsletter_logged';
@@ -19,7 +19,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
19
  const XML_FEED_PASSWORD = 'crroot/csconnect_search/password';
20
 
21
  const DEFAULT_GROUP_ID = 1;
22
-
23
  private $_currentStoreId = false;
24
  private $_currentWebsiteId = false;
25
 
@@ -50,7 +50,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
50
  {
51
  return $this->getConfigForStore(self::XML_FEED_PASSWORD);
52
  }
53
-
54
  /**
55
  * Is exclude M2E orders from sync
56
  */
@@ -76,7 +76,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
76
  {
77
  return $this->getConfigForStore(self::XML_API_KEY_CONFIG_PATH);
78
  }
79
-
80
  /**
81
  * Set Api Key
82
  *
@@ -94,11 +94,11 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
94
  */
95
  public function getDefaultListId()
96
  {
97
-
98
  return $this->getConfigForStore(self::XML_LIST_ID_CONFIG_PATH);
99
 
100
  }
101
-
102
  /**
103
  * Get Default Form Id
104
  *
@@ -106,7 +106,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
106
  */
107
  public function getDefaultFormId()
108
  {
109
-
110
  return $this->getConfigForStore(self::XML_FORM_ID_CONFIG_PATH);
111
 
112
  }
@@ -133,7 +133,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
133
 
134
  /**
135
  * Log Clever Reach Connect activity
136
- *
137
  * @param - string message
138
  */
139
  public function log($message)
@@ -141,7 +141,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
141
 
142
  Mage::log($message, null, "crconnect.log", true);
143
  }
144
-
145
  /**
146
  * Get if sync order emails enabled
147
  */
@@ -152,21 +152,21 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
152
 
153
  /**
154
  * Get groups keys json value from system settings
155
- *
156
  * @return json
157
  */
158
  public function getGroupsSystemValue()
159
  {
160
-
161
  return $this->getConfigForStore(self::XML_GROUP_KEYS);
162
-
163
  }
164
-
165
  public function getConfigForStore($path)
166
  {
167
-
168
  $newsletterConfig = Mage::getStoreConfig($path);
169
-
170
  if ($store = $this->_currentStoreId) {
171
  return Mage::getStoreConfig($path, $store);
172
  }
@@ -182,7 +182,7 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
182
  // return $newsletterConfig[0];
183
  // }
184
  // }
185
-
186
  if ($store = Mage::app()->getRequest()->getParam('store')) {
187
  $newsletterConfig = Mage::getStoreConfig($path, $store);
188
  } else {
@@ -194,15 +194,15 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
194
  }
195
  }
196
  return $newsletterConfig;
197
-
198
  }
199
 
200
  /**
201
  * get non default groups ids
202
- *
203
  * @param int group ID - if isset get key for special group
204
  * @param bool - if true - return default list if in case if user groups Id key not found
205
- *
206
  * @return array | int = array of keys, OR groups ID
207
  */
208
  public function getGroupsIds($groupId = false, $defaultOnFail = false)
@@ -230,13 +230,13 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
230
  }
231
  return $keysArray;
232
  }
233
-
234
  /**
235
  * get non default forms ids
236
- *
237
  * @param int group ID - if isset get key for special group
238
  * @param bool - if true - return default list if in case if user groups Id key not found
239
- *
240
  * @return array | int = array of keys, OR groups ID
241
  */
242
  public function getFormsIds($groupId = false, $defaultOnFail = false)
@@ -265,17 +265,17 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
265
 
266
  return $keysArray;
267
  }
268
-
269
  /**
270
  * get non default forms ids
271
- *
272
  * @return array | int = array of keys, OR groups ID
273
  */
274
  public function getFormsIdsByKeys()
275
  {
276
 
277
  $newsletterConfig = unserialize($this->getConfigForStore(self::XML_GROUP_KEYS));
278
-
279
  $keysArray = array();
280
 
281
  // Generate array of groupId=>key
@@ -295,20 +295,16 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
295
  */
296
  public function getActiveMageSubscribers()
297
  {
298
-
299
  return Mage::getResourceModel('newsletter/subscriber_collection')
300
- ->showStoreInfo()
301
- ->showCustomerInfo()
302
- ->useOnlySubscribed()
303
- ->getData();
304
  }
305
 
306
  public function prepareUserdata($customer, $custom_fields = false, $deactivate = false)
307
  {
308
-
309
- $name = $customer->getFirstname() . " " . $customer->getLastname();
310
  $newEmail = $customer->getEmail();
311
- $subscribed = $customer->getIsSubscribed();
312
  $shippingAddress = false;
313
  if ($shippingAddress = $customer->getDefaultBillingAddress()) {
314
  $shippingAddress = $shippingAddress->getData();
@@ -369,31 +365,31 @@ class Conlabz_CrConnect_Helper_Data extends Mage_Core_Helper_Abstract
369
  {
370
 
371
  return $this->getConfigForStore(self::XML_IS_SHOW_CUSTOMER_GROUP);
372
-
373
  }
374
-
375
  /**
376
  * If more then 1 user group key added, return true
377
  */
378
  public function isMultiGroupsSettings()
379
- {
380
  $groupIds = $this->getGroupsIds();
381
  if (is_array($groupIds) && sizeof($groupIds) > 1) {
382
  return true;
383
  }
384
- return false;
385
  }
386
 
387
  public function isDefaultGroupUser($groupId)
388
- {
389
  if ($groupId != self::DEFAULT_GROUP_ID) {
390
  return true;
391
  }
392
  return false;
393
  }
394
-
395
  public function getM2eShippingMethods()
396
- {
397
  return array("m2eproshipping_m2eproshipping");
398
  }
399
  }
10
  const XML_SYNC_ORDERS_CONFIG_PATH = "crroot/crconnect/sync_orders";
11
  const XML_SYNC_ORDERS_EMAILS_CONFIG_PATH = "crroot/crconnect/sync_orders_emails";
12
  const XML_SYNC_ORDERS_M2E_PATH = "crroot/crconnect/m2e_sync";
13
+
14
  const XML_GROUP_SEPARATION_CONFIG_PATH = "crroot/crconnect/auto_separate";
15
  const XML_GROUP_KEYS = "crroot/crconnect/groups_keys";
16
  const XML_PATH_LOGGED_CONFIRM_EMAIL_TEMPLATE = 'crroot/crconnect/confirm_newsletter_logged';
19
  const XML_FEED_PASSWORD = 'crroot/csconnect_search/password';
20
 
21
  const DEFAULT_GROUP_ID = 1;
22
+
23
  private $_currentStoreId = false;
24
  private $_currentWebsiteId = false;
25
 
50
  {
51
  return $this->getConfigForStore(self::XML_FEED_PASSWORD);
52
  }
53
+
54
  /**
55
  * Is exclude M2E orders from sync
56
  */
76
  {
77
  return $this->getConfigForStore(self::XML_API_KEY_CONFIG_PATH);
78
  }
79
+
80
  /**
81
  * Set Api Key
82
  *
94
  */
95
  public function getDefaultListId()
96
  {
97
+
98
  return $this->getConfigForStore(self::XML_LIST_ID_CONFIG_PATH);
99
 
100
  }
101
+
102
  /**
103
  * Get Default Form Id
104
  *
106
  */
107
  public function getDefaultFormId()
108
  {
109
+
110
  return $this->getConfigForStore(self::XML_FORM_ID_CONFIG_PATH);
111
 
112
  }
133
 
134
  /**
135
  * Log Clever Reach Connect activity
136
+ *
137
  * @param - string message
138
  */
139
  public function log($message)
141
 
142
  Mage::log($message, null, "crconnect.log", true);
143
  }
144
+
145
  /**
146
  * Get if sync order emails enabled
147
  */
152
 
153
  /**
154
  * Get groups keys json value from system settings
155
+ *
156
  * @return json
157
  */
158
  public function getGroupsSystemValue()
159
  {
160
+
161
  return $this->getConfigForStore(self::XML_GROUP_KEYS);
162
+
163
  }
164
+
165
  public function getConfigForStore($path)
166
  {
167
+
168
  $newsletterConfig = Mage::getStoreConfig($path);
169
+
170
  if ($store = $this->_currentStoreId) {
171
  return Mage::getStoreConfig($path, $store);
172
  }
182
  // return $newsletterConfig[0];
183
  // }
184
  // }
185
+
186
  if ($store = Mage::app()->getRequest()->getParam('store')) {
187
  $newsletterConfig = Mage::getStoreConfig($path, $store);
188
  } else {
194
  }
195
  }
196
  return $newsletterConfig;
197
+
198
  }
199
 
200
  /**
201
  * get non default groups ids
202
+ *
203
  * @param int group ID - if isset get key for special group
204
  * @param bool - if true - return default list if in case if user groups Id key not found
205
+ *
206
  * @return array | int = array of keys, OR groups ID
207
  */
208
  public function getGroupsIds($groupId = false, $defaultOnFail = false)
230
  }
231
  return $keysArray;
232
  }
233
+
234
  /**
235
  * get non default forms ids
236
+ *
237
  * @param int group ID - if isset get key for special group
238
  * @param bool - if true - return default list if in case if user groups Id key not found
239
+ *
240
  * @return array | int = array of keys, OR groups ID
241
  */
242
  public function getFormsIds($groupId = false, $defaultOnFail = false)
265
 
266
  return $keysArray;
267
  }
268
+
269
  /**
270
  * get non default forms ids
271
+ *
272
  * @return array | int = array of keys, OR groups ID
273
  */
274
  public function getFormsIdsByKeys()
275
  {
276
 
277
  $newsletterConfig = unserialize($this->getConfigForStore(self::XML_GROUP_KEYS));
278
+
279
  $keysArray = array();
280
 
281
  // Generate array of groupId=>key
295
  */
296
  public function getActiveMageSubscribers()
297
  {
 
298
  return Mage::getResourceModel('newsletter/subscriber_collection')
299
+ ->showStoreInfo()
300
+ ->showCustomerInfo()
301
+ ->useOnlySubscribed()
302
+ ->getData();
303
  }
304
 
305
  public function prepareUserdata($customer, $custom_fields = false, $deactivate = false)
306
  {
 
 
307
  $newEmail = $customer->getEmail();
 
308
  $shippingAddress = false;
309
  if ($shippingAddress = $customer->getDefaultBillingAddress()) {
310
  $shippingAddress = $shippingAddress->getData();
365
  {
366
 
367
  return $this->getConfigForStore(self::XML_IS_SHOW_CUSTOMER_GROUP);
368
+
369
  }
370
+
371
  /**
372
  * If more then 1 user group key added, return true
373
  */
374
  public function isMultiGroupsSettings()
375
+ {
376
  $groupIds = $this->getGroupsIds();
377
  if (is_array($groupIds) && sizeof($groupIds) > 1) {
378
  return true;
379
  }
380
+ return false;
381
  }
382
 
383
  public function isDefaultGroupUser($groupId)
384
+ {
385
  if ($groupId != self::DEFAULT_GROUP_ID) {
386
  return true;
387
  }
388
  return false;
389
  }
390
+
391
  public function getM2eShippingMethods()
392
+ {
393
  return array("m2eproshipping_m2eproshipping");
394
  }
395
  }
app/code/community/Conlabz/CrConnect/Model/Api.php CHANGED
@@ -4,41 +4,39 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
4
  {
5
 
6
  const SUCCESS_STATUS = "SUCCESS";
7
-
8
  const ERROR_CODE_DUPLICATED = 50;
9
  const ERROR_CODE_INVALID = 40;
10
-
11
  public function __construct()
12
  {
13
-
14
  $this->init();
15
-
16
  }
17
 
18
  public function init($storeId = false)
19
  {
20
-
21
  $this->_helper = Mage::helper('crconnect');
22
-
23
  if ($storeId) {
24
  $this->_helper->log($this->_helper->__("SET Helper Store: ". $storeId));
25
  $this->_helper->setCurrentStoreId($storeId);
26
  }
27
-
28
  $this->_apiKey = $this->_helper->getApiKey();
29
  $this->_listID = $this->_helper->getDefaultListId();
30
  $this->_client = $this->getSoapClient();
31
  $this->_groupsListIds = $this->_helper->getGroupsIds();
32
-
33
  }
34
- /*
 
35
  * Get Connection to CrConnect
36
  */
37
-
38
  public function getSoapClient()
39
  {
40
-
41
  try {
 
 
42
  $client = new SoapClient($this->_helper->getWsdl(), array("trace" => true, "exception" => 0));
43
  return $client;
44
  } catch (Exception $e) {
@@ -48,11 +46,9 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
48
  }
49
  return false;
50
  }
51
-
52
-
53
  public function subscribe($customer = false, $groupId = 0)
54
  {
55
-
56
  if ($this->isConnected()) {
57
  if (!$customer) {
58
  $customer = Mage::getSingleton('customer/session')->getCustomer();
@@ -63,7 +59,6 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
63
  $this->_helper->log($this->_helper->__("CALL: receiverAdd - SUCCESS"));
64
  $this->_helper->log($crReceiver);
65
  $this->_helper->log("receiverAdd: GroupId: ".$groupId);
66
-
67
  return true;
68
  } else {
69
  $this->_helper->log($this->_helper->__("CALL: receiverAdd - FAIL, then call receiverSetActive:".$customer->getEmail()));
@@ -72,14 +67,12 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
72
  $addResult = $this->receiverSetActive($customer->getEmail(), $groupId);
73
  }
74
  return true;
75
-
76
  }
77
  return false;
78
  }
79
-
80
- public function update($customer = false, $groupId = 0)
81
  {
82
-
83
  if ($this->isConnected()) {
84
  if (!$customer) {
85
  $customer = Mage::getSingleton('customer/session')->getCustomer();
@@ -94,161 +87,153 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
94
  return true;
95
  } else {
96
  $this->_helper->log($this->_helper->__("CALL: receiverUpdate - FAIL"));
97
-
98
  }
99
  return true;
100
-
101
  }
102
  return false;
103
-
104
  }
105
-
106
  public function unsubscribe($email = false, $groupId = 0)
107
  {
108
-
109
  if ($this->isConnected() && $email) {
110
  $result = $this->receiverSetInactive($email, $groupId);
111
  if ($result->status == self::SUCCESS_STATUS) {
112
  $this->_helper->log($this->_helper->__("CALL: receiverSetInactive - SUCCESS, Email:".$email." | GroupId:".$groupId));
113
  return true;
114
  }
115
-
116
  }
117
  return false;
118
  }
119
 
120
- /*
121
- * Check if connection was successfull
 
 
122
  */
123
-
124
  public function isConnected()
125
  {
126
-
127
  if ($this->_client !== false && $this->_client !== null) {
128
  return true;
129
  }
130
  return false;
131
  }
132
 
133
- /*
134
  * If Account have more then 1 group
 
 
135
  */
136
-
137
  public function isMultyGroups()
138
  {
139
-
140
  if (is_array($this->_groupsListIds) && sizeof($this->_groupsListIds) > 0) {
141
  return true;
142
  }
143
  return false;
144
  }
145
-
 
 
 
 
 
146
  public function getGroupKey($groupId)
147
  {
148
-
149
  if ($groupId == 0) {
150
- $listId = $this->_helper->getDefaultListId();
151
  } else {
152
- $listId = $this->_helper->getGroupsIds($groupId, true);
153
  }
154
- return $listId;
155
  }
156
 
157
- /*
158
  * Subscriber simple user to special group
159
  */
160
  public function receiverAdd($customerData, $groupId = 0)
161
  {
162
-
163
  $listId = $this->getGroupKey($groupId);
164
-
165
  $this->_helper->log("CALL: receiverAdd");
166
  $this->_helper->log($customerData);
167
-
168
  return $this->_client->receiverAdd($this->_apiKey, $listId, $customerData);
169
-
170
  }
171
-
172
- /*
173
  * Update simple user
174
  */
175
  public function receiverUpdate($customerData, $groupId = 0)
176
  {
177
-
178
  $listId = $this->getGroupKey($groupId);
179
-
180
  $this->_helper->log("CALL: receiverAdd");
181
  $this->_helper->log($customerData);
182
-
183
  return $this->_client->receiverAdd($this->_apiKey, $listId, $customerData);
184
-
185
  }
186
-
187
- /*
 
188
  * Deactivates a given receiver/email
189
  */
190
  public function receiverSetInactive($email, $groupId = 0)
191
  {
192
-
193
  $listId = $this->getGroupKey($groupId);
194
  $this->_helper->log("CALL: receiverSetInactive - Email".$email." | GroupId:". $groupId);
195
  return $this->_client->receiverSetInactive($this->_apiKey, $listId, $email);
196
-
197
  }
198
-
 
 
 
 
 
 
199
  public function receiverSetActive($email, $groupId = 0)
200
  {
201
-
202
  $listId = $this->getGroupKey($groupId);
203
  $this->_helper->log("CALL: receiverSetActive - Email".$email." | GroupId:". $groupId);
204
  return $this->_client->receiverSetActive($this->_apiKey, $listId, $email);
205
-
206
  }
207
 
208
-
209
- /*
210
  * Return request result
211
- *
212
  * @param string result
213
  * @param error message if exists, or false
214
- *
215
- * @return array - result
216
  */
217
-
218
  private function returnResult($result, $fail = false)
219
  {
220
-
221
  $return = array();
222
  $return['error'] = $fail;
223
  $return['data'] = $result;
224
  return $return;
225
  }
226
 
227
- /*
228
  * Get user account details
229
  */
230
-
231
  public function clientGetDetails()
232
  {
233
-
234
  $result = $this->_client->clientGetDetails($this->_apiKey);
235
  if ($result->status == self::SUCCESS_STATUS) {
236
  return $this->returnResult($result->data);
237
  } else {
238
  $this->_helper->log($this->_helper->__("CALL: clientGetDetails - failed"));
239
  $this->_helper->log($result->message);
240
-
241
  return $this->returnResult($result->data, $this->_helper->__("Your CleverReach API key seems to be invalid. Please check them and try again! <br /> Have no CleverReach account? Contact <a href='mailto:info@conlabz.de'>Conlabz GmbH</a> for additional information."));
242
  }
243
  }
244
 
245
- /*
246
  * Get Group Information
247
  */
248
-
249
  public function groupGetStats($groupId = false)
250
  {
251
-
252
  if (!$groupId) {
253
  $groupId = $this->_helper->getDefaultListId();
254
  }
@@ -259,7 +244,7 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
259
  } else {
260
  $this->_helper->log($this->_helper->__("CALL: groupGetStats - failed. List ID: ".$groupId));
261
  $this->_helper->log($this->_helper->__($result->message));
262
-
263
  if ($groupId) {
264
  return $this->returnResult($result->data, $this->_helper->__("Your list ID (%s) seem to be wrong. Please select other group!", $groupId));
265
  }
@@ -267,13 +252,11 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
267
  }
268
  }
269
 
270
- /*
271
  * Get Group Information
272
  */
273
-
274
  public function groupGetDetails($listId = false)
275
  {
276
-
277
  if (!$listId) {
278
  $listId = $this->_helper->getDefaultListId();
279
  }
@@ -284,41 +267,38 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
284
  } else {
285
  $this->_helper->log($this->_helper->__("CALL: groupGetDetails - failed. List ID: ".$listId));
286
  $this->_helper->log($this->_helper->__($result->message));
287
-
288
  if ($listId) {
289
  return $this->returnResult($result->data, $this->_helper->__("Your list ID (%s) seem to be wrong. Please select other group!", $listId));
290
  }
291
  return $this->returnResult($result->data, $this->_helper->__("Please set your CleverReach user group in Extension settings section."));
292
-
293
  }
294
  }
295
 
296
- /*
297
  * Add batch of users to CleverReach
298
- *
299
  * @param array - butch of users
300
  * @param int - Magento Groups ID
301
- *
302
  * @return int amount of synced users
303
  */
304
-
305
  public function receiverAddBatch($batch, $groupId = 0)
306
  {
307
-
308
  if ($groupId == 0) {
309
  $listId = $this->_helper->getDefaultListId();
310
  } else {
311
  $listId = $this->_helper->getGroupsIds($groupId);
312
  }
313
-
314
  $this->_helper->log("CrConnect: receiverAddBatch.");
315
  $this->_helper->log($batch);
316
-
317
  $result = $this->_client->receiverAddBatch($this->_apiKey, $listId, $batch);
318
  if ($result->status == self::SUCCESS_STATUS) {
319
  $this->_helper->log("CrConnect: receiverAddBatch - SUCCESS.");
320
  $this->_helper->log("CrConnect: receiverAddBatch - key:".$this->_apiKey." | listId:".$listId);
321
-
322
  return count($batch);
323
  } else {
324
  $this->_helper->log("CrConnect: receiverAddBatch - FAIL.");
@@ -329,9 +309,14 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
329
  }
330
  }
331
 
 
 
 
 
 
 
332
  public function receiverAddOrder($email, $orderInfo)
333
  {
334
-
335
  $listId = $this->_helper->getDefaultListId();
336
  $result = $this->_client->receiverAddOrder($this->_apiKey, $listId, $email, $orderInfo);
337
  Mage::helper("crconnect")->log("CALL receiverAddOrder: ".$email);
@@ -342,17 +327,16 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
342
  } else {
343
  return false;
344
  }
345
-
346
  }
347
- /*
 
348
  * Get and check if user subscribed to group
349
  *
350
- * @param string - user email
351
- * @param int - group Id
352
  *
353
- * @return bool true|false
354
  */
355
-
356
  public function isSubscribed($email, $groupId = 0)
357
  {
358
 
@@ -371,40 +355,43 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
371
  }
372
  return false;
373
  }
374
-
375
- /*
376
  * get groups for API key
 
 
377
  */
378
  public function getGroupsForKey($apiKey)
379
  {
380
-
381
  $result = $this->_client->groupGetList($apiKey);
382
  if ($result->status == self::SUCCESS_STATUS) {
383
  return $result->data;
384
  } else {
385
  return false;
386
  }
387
-
388
  }
389
-
390
- /*
391
  * get groups for API key
392
  */
393
  public function getFormsForGroup($apiKey, $groupId)
394
  {
395
-
396
  $result = $this->_client->formsGetList($apiKey, $groupId);
397
  if ($result->status == self::SUCCESS_STATUS) {
398
  return $result->data;
399
  } else {
400
  return false;
401
  }
402
-
403
  }
404
-
 
 
 
 
 
 
405
  public function formsSendActivationMail($customer, $groupId = 0)
406
  {
407
-
408
  if ($this->isConnected()) {
409
  // if not customer transfered, get current one from session
410
  if (!$customer) {
@@ -414,15 +401,17 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
414
 
415
  // Subscriber customer first
416
  $addResult = $this->receiverAdd($crReceiver, $groupId);
417
-
 
 
418
  $doidata = array(
419
- "user_ip" => $_SERVER['REMOTE_ADDR'],
420
- "user_agent" => $_SERVER['HTTP_USER_AGENT'],
421
  "referer" => Mage::getUrl("/"),
422
  "postdata" => "",
423
  "info" => "",
424
  );
425
-
426
  if ($addResult->status == self::SUCCESS_STATUS) {
427
  // Send activation email for customer
428
  $formId = $this->_helper->getFormsIds($groupId, true);
@@ -446,51 +435,40 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
446
  } else {
447
  $this->_helper->log("during formsSendActivationMail :: formsSendActivationMail :: ERROR");
448
  $this->_helper->log($result->message);
449
-
450
  if ($result->statuscode == self::ERROR_CODE_INVALID) {
451
  Mage::getSingleton("core/session")->addError($this->_helper->__("This Email blocked or wrong"));
452
  }
453
  }
454
-
455
  } else {
456
  Mage::getSingleton("core/session")->addError($this->_helper->__("This Email already in our database"));
457
-
458
  }
459
-
460
  }
461
-
462
  }
463
  return false;
464
-
465
  }
466
-
467
  }
468
-
469
 
470
- /*
471
  * Sync data between Magento and Cleverreach
472
  */
473
-
474
  public function synchronize()
475
  {
476
-
477
  //Check if we connected to Cr account
478
  if (!$this->isConnected()) {
479
  return false;
480
  }
481
 
482
  $this->_helper->log("RUN SYNCHRONIZATION");
483
-
484
- $isTrackingEnabled = $this->_helper->isTrackingEnabled();
485
- $subscribers = $this->_helper->getActiveMageSubscribers();
486
 
 
487
  $syncedUsers = 0;
488
  $batch = array();
489
  $i = 0;
490
 
491
  foreach ($subscribers as $subscriber) {
492
  $userGroup = 0;
493
-
494
  // If we should separate customers to different groups, then get customer Groups iD if exists
495
  if ($this->_helper->isSeparationEnabled()) {
496
  if ($subscriber["subscriber_email"]) {
@@ -501,23 +479,22 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
501
  }
502
  }
503
  }
504
-
505
-
506
  if (isset($subscriber['customer_id']) && $subscriber['customer_id']) {
507
  $tmp = $this->_helper->prepareUserdata(Mage::getModel("customer/customer")->load($subscriber['customer_id']));
508
  } else {
509
  $tmp["email"] = $subscriber["subscriber_email"];
510
  $tmp["source"] = "MAGENTO";
511
-
512
  // Prepare customer attributes
 
 
513
  $tmp["attributes"] = array(
514
- 0 => array("key" => "firstname", "value" => @$subscriber["customer_firstname"]),
515
- 1 => array("key" => "lastname", "value" => @$subscriber["customer_lastname"]),
516
- 2 => array("key" => "newsletter", "value" => "1")
517
  );
518
-
519
  }
520
-
521
  // Separate users by Batch, 25 users in one
522
  if ($tmp["email"]) {
523
  $batch[$subscriber["store_id"]][$userGroup][floor($i++ / 25)][] = $tmp; //max 25 per batch
@@ -529,7 +506,7 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
529
  if ($batch) {
530
  foreach ($batch as $storeId => $groupBatch) {
531
  $this->init($storeId);
532
-
533
  // send for each group
534
  foreach ($groupBatch as $groupId => $batchStore) {
535
  foreach ($batchStore as $part) {
@@ -546,63 +523,60 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
546
  }
547
  }
548
  }
549
-
550
  $this->_helper->log("FINISH SYNCHRONIZATION WITH :".$syncedUsers);
551
  return $syncedUsers;
552
-
553
  } catch (Exception $e) {
554
  $this->_helper->log("SYNCHRONIZATION Exception: ".$e->getMessage());
555
  }
556
 
557
  $this->_helper->log("FINISH SYNCHRONIZATION");
558
-
559
- return $synced_users;
560
  }
561
-
562
  public function setupDefaultClereReachList()
563
  {
564
-
565
  //Check if we connected to Cr account
566
  if (!$this->isConnected()) {
567
  return false;
568
  }
569
-
570
  $return = false;
571
-
572
  try {
573
  $return = $this->setupGroupFields($this->_helper->getDefaultListId());
574
  $groups = $this->_helper->getGroupsIds();
575
  foreach ($groups as $groupId) {
576
  $return = $this->setupGroupFields($groupId);
577
  }
578
-
579
-
580
  } catch (Exception $e) {
 
581
  return false;
582
-
583
  }
584
  return $return;
585
  }
 
586
  public function setupGroupFields($listId)
587
  {
588
-
589
  $return = false;
590
-
591
- $fields = array("firstname" => "firstname",
592
- "lastname" => "lastname",
593
- "street" => "street",
594
- "zip" => "zip",
595
- "city" => "city",
596
- "country" => "country",
597
- "salutation" => "salutation",
598
- "title" => "title",
599
- "company" => "company",
600
- "newsletter" => "newsletter",
601
- "group_id" => "group_id",
602
- "group_name" => "group_name",
603
- "gender" => "gender",
604
- "store" => "store");
605
-
 
 
606
  $return = $this->_client->groupGetDetails($this->_apiKey, $listId);
607
  if ($return->status == "SUCCESS") {
608
  foreach ($return->data->attributes as $a) {
@@ -615,6 +589,6 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
615
  }
616
  }
617
  return $return;
618
-
619
  }
620
  }
4
  {
5
 
6
  const SUCCESS_STATUS = "SUCCESS";
7
+
8
  const ERROR_CODE_DUPLICATED = 50;
9
  const ERROR_CODE_INVALID = 40;
10
+
11
  public function __construct()
12
  {
 
13
  $this->init();
 
14
  }
15
 
16
  public function init($storeId = false)
17
  {
 
18
  $this->_helper = Mage::helper('crconnect');
19
+
20
  if ($storeId) {
21
  $this->_helper->log($this->_helper->__("SET Helper Store: ". $storeId));
22
  $this->_helper->setCurrentStoreId($storeId);
23
  }
24
+
25
  $this->_apiKey = $this->_helper->getApiKey();
26
  $this->_listID = $this->_helper->getDefaultListId();
27
  $this->_client = $this->getSoapClient();
28
  $this->_groupsListIds = $this->_helper->getGroupsIds();
29
+
30
  }
31
+
32
+ /**
33
  * Get Connection to CrConnect
34
  */
 
35
  public function getSoapClient()
36
  {
 
37
  try {
38
+ // @TODO: make timeout editable through backend
39
+ ini_set("default_socket_timeout", 300);
40
  $client = new SoapClient($this->_helper->getWsdl(), array("trace" => true, "exception" => 0));
41
  return $client;
42
  } catch (Exception $e) {
46
  }
47
  return false;
48
  }
49
+
 
50
  public function subscribe($customer = false, $groupId = 0)
51
  {
 
52
  if ($this->isConnected()) {
53
  if (!$customer) {
54
  $customer = Mage::getSingleton('customer/session')->getCustomer();
59
  $this->_helper->log($this->_helper->__("CALL: receiverAdd - SUCCESS"));
60
  $this->_helper->log($crReceiver);
61
  $this->_helper->log("receiverAdd: GroupId: ".$groupId);
 
62
  return true;
63
  } else {
64
  $this->_helper->log($this->_helper->__("CALL: receiverAdd - FAIL, then call receiverSetActive:".$customer->getEmail()));
67
  $addResult = $this->receiverSetActive($customer->getEmail(), $groupId);
68
  }
69
  return true;
 
70
  }
71
  return false;
72
  }
73
+
74
+ public function update($customer = false)
75
  {
 
76
  if ($this->isConnected()) {
77
  if (!$customer) {
78
  $customer = Mage::getSingleton('customer/session')->getCustomer();
87
  return true;
88
  } else {
89
  $this->_helper->log($this->_helper->__("CALL: receiverUpdate - FAIL"));
90
+
91
  }
92
  return true;
 
93
  }
94
  return false;
 
95
  }
96
+
97
  public function unsubscribe($email = false, $groupId = 0)
98
  {
 
99
  if ($this->isConnected() && $email) {
100
  $result = $this->receiverSetInactive($email, $groupId);
101
  if ($result->status == self::SUCCESS_STATUS) {
102
  $this->_helper->log($this->_helper->__("CALL: receiverSetInactive - SUCCESS, Email:".$email." | GroupId:".$groupId));
103
  return true;
104
  }
 
105
  }
106
  return false;
107
  }
108
 
109
+ /**
110
+ * Check if connection was successfull
111
+ *
112
+ * @return boolean
113
  */
 
114
  public function isConnected()
115
  {
 
116
  if ($this->_client !== false && $this->_client !== null) {
117
  return true;
118
  }
119
  return false;
120
  }
121
 
122
+ /**
123
  * If Account have more then 1 group
124
+ *
125
+ * @return boolean
126
  */
 
127
  public function isMultyGroups()
128
  {
 
129
  if (is_array($this->_groupsListIds) && sizeof($this->_groupsListIds) > 0) {
130
  return true;
131
  }
132
  return false;
133
  }
134
+
135
+ /**
136
+ *
137
+ * @param int $groupId
138
+ * @return mixed
139
+ */
140
  public function getGroupKey($groupId)
141
  {
 
142
  if ($groupId == 0) {
143
+ $groupKey = $this->_helper->getDefaultListId();
144
  } else {
145
+ $groupKey = $this->_helper->getGroupsIds($groupId, true);
146
  }
147
+ return $groupKey;
148
  }
149
 
150
+ /**
151
  * Subscriber simple user to special group
152
  */
153
  public function receiverAdd($customerData, $groupId = 0)
154
  {
 
155
  $listId = $this->getGroupKey($groupId);
156
+
157
  $this->_helper->log("CALL: receiverAdd");
158
  $this->_helper->log($customerData);
159
+
160
  return $this->_client->receiverAdd($this->_apiKey, $listId, $customerData);
 
161
  }
162
+
163
+ /**
164
  * Update simple user
165
  */
166
  public function receiverUpdate($customerData, $groupId = 0)
167
  {
 
168
  $listId = $this->getGroupKey($groupId);
169
+
170
  $this->_helper->log("CALL: receiverAdd");
171
  $this->_helper->log($customerData);
172
+
173
  return $this->_client->receiverAdd($this->_apiKey, $listId, $customerData);
 
174
  }
175
+
176
+ /**
177
+ *
178
  * Deactivates a given receiver/email
179
  */
180
  public function receiverSetInactive($email, $groupId = 0)
181
  {
 
182
  $listId = $this->getGroupKey($groupId);
183
  $this->_helper->log("CALL: receiverSetInactive - Email".$email." | GroupId:". $groupId);
184
  return $this->_client->receiverSetInactive($this->_apiKey, $listId, $email);
185
+
186
  }
187
+
188
+ /**
189
+ *
190
+ * @param type $email
191
+ * @param type $groupId
192
+ * @return type
193
+ */
194
  public function receiverSetActive($email, $groupId = 0)
195
  {
 
196
  $listId = $this->getGroupKey($groupId);
197
  $this->_helper->log("CALL: receiverSetActive - Email".$email." | GroupId:". $groupId);
198
  return $this->_client->receiverSetActive($this->_apiKey, $listId, $email);
 
199
  }
200
 
201
+ /**
 
202
  * Return request result
203
+ *
204
  * @param string result
205
  * @param error message if exists, or false
206
+ *
207
+ * @return array
208
  */
 
209
  private function returnResult($result, $fail = false)
210
  {
 
211
  $return = array();
212
  $return['error'] = $fail;
213
  $return['data'] = $result;
214
  return $return;
215
  }
216
 
217
+ /**
218
  * Get user account details
219
  */
 
220
  public function clientGetDetails()
221
  {
 
222
  $result = $this->_client->clientGetDetails($this->_apiKey);
223
  if ($result->status == self::SUCCESS_STATUS) {
224
  return $this->returnResult($result->data);
225
  } else {
226
  $this->_helper->log($this->_helper->__("CALL: clientGetDetails - failed"));
227
  $this->_helper->log($result->message);
 
228
  return $this->returnResult($result->data, $this->_helper->__("Your CleverReach API key seems to be invalid. Please check them and try again! <br /> Have no CleverReach account? Contact <a href='mailto:info@conlabz.de'>Conlabz GmbH</a> for additional information."));
229
  }
230
  }
231
 
232
+ /**
233
  * Get Group Information
234
  */
 
235
  public function groupGetStats($groupId = false)
236
  {
 
237
  if (!$groupId) {
238
  $groupId = $this->_helper->getDefaultListId();
239
  }
244
  } else {
245
  $this->_helper->log($this->_helper->__("CALL: groupGetStats - failed. List ID: ".$groupId));
246
  $this->_helper->log($this->_helper->__($result->message));
247
+
248
  if ($groupId) {
249
  return $this->returnResult($result->data, $this->_helper->__("Your list ID (%s) seem to be wrong. Please select other group!", $groupId));
250
  }
252
  }
253
  }
254
 
255
+ /**
256
  * Get Group Information
257
  */
 
258
  public function groupGetDetails($listId = false)
259
  {
 
260
  if (!$listId) {
261
  $listId = $this->_helper->getDefaultListId();
262
  }
267
  } else {
268
  $this->_helper->log($this->_helper->__("CALL: groupGetDetails - failed. List ID: ".$listId));
269
  $this->_helper->log($this->_helper->__($result->message));
270
+
271
  if ($listId) {
272
  return $this->returnResult($result->data, $this->_helper->__("Your list ID (%s) seem to be wrong. Please select other group!", $listId));
273
  }
274
  return $this->returnResult($result->data, $this->_helper->__("Please set your CleverReach user group in Extension settings section."));
 
275
  }
276
  }
277
 
278
+ /**
279
  * Add batch of users to CleverReach
280
+ *
281
  * @param array - butch of users
282
  * @param int - Magento Groups ID
283
+ *
284
  * @return int amount of synced users
285
  */
 
286
  public function receiverAddBatch($batch, $groupId = 0)
287
  {
 
288
  if ($groupId == 0) {
289
  $listId = $this->_helper->getDefaultListId();
290
  } else {
291
  $listId = $this->_helper->getGroupsIds($groupId);
292
  }
293
+
294
  $this->_helper->log("CrConnect: receiverAddBatch.");
295
  $this->_helper->log($batch);
296
+
297
  $result = $this->_client->receiverAddBatch($this->_apiKey, $listId, $batch);
298
  if ($result->status == self::SUCCESS_STATUS) {
299
  $this->_helper->log("CrConnect: receiverAddBatch - SUCCESS.");
300
  $this->_helper->log("CrConnect: receiverAddBatch - key:".$this->_apiKey." | listId:".$listId);
301
+
302
  return count($batch);
303
  } else {
304
  $this->_helper->log("CrConnect: receiverAddBatch - FAIL.");
309
  }
310
  }
311
 
312
+ /**
313
+ *
314
+ * @param string $email
315
+ * @param string $orderInfo
316
+ * @return boolean
317
+ */
318
  public function receiverAddOrder($email, $orderInfo)
319
  {
 
320
  $listId = $this->_helper->getDefaultListId();
321
  $result = $this->_client->receiverAddOrder($this->_apiKey, $listId, $email, $orderInfo);
322
  Mage::helper("crconnect")->log("CALL receiverAddOrder: ".$email);
327
  } else {
328
  return false;
329
  }
 
330
  }
331
+
332
+ /**
333
  * Get and check if user subscribed to group
334
  *
335
+ * @param string user email
336
+ * @param int group Id
337
  *
338
+ * @return bool
339
  */
 
340
  public function isSubscribed($email, $groupId = 0)
341
  {
342
 
355
  }
356
  return false;
357
  }
358
+
359
+ /**
360
  * get groups for API key
361
+ *
362
+ * @return mixed
363
  */
364
  public function getGroupsForKey($apiKey)
365
  {
 
366
  $result = $this->_client->groupGetList($apiKey);
367
  if ($result->status == self::SUCCESS_STATUS) {
368
  return $result->data;
369
  } else {
370
  return false;
371
  }
 
372
  }
373
+
374
+ /**
375
  * get groups for API key
376
  */
377
  public function getFormsForGroup($apiKey, $groupId)
378
  {
 
379
  $result = $this->_client->formsGetList($apiKey, $groupId);
380
  if ($result->status == self::SUCCESS_STATUS) {
381
  return $result->data;
382
  } else {
383
  return false;
384
  }
 
385
  }
386
+
387
+ /**
388
+ *
389
+ * @param type $customer
390
+ * @param type $groupId
391
+ * @return boolean
392
+ */
393
  public function formsSendActivationMail($customer, $groupId = 0)
394
  {
 
395
  if ($this->isConnected()) {
396
  // if not customer transfered, get current one from session
397
  if (!$customer) {
401
 
402
  // Subscriber customer first
403
  $addResult = $this->receiverAdd($crReceiver, $groupId);
404
+ /* @var $httpHelper Mage_Core_Helper_Http */
405
+ $httpHelper = Mage::helper('core/http');
406
+
407
  $doidata = array(
408
+ "user_ip" => $httpHelper->getRemoteAddr(),
409
+ "user_agent" => $httpHelper->getHttpUserAgent(),
410
  "referer" => Mage::getUrl("/"),
411
  "postdata" => "",
412
  "info" => "",
413
  );
414
+
415
  if ($addResult->status == self::SUCCESS_STATUS) {
416
  // Send activation email for customer
417
  $formId = $this->_helper->getFormsIds($groupId, true);
435
  } else {
436
  $this->_helper->log("during formsSendActivationMail :: formsSendActivationMail :: ERROR");
437
  $this->_helper->log($result->message);
438
+
439
  if ($result->statuscode == self::ERROR_CODE_INVALID) {
440
  Mage::getSingleton("core/session")->addError($this->_helper->__("This Email blocked or wrong"));
441
  }
442
  }
 
443
  } else {
444
  Mage::getSingleton("core/session")->addError($this->_helper->__("This Email already in our database"));
445
+
446
  }
 
447
  }
 
448
  }
449
  return false;
 
450
  }
 
451
  }
 
452
 
453
+ /**
454
  * Sync data between Magento and Cleverreach
455
  */
 
456
  public function synchronize()
457
  {
 
458
  //Check if we connected to Cr account
459
  if (!$this->isConnected()) {
460
  return false;
461
  }
462
 
463
  $this->_helper->log("RUN SYNCHRONIZATION");
 
 
 
464
 
465
+ $subscribers = $this->_helper->getActiveMageSubscribers();
466
  $syncedUsers = 0;
467
  $batch = array();
468
  $i = 0;
469
 
470
  foreach ($subscribers as $subscriber) {
471
  $userGroup = 0;
 
472
  // If we should separate customers to different groups, then get customer Groups iD if exists
473
  if ($this->_helper->isSeparationEnabled()) {
474
  if ($subscriber["subscriber_email"]) {
479
  }
480
  }
481
  }
482
+
 
483
  if (isset($subscriber['customer_id']) && $subscriber['customer_id']) {
484
  $tmp = $this->_helper->prepareUserdata(Mage::getModel("customer/customer")->load($subscriber['customer_id']));
485
  } else {
486
  $tmp["email"] = $subscriber["subscriber_email"];
487
  $tmp["source"] = "MAGENTO";
 
488
  // Prepare customer attributes
489
+ $firstname = isset($subscriber['customer_firstname']) ? $subscriber['customer_firstname'] : null;
490
+ $lastname = isset($subscriber['customer_lastname']) ? $subscriber['customer_lastname'] : null;
491
  $tmp["attributes"] = array(
492
+ array("key" => "firstname", "value" => $firstname),
493
+ array("key" => "lastname", "value" => $lastname),
494
+ array("key" => "newsletter", "value" => 1)
495
  );
 
496
  }
497
+
498
  // Separate users by Batch, 25 users in one
499
  if ($tmp["email"]) {
500
  $batch[$subscriber["store_id"]][$userGroup][floor($i++ / 25)][] = $tmp; //max 25 per batch
506
  if ($batch) {
507
  foreach ($batch as $storeId => $groupBatch) {
508
  $this->init($storeId);
509
+
510
  // send for each group
511
  foreach ($groupBatch as $groupId => $batchStore) {
512
  foreach ($batchStore as $part) {
523
  }
524
  }
525
  }
 
526
  $this->_helper->log("FINISH SYNCHRONIZATION WITH :".$syncedUsers);
527
  return $syncedUsers;
 
528
  } catch (Exception $e) {
529
  $this->_helper->log("SYNCHRONIZATION Exception: ".$e->getMessage());
530
  }
531
 
532
  $this->_helper->log("FINISH SYNCHRONIZATION");
533
+
534
+ return $syncedUsers;
535
  }
536
+
537
  public function setupDefaultClereReachList()
538
  {
 
539
  //Check if we connected to Cr account
540
  if (!$this->isConnected()) {
541
  return false;
542
  }
543
+
544
  $return = false;
545
+
546
  try {
547
  $return = $this->setupGroupFields($this->_helper->getDefaultListId());
548
  $groups = $this->_helper->getGroupsIds();
549
  foreach ($groups as $groupId) {
550
  $return = $this->setupGroupFields($groupId);
551
  }
 
 
552
  } catch (Exception $e) {
553
+ Mage::logException($e);
554
  return false;
 
555
  }
556
  return $return;
557
  }
558
+
559
  public function setupGroupFields($listId)
560
  {
 
561
  $return = false;
562
+
563
+ $fields = array(
564
+ "firstname" => "firstname",
565
+ "lastname" => "lastname",
566
+ "street" => "street",
567
+ "zip" => "zip",
568
+ "city" => "city",
569
+ "country" => "country",
570
+ "salutation" => "salutation",
571
+ "title" => "title",
572
+ "company" => "company",
573
+ "newsletter" => "newsletter",
574
+ "group_id" => "group_id",
575
+ "group_name" => "group_name",
576
+ "gender" => "gender",
577
+ "store" => "store"
578
+ );
579
+
580
  $return = $this->_client->groupGetDetails($this->_apiKey, $listId);
581
  if ($return->status == "SUCCESS") {
582
  foreach ($return->data->attributes as $a) {
589
  }
590
  }
591
  return $return;
592
+
593
  }
594
  }
app/code/community/Conlabz/CrConnect/Model/Checkout/Observer.php CHANGED
@@ -19,17 +19,15 @@
19
  */
20
  class Conlabz_CrConnect_Model_Checkout_Observer
21
  {
22
- public function success_action($observer)
23
  {
24
- $event = $observer->getEvent();
25
-
26
  $email = false;
27
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
28
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
29
-
30
  $syncOrders = trim(Mage::getStoreConfig('crroot/crconnect/sync_orders'));
31
  $syncOrderStatus = trim(Mage::getStoreConfig('crroot/crconnect/sync_order_status'));
32
-
33
  if ($syncOrders) {
34
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
35
  } else {
@@ -39,21 +37,21 @@ class Conlabz_CrConnect_Model_Checkout_Observer
39
  if ($lastOrderId) {
40
  $order = Mage::getModel('sales/order')->load($lastOrderId);
41
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
42
-
43
  $subscribed = $customer->getIsSubscribed();
44
-
45
  if ($subscribed === null) {
46
  $subscribed = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed();
47
  }
48
-
49
  if ($subscribed) {
50
  $add = array("newsletter" => "1");
51
  } else {
52
  $add = array("newsletter" => "0");
53
  }
54
-
55
  $email = $order->getCustomerEmail();
56
-
57
  if ($email) {
58
  if ($customer->getEmail()) {
59
  $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, $add, false);
@@ -75,21 +73,21 @@ class Conlabz_CrConnect_Model_Checkout_Observer
75
  7 => array("key" => "title", "value" => @$shippingAddress["suffix"]),
76
  8 => array("key" => "company", "value" => @$shippingAddress["company"]))
77
  );
78
-
79
  $cookie = Mage::getSingleton('core/cookie');
80
  if ($cookie->get('crmailing')) {
81
  $crReceiver['orders'][0]['mailings_id'] = $cookie->get('crmailing');
82
  }
83
-
84
  if ($subscribed) {
85
  $crReceiver["attributes"][] = array("key" => 'newsletter', "value" => "1");
86
  }
87
  }
88
  }
89
  }
90
-
91
  }
92
-
93
  if ($apiKey && $listID && $email && $lastOrderId && $syncOrders) {
94
  try {
95
  $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
@@ -107,7 +105,7 @@ class Conlabz_CrConnect_Model_Checkout_Observer
107
  $tmp["deactivated"] = 0;
108
  $addTxt = "forced active";
109
  }
110
-
111
  // Get keys for different user groups
112
  if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1') {
113
  $groupKeys = Mage::helper('crconnect')->getKeys();
@@ -119,7 +117,7 @@ class Conlabz_CrConnect_Model_Checkout_Observer
119
  } else {
120
  $return = $client->receiverAdd($apiKey, $listID, $tmp);
121
  }
122
-
123
  if ($return->status=="SUCCESS") {
124
  Mage::log("CleverReach_CrConnect: subscribed ($addTxt) - ".$crReceiver["email"]);
125
  } else {
@@ -138,9 +136,9 @@ class Conlabz_CrConnect_Model_Checkout_Observer
138
  Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
139
  }
140
  }
141
-
142
  /* ########################### */
143
-
144
  $items = $order->getAllItems();
145
  if ($items) {
146
  foreach ($items as $item) {
@@ -153,12 +151,12 @@ class Conlabz_CrConnect_Model_Checkout_Observer
153
  $tmpItem["purchase_date"] = time();
154
  $tmpItem["currency"] = $order->getData('order_currency_code');
155
  $tmpItem["source"] = "MAGENTO Order";
156
-
157
  $cookie = Mage::getSingleton('core/cookie');
158
  if ($cookie->get('crmailing')) {
159
  $tmpItem['mailings_id'] = $cookie->get('crmailing');
160
  }
161
-
162
  $tmp = $client->receiverAddOrder($apiKey, $listID, $email, $tmpItem);
163
  if ($tmp->status!="SUCCESS") {
164
  Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
19
  */
20
  class Conlabz_CrConnect_Model_Checkout_Observer
21
  {
22
+ public function success_action()
23
  {
 
 
24
  $email = false;
25
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
26
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
27
+
28
  $syncOrders = trim(Mage::getStoreConfig('crroot/crconnect/sync_orders'));
29
  $syncOrderStatus = trim(Mage::getStoreConfig('crroot/crconnect/sync_order_status'));
30
+
31
  if ($syncOrders) {
32
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
33
  } else {
37
  if ($lastOrderId) {
38
  $order = Mage::getModel('sales/order')->load($lastOrderId);
39
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
40
+
41
  $subscribed = $customer->getIsSubscribed();
42
+
43
  if ($subscribed === null) {
44
  $subscribed = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed();
45
  }
46
+
47
  if ($subscribed) {
48
  $add = array("newsletter" => "1");
49
  } else {
50
  $add = array("newsletter" => "0");
51
  }
52
+
53
  $email = $order->getCustomerEmail();
54
+
55
  if ($email) {
56
  if ($customer->getEmail()) {
57
  $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, $add, false);
73
  7 => array("key" => "title", "value" => @$shippingAddress["suffix"]),
74
  8 => array("key" => "company", "value" => @$shippingAddress["company"]))
75
  );
76
+
77
  $cookie = Mage::getSingleton('core/cookie');
78
  if ($cookie->get('crmailing')) {
79
  $crReceiver['orders'][0]['mailings_id'] = $cookie->get('crmailing');
80
  }
81
+
82
  if ($subscribed) {
83
  $crReceiver["attributes"][] = array("key" => 'newsletter', "value" => "1");
84
  }
85
  }
86
  }
87
  }
88
+
89
  }
90
+
91
  if ($apiKey && $listID && $email && $lastOrderId && $syncOrders) {
92
  try {
93
  $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
105
  $tmp["deactivated"] = 0;
106
  $addTxt = "forced active";
107
  }
108
+
109
  // Get keys for different user groups
110
  if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1') {
111
  $groupKeys = Mage::helper('crconnect')->getKeys();
117
  } else {
118
  $return = $client->receiverAdd($apiKey, $listID, $tmp);
119
  }
120
+
121
  if ($return->status=="SUCCESS") {
122
  Mage::log("CleverReach_CrConnect: subscribed ($addTxt) - ".$crReceiver["email"]);
123
  } else {
136
  Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
137
  }
138
  }
139
+
140
  /* ########################### */
141
+
142
  $items = $order->getAllItems();
143
  if ($items) {
144
  foreach ($items as $item) {
151
  $tmpItem["purchase_date"] = time();
152
  $tmpItem["currency"] = $order->getData('order_currency_code');
153
  $tmpItem["source"] = "MAGENTO Order";
154
+
155
  $cookie = Mage::getSingleton('core/cookie');
156
  if ($cookie->get('crmailing')) {
157
  $tmpItem['mailings_id'] = $cookie->get('crmailing');
158
  }
159
+
160
  $tmp = $client->receiverAddOrder($apiKey, $listID, $email, $tmpItem);
161
  if ($tmp->status!="SUCCESS") {
162
  Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
app/code/community/Conlabz/CrConnect/Model/Observer.php CHANGED
@@ -1,38 +1,33 @@
1
  <?php
2
  class Conlabz_CrConnect_Model_Observer
3
  {
4
-
5
  // 14 days
6
  const SESSION_LIFE = 1209600;
7
-
8
- private $_allowedControllers = array("account");
9
- private $_allowedActions = array("createpost");
10
-
11
  public function customerSaveAfter($observer)
12
  {
13
-
14
  if (!Mage::registry('cr_aftersave_called')) {
15
  Mage::register('cr_aftersave_called', true);
16
  } else {
17
  return true;
18
  }
19
-
20
  $controller = Mage::app()->getRequest()->getControllerName();
21
  $action = Mage::app()->getRequest()->getActionName();
22
-
23
  $customer = $observer->getCustomer();
24
-
25
  $email = $customer->getEmail();
26
-
27
  $subscriber = Mage::getModel("newsletter/subscriber")->loadByEmail($email);
28
  $subscriber->setEmail($email);
29
  if (Mage::app()->getStore()->isAdmin()) {
30
  return true;
31
  }
32
-
33
  $subscriptionCheckbox1 = Mage::app()->getRequest()->getParam('subscription');
34
  $subscriptionCheckbox2 = Mage::app()->getRequest()->getParam('is_subscribed');
35
-
36
  if ($subscriptionCheckbox1 !== null || $subscriptionCheckbox2 !== null) {
37
  if (!$subscriber->isSubscribed()) {
38
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email);
@@ -43,19 +38,11 @@ class Conlabz_CrConnect_Model_Observer
43
  }
44
  }
45
 
46
- } else {
47
- if (in_array($controller, $this->_allowedControllers) && in_array($action, $this->_allowedActions)) {
48
- if ($subscriber->isSubscribed()) {
49
- $status = Mage::getModel("crconnect/subscriber")->unsubscribe($email);
50
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper("core")->__('The subscription has been removed.'));
51
- }
52
- }
53
-
54
  }
55
-
56
  $gsubscription = Mage::app()->getRequest()->getParam('gsubscription');
57
  $groupId = $customer->getGroupId();
58
-
59
  if ($gsubscription !== null) {
60
  if (!$subscriber->isSubscribed($groupId)) {
61
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email, $groupId);
@@ -65,52 +52,45 @@ class Conlabz_CrConnect_Model_Observer
65
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper("core")->__('Thank you for your subscription.'));
66
  }
67
  }
68
- } else {
69
- if (in_array($controller, $this->_allowedControllers) && in_array($action, $this->_allowedActions)) {
70
- if ($subscriber->isSubscribed($groupId)) {
71
- $status = Mage::getModel("crconnect/subscriber")->unsubscribe($email, $groupId);
72
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper("core")->__('The subscription has been removed.'));
73
- }
74
- }
75
- }
76
  return true;
77
  }
78
-
79
- public function trackingCodesSet($observer)
80
- {
81
  $mailingId = Mage::getSingleton('core/app')->getRequest()->getParam('crmailing');
82
-
83
  $cookie = Mage::getSingleton('core/cookie');
84
  if ($mailingId) {
85
  $cookie->set('crmailing', $mailingId, time()+self::SESSION_LIFE, '/');
86
  }
87
-
88
  $customerId = Mage::getSingleton('core/app')->getRequest()->getParam('crcustomer');
89
  $cookie = Mage::getSingleton('core/cookie');
90
  if ($customerId) {
91
  $cookie->set('crcustomer', $customerId, time()+self::SESSION_LIFE, '/');
92
- }
93
  }
94
 
95
- public function checkoutSuccess($observer)
96
  {
97
-
98
  if (!Mage::registry('order_track_start')) {
99
  Mage::register('order_track_start', true);
100
  } else {
101
  return true;
102
  }
103
-
104
  if (Mage::helper("crconnect")->isTrackingEnabled()) {
105
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
106
  } else {
107
  Mage::helper("crconnect")->log("CleverReach_CrConnect: order sycing deactivated");
108
  return false;
109
  }
110
-
111
  $order = Mage::getModel('sales/order')->load($lastOrderId);
112
  $email = $order->getCustomerEmail();
113
-
114
  if (Mage::helper("crconnect")->isTrackingEnabled()) {
115
  $items = $order->getAllItems();
116
  if ($items) {
@@ -129,13 +109,10 @@ class Conlabz_CrConnect_Model_Observer
129
  if ($cookie->get('crmailing')) {
130
  $tmpItem['mailings_id'] = $cookie->get('crmailing');
131
  }
132
-
133
  Mage::getModel("crconnect/api")->receiverAddOrder($email, $tmpItem);
134
-
135
  }
136
  }
137
-
138
- }
139
  }
140
 
141
  public function orderPlacedAfter($observer)
@@ -148,9 +125,9 @@ class Conlabz_CrConnect_Model_Observer
148
  if (in_array($shippingMethod, Mage::helper("crconnect")->getM2eShippingMethods())) {
149
  Mage::helper("crconnect")->log("Its M2E order -> Skip");
150
  return true;
151
- }
152
  }
153
-
154
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
155
  $email = $order->getCustomerEmail();
156
 
@@ -164,22 +141,23 @@ class Conlabz_CrConnect_Model_Observer
164
  Mage::helper("crconnect")->log($result);
165
  } else {
166
  Mage::helper("crconnect")->log("Force sync orders for guest customer");
167
- $billingAddress = $order->getBillingAddress()->getData();
168
  if ($billingAddress) {
169
  Mage::helper("crconnect")->log("Prepare info based on billing address");
170
  $crReceiver = array (
171
  'email' => $email,
172
  'source' => 'MAGENTO',
173
  'attributes' => array(
174
- 0 => array("key" => "firstname", "value" => $billingAddress["firstname"]),
175
- 1 => array("key" => "lastname", "value" => @$billingAddress["lastname"]),
176
- 2 => array("key" => "street", "value" => @$billingAddress["street"]),
177
- 3 => array("key" => "zip", "value" => @$billingAddress["postcode"]),
178
- 4 => array("key" => "city", "value" => @$billingAddress["city"]),
179
- 5 => array("key" => "country", "value" => @$billingAddress["country_id"]),
180
- 6 => array("key" => "salutation", "value" => @$billingAddress["prefix"]),
181
- 7 => array("key" => "title", "value" => @$billingAddress["suffix"]),
182
- 8 => array("key" => "company", "value" => @$billingAddress["company"]))
 
183
  );
184
 
185
  $cookie = Mage::getSingleton('core/cookie');
@@ -192,67 +170,63 @@ class Conlabz_CrConnect_Model_Observer
192
  Mage::helper("crconnect")->log($result);
193
  }
194
  }
195
- }
196
  } catch (Exception $ex) {
197
  Mage::helper("crconnect")->log("order_save_after Exception");
198
- Mage::helper("crconnect")->log($ex);
199
  }
200
-
201
  return true;
202
-
203
  }
204
-
205
  public function customerDeleted($observer)
206
  {
207
-
208
  $event = $observer->getEvent();
209
  $customer = $event->getCustomer();
210
  $email = $customer->getEmail();
211
  $groupId = $customer->getGroupId();
212
-
213
  Mage::getModel("crconnect/subscriber")->unsubscribe($email);
214
  Mage::getModel("crconnect/subscriber")->unsubscribe($email, $groupId);
215
-
216
  }
217
 
218
  public function configSave()
219
- {
220
- if (Mage::app()->getRequest()->getParam('section') == "newsletter" || Mage::app()->getRequest()->getParam('section') == "crroot") {
221
- if (Mage::helper("crconnect")->isDoubleOptInEnabled()) {
222
- $groupsIds = Mage::helper("crconnect")->getGroupsIds();
223
- $formsIds = Mage::helper("crconnect")->getFormsIds();
224
- $allow = true;
225
- foreach ($groupsIds as $groupsId) {
226
- if (!$groupsId) {
227
- $allow = false;
228
- }
229
- }
230
- foreach ($formsIds as $formsId) {
231
- if (!$formsId) {
232
- $allow = false;
233
- }
234
- }
235
- $formId = Mage::helper("crconnect")->getDefaultFormId();
236
- if (!$formId) {
237
  $allow = false;
238
- }
239
- if (!$allow) {
240
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Double Opt-In enabled, please select Form(s) and Group(s) for your Customer Groups'));
241
  }
242
- }
243
- }
 
 
 
 
 
 
 
244
  }
245
 
246
  public function initCleverReach()
247
  {
248
  $session = Mage::getSingleton('adminhtml/session');
249
-
250
  $setupResult = Mage::getModel('crconnect/api')->setupDefaultClereReachList();
251
  if (!$setupResult) {
252
- $session->addError("Could not connect to CleverReach. Please chech your API keys.");
253
  } elseif ($setupResult->status == "ERROR" && $setupResult->statuscode != 50) {
254
- var_dump($setupResult);
255
  $session->addError("Cleverreach connection Error: " . $setupResult->message);
256
- }
257
  }
258
  }
1
  <?php
2
  class Conlabz_CrConnect_Model_Observer
3
  {
 
4
  // 14 days
5
  const SESSION_LIFE = 1209600;
6
+
 
 
 
7
  public function customerSaveAfter($observer)
8
  {
 
9
  if (!Mage::registry('cr_aftersave_called')) {
10
  Mage::register('cr_aftersave_called', true);
11
  } else {
12
  return true;
13
  }
14
+
15
  $controller = Mage::app()->getRequest()->getControllerName();
16
  $action = Mage::app()->getRequest()->getActionName();
17
+
18
  $customer = $observer->getCustomer();
19
+
20
  $email = $customer->getEmail();
21
+
22
  $subscriber = Mage::getModel("newsletter/subscriber")->loadByEmail($email);
23
  $subscriber->setEmail($email);
24
  if (Mage::app()->getStore()->isAdmin()) {
25
  return true;
26
  }
27
+
28
  $subscriptionCheckbox1 = Mage::app()->getRequest()->getParam('subscription');
29
  $subscriptionCheckbox2 = Mage::app()->getRequest()->getParam('is_subscribed');
30
+
31
  if ($subscriptionCheckbox1 !== null || $subscriptionCheckbox2 !== null) {
32
  if (!$subscriber->isSubscribed()) {
33
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email);
38
  }
39
  }
40
 
 
 
 
 
 
 
 
 
41
  }
42
+
43
  $gsubscription = Mage::app()->getRequest()->getParam('gsubscription');
44
  $groupId = $customer->getGroupId();
45
+
46
  if ($gsubscription !== null) {
47
  if (!$subscriber->isSubscribed($groupId)) {
48
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email, $groupId);
52
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper("core")->__('Thank you for your subscription.'));
53
  }
54
  }
55
+ }
56
+
 
 
 
 
 
 
57
  return true;
58
  }
59
+
60
+ public function trackingCodesSet()
61
+ {
62
  $mailingId = Mage::getSingleton('core/app')->getRequest()->getParam('crmailing');
63
+
64
  $cookie = Mage::getSingleton('core/cookie');
65
  if ($mailingId) {
66
  $cookie->set('crmailing', $mailingId, time()+self::SESSION_LIFE, '/');
67
  }
68
+
69
  $customerId = Mage::getSingleton('core/app')->getRequest()->getParam('crcustomer');
70
  $cookie = Mage::getSingleton('core/cookie');
71
  if ($customerId) {
72
  $cookie->set('crcustomer', $customerId, time()+self::SESSION_LIFE, '/');
73
+ }
74
  }
75
 
76
+ public function checkoutSuccess()
77
  {
 
78
  if (!Mage::registry('order_track_start')) {
79
  Mage::register('order_track_start', true);
80
  } else {
81
  return true;
82
  }
83
+
84
  if (Mage::helper("crconnect")->isTrackingEnabled()) {
85
  $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
86
  } else {
87
  Mage::helper("crconnect")->log("CleverReach_CrConnect: order sycing deactivated");
88
  return false;
89
  }
90
+
91
  $order = Mage::getModel('sales/order')->load($lastOrderId);
92
  $email = $order->getCustomerEmail();
93
+
94
  if (Mage::helper("crconnect")->isTrackingEnabled()) {
95
  $items = $order->getAllItems();
96
  if ($items) {
109
  if ($cookie->get('crmailing')) {
110
  $tmpItem['mailings_id'] = $cookie->get('crmailing');
111
  }
 
112
  Mage::getModel("crconnect/api")->receiverAddOrder($email, $tmpItem);
 
113
  }
114
  }
115
+ }
 
116
  }
117
 
118
  public function orderPlacedAfter($observer)
125
  if (in_array($shippingMethod, Mage::helper("crconnect")->getM2eShippingMethods())) {
126
  Mage::helper("crconnect")->log("Its M2E order -> Skip");
127
  return true;
128
+ }
129
  }
130
+
131
  $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
132
  $email = $order->getCustomerEmail();
133
 
141
  Mage::helper("crconnect")->log($result);
142
  } else {
143
  Mage::helper("crconnect")->log("Force sync orders for guest customer");
144
+ $billingAddress = $order->getBillingAddress();
145
  if ($billingAddress) {
146
  Mage::helper("crconnect")->log("Prepare info based on billing address");
147
  $crReceiver = array (
148
  'email' => $email,
149
  'source' => 'MAGENTO',
150
  'attributes' => array(
151
+ array("key" => "firstname", "value" => $billingAddress->getFirstname()),
152
+ array("key" => "lastname", "value" => $billingAddress->getLastname()),
153
+ array("key" => "street", "value" => $billingAddress->getStreet()),
154
+ array("key" => "zip", "value" => $billingAddress->getPostcode()),
155
+ array("key" => "city", "value" => $billingAddress->getCity()),
156
+ array("key" => "country", "value" => $billingAddress->getCountryId()),
157
+ array("key" => "salutation", "value" => $billingAddress->getPrefix()),
158
+ array("key" => "title", "value" => $billingAddress->getSuffix()),
159
+ array("key" => "company", "value" => $billingAddress->getCompany())
160
+ )
161
  );
162
 
163
  $cookie = Mage::getSingleton('core/cookie');
170
  Mage::helper("crconnect")->log($result);
171
  }
172
  }
173
+ }
174
  } catch (Exception $ex) {
175
  Mage::helper("crconnect")->log("order_save_after Exception");
176
+ Mage::helper("crconnect")->log($ex->getMessage());
177
  }
 
178
  return true;
 
179
  }
180
+
181
  public function customerDeleted($observer)
182
  {
 
183
  $event = $observer->getEvent();
184
  $customer = $event->getCustomer();
185
  $email = $customer->getEmail();
186
  $groupId = $customer->getGroupId();
187
+
188
  Mage::getModel("crconnect/subscriber")->unsubscribe($email);
189
  Mage::getModel("crconnect/subscriber")->unsubscribe($email, $groupId);
 
190
  }
191
 
192
  public function configSave()
193
+ {
194
+ $currentSection = Mage::app()->getRequest()->getParam('section');
195
+ if (in_array($currentSection, array('newsletter', 'crroot')) &&
196
+ Mage::helper("crconnect")->isDoubleOptInEnabled()
197
+ ) {
198
+ $groupsIds = Mage::helper("crconnect")->getGroupsIds();
199
+ $formsIds = Mage::helper("crconnect")->getFormsIds();
200
+ $allow = true;
201
+ foreach ($groupsIds as $groupsId) {
202
+ if (!$groupsId) {
203
+ $allow = false;
204
+ }
205
+ }
206
+ foreach ($formsIds as $formsId) {
207
+ if (!$formsId) {
 
 
 
208
  $allow = false;
 
 
 
209
  }
210
+ }
211
+ $formId = Mage::helper("crconnect")->getDefaultFormId();
212
+ if (!$formId) {
213
+ $allow = false;
214
+ }
215
+ if (!$allow) {
216
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Double Opt-In enabled, please select Form(s) and Group(s) for your Customer Groups'));
217
+ }
218
+ }
219
  }
220
 
221
  public function initCleverReach()
222
  {
223
  $session = Mage::getSingleton('adminhtml/session');
224
+
225
  $setupResult = Mage::getModel('crconnect/api')->setupDefaultClereReachList();
226
  if (!$setupResult) {
227
+ $session->addError("Could not connect to CleverReach. Please check your API keys.");
228
  } elseif ($setupResult->status == "ERROR" && $setupResult->statuscode != 50) {
 
229
  $session->addError("Cleverreach connection Error: " . $setupResult->message);
230
+ }
231
  }
232
  }
app/code/community/Conlabz/CrConnect/Model/Search.php CHANGED
@@ -2,13 +2,11 @@
2
 
3
  class Conlabz_CrConnect_Model_Search
4
  {
5
- /*
6
  * Get Search Filters values
7
  */
8
-
9
  public function getFilter()
10
  {
11
-
12
  $filter = array();
13
 
14
  // Generate Categories Filter
@@ -41,41 +39,36 @@ class Conlabz_CrConnect_Model_Search
41
  return $filter;
42
  }
43
 
44
- /*
45
- * Get categories tree recurcively function
46
  *
47
  * @return array of categories of one level
48
  */
49
-
50
  public function getCategories($categories)
51
  {
52
-
53
  foreach ($categories as $category) {
54
- $cat = Mage::getModel('catalog/category')->load($category->getId());
55
  $prefix = "";
56
  for ($i = 0; $i < $category->getLevel() - 2; $i++) {
57
  $prefix .= "&nbsp;";
58
  }
59
  $array[] = array("text" => $prefix . $category->getName(), "value" => $category->getId()); //In this line we get an a link for the product and product count of that category
60
  if ($category->hasChildren()) {
61
- $children = Mage::getModel('catalog/category')->getCategories($category->getId()); // $children get a list of all subcategories
62
  $array = array_merge($array, $this->getCategories($children)); //recursive call the get_categories function again.
63
  }
64
  }
65
  return $array;
66
  }
67
 
68
- /*
69
  * Get Search result
70
  *
71
  * @param int category - category ID
72
- * @param string product - part of name or description
73
- *
74
  */
75
-
76
  public function getSearch($category = false, $product = "", $store = false)
77
  {
78
-
79
  $products = Mage::getModel('catalog/product')->getCollection()
80
  ->addAttributeToSelect("name")
81
  ->addAttributeToSelect("description")
2
 
3
  class Conlabz_CrConnect_Model_Search
4
  {
5
+ /**
6
  * Get Search Filters values
7
  */
 
8
  public function getFilter()
9
  {
 
10
  $filter = array();
11
 
12
  // Generate Categories Filter
39
  return $filter;
40
  }
41
 
42
+ /**
43
+ * Get categories tree recurcively function
44
  *
45
  * @return array of categories of one level
46
  */
 
47
  public function getCategories($categories)
48
  {
49
+ $array = array();
50
  foreach ($categories as $category) {
 
51
  $prefix = "";
52
  for ($i = 0; $i < $category->getLevel() - 2; $i++) {
53
  $prefix .= "&nbsp;";
54
  }
55
  $array[] = array("text" => $prefix . $category->getName(), "value" => $category->getId()); //In this line we get an a link for the product and product count of that category
56
  if ($category->hasChildren()) {
57
+ $children = $category->getChildrenCategories(); // $children get a list of all subcategories
58
  $array = array_merge($array, $this->getCategories($children)); //recursive call the get_categories function again.
59
  }
60
  }
61
  return $array;
62
  }
63
 
64
+ /**
65
  * Get Search result
66
  *
67
  * @param int category - category ID
68
+ * @param array
 
69
  */
 
70
  public function getSearch($category = false, $product = "", $store = false)
71
  {
 
72
  $products = Mage::getModel('catalog/product')->getCollection()
73
  ->addAttributeToSelect("name")
74
  ->addAttributeToSelect("description")
app/code/community/Conlabz/CrConnect/Model/Subscriber.php CHANGED
@@ -2,41 +2,32 @@
2
 
3
  class Conlabz_CrConnect_Model_Subscriber extends Mage_Core_Model_Abstract
4
  {
5
-
6
- /*
7
  * Subscribe cusotmer
8
  */
9
  public function subscribe($customer = false, $groupId = 0)
10
  {
11
-
12
  return Mage::getModel("crconnect/api")->subscribe($customer, $groupId);
13
-
14
  }
15
-
16
- /*
17
  * Send activation email for customer
18
  */
19
  public function formsSendActivationMail($customer = false, $groupId = 0)
20
  {
21
-
22
  return Mage::getModel("crconnect/api")->formsSendActivationMail($customer, $groupId);
23
-
24
  }
25
-
26
- /*
27
  * Subscribe cusotmer
28
  */
29
  public function unsubscribe($email = false, $groupId = 0)
30
  {
31
-
32
  return Mage::getModel("crconnect/api")->unsubscribe($email, $groupId);
33
-
34
  }
35
-
36
  public function updateCustomer($customer, $groupId = 0)
37
  {
38
-
39
  return Mage::getModel("crconnect/api")->update($customer, $groupId);
40
-
41
  }
42
  }
2
 
3
  class Conlabz_CrConnect_Model_Subscriber extends Mage_Core_Model_Abstract
4
  {
5
+ /**
 
6
  * Subscribe cusotmer
7
  */
8
  public function subscribe($customer = false, $groupId = 0)
9
  {
 
10
  return Mage::getModel("crconnect/api")->subscribe($customer, $groupId);
 
11
  }
12
+
13
+ /**
14
  * Send activation email for customer
15
  */
16
  public function formsSendActivationMail($customer = false, $groupId = 0)
17
  {
 
18
  return Mage::getModel("crconnect/api")->formsSendActivationMail($customer, $groupId);
 
19
  }
20
+
21
+ /**
22
  * Subscribe cusotmer
23
  */
24
  public function unsubscribe($email = false, $groupId = 0)
25
  {
 
26
  return Mage::getModel("crconnect/api")->unsubscribe($email, $groupId);
 
27
  }
28
+
29
  public function updateCustomer($customer, $groupId = 0)
30
  {
 
31
  return Mage::getModel("crconnect/api")->update($customer, $groupId);
 
32
  }
33
  }
app/code/community/Conlabz/CrConnect/Test/Config/ActivationXml.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Conlabz_CrConnect_Test_Config_ActivationXml extends EcomDev_PHPUnit_Test_Case_Config
4
+ {
5
+ /**
6
+ * @test
7
+ */
8
+ public function codePool()
9
+ {
10
+ $this->assertModuleCodePool('community');
11
+ }
12
+ }
app/code/community/Conlabz/CrConnect/controllers/AccountController.php DELETED
@@ -1,144 +0,0 @@
1
- <?php
2
- include "Mage/Customer/controllers/AccountController.php";
3
-
4
- class Conlabz_CrConnect_AccountController extends Mage_Customer_AccountController
5
- {
6
-
7
- /**
8
- * Create customer account action
9
- */
10
- public function createPostAction()
11
- {
12
- $session = $this->_getSession();
13
- if ($session->isLoggedIn()) {
14
- $this->_redirect('*/*/');
15
- return;
16
- }
17
- $session->setEscapeMessages(true); // prevent XSS injection in user input
18
- if ($this->getRequest()->isPost()) {
19
- $errors = array();
20
-
21
- if (!$customer = Mage::registry('current_customer')) {
22
- $customer = Mage::getModel('customer/customer')->setId(null);
23
- }
24
-
25
- /* @var $customerForm Mage_Customer_Model_Form */
26
- $customerForm = Mage::getModel('customer/form');
27
- $customerForm->setFormCode('customer_account_create')
28
- ->setEntity($customer);
29
-
30
- $customerData = $customerForm->extractData($this->getRequest());
31
-
32
- if (Mage::getStoreConfig("newsletter/subscription/confirm_logged_email_template") == 1) {
33
- $status = Mage::getModel("newsletter/subscriber")->subscribe($this->getRequest()->getPost('email'));
34
- if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
35
- Mage::getSingleton('customer/session')->addSuccess($this->__('Confirmation request has been sent.'));
36
- } else {
37
- Mage::getSingleton('customer/session')->addSuccess($this->__('Thank you for your subscription.'));
38
- }
39
-
40
- } else {
41
- if ($this->getRequest()->getParam('is_subscribed', false)) {
42
- $customer->setIsSubscribed(1);
43
- }
44
-
45
- }
46
- /**
47
- * Initialize customer group id
48
- */
49
- $customer->getGroupId();
50
-
51
- if ($this->getRequest()->getPost('create_address')) {
52
- /* @var $address Mage_Customer_Model_Address */
53
- $address = Mage::getModel('customer/address');
54
- /* @var $addressForm Mage_Customer_Model_Form */
55
- $addressForm = Mage::getModel('customer/form');
56
- $addressForm->setFormCode('customer_register_address')
57
- ->setEntity($address);
58
-
59
- $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
60
- $addressErrors = $addressForm->validateData($addressData);
61
- if ($addressErrors === true) {
62
- $address->setId(null)
63
- ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
64
- ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
65
- $addressForm->compactData($addressData);
66
- $customer->addAddress($address);
67
-
68
- $addressErrors = $address->validate();
69
- if (is_array($addressErrors)) {
70
- $errors = array_merge($errors, $addressErrors);
71
- }
72
- } else {
73
- $errors = array_merge($errors, $addressErrors);
74
- }
75
- }
76
-
77
- try {
78
- $customerErrors = $customerForm->validateData($customerData);
79
- if ($customerErrors !== true) {
80
- $errors = array_merge($customerErrors, $errors);
81
- } else {
82
- $customerForm->compactData($customerData);
83
- $customer->setPassword($this->getRequest()->getPost('password'));
84
- $customer->setConfirmation($this->getRequest()->getPost('confirmation'));
85
- $customerErrors = $customer->validate();
86
- if (is_array($customerErrors)) {
87
- $errors = array_merge($customerErrors, $errors);
88
- }
89
- }
90
-
91
- $validationResult = count($errors) == 0;
92
-
93
- if (true === $validationResult) {
94
- $customer->save();
95
-
96
- Mage::dispatchEvent(
97
- 'customer_register_success',
98
- array('account_controller' => $this, 'customer' => $customer)
99
- );
100
-
101
- if ($customer->isConfirmationRequired()) {
102
- $customer->sendNewAccountEmail(
103
- 'confirmation',
104
- $session->getBeforeAuthUrl(),
105
- Mage::app()->getStore()->getId()
106
- );
107
- $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())));
108
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
109
- return;
110
- } else {
111
- $session->setCustomerAsLoggedIn($customer);
112
- $url = $this->_welcomeCustomer($customer);
113
- $this->_redirectSuccess($url);
114
- return;
115
- }
116
- } else {
117
- $session->setCustomerFormData($this->getRequest()->getPost());
118
- if (is_array($errors)) {
119
- foreach ($errors as $errorMessage) {
120
- $session->addError($errorMessage);
121
- }
122
- } else {
123
- $session->addError($this->__('Invalid customer data'));
124
- }
125
- }
126
- } catch (Mage_Core_Exception $e) {
127
- $session->setCustomerFormData($this->getRequest()->getPost());
128
- if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
129
- $url = Mage::getUrl('customer/account/forgotpassword');
130
- $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
131
- $session->setEscapeMessages(false);
132
- } else {
133
- $message = $e->getMessage();
134
- }
135
- $session->addError($message);
136
- } catch (Exception $e) {
137
- $session->setCustomerFormData($this->getRequest()->getPost())
138
- ->addException($e, $this->__('Cannot save the customer.'));
139
- }
140
- }
141
-
142
- $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
143
- }
144
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/controllers/Adminhtml/{ConfigController.php → CrconfigController.php} RENAMED
@@ -1,16 +1,11 @@
1
  <?php
2
- class Conlabz_Crconnect_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
3
  {
4
-
5
-
6
  const EMPTY_CODE = "empty";
7
-
8
  public function confirmKeyAction()
9
  {
10
-
11
  $apiKey = $this->getRequest()->getParam("key");
12
- //Mage::helper("crconnect")->setApiKey($apiKey);
13
-
14
  $api = Mage::getModel("crconnect/api");
15
  if ($api->isConnected()) {
16
  $groups = $api->getGroupsForKey($apiKey);
@@ -20,15 +15,13 @@ class Conlabz_Crconnect_Adminhtml_ConfigController extends Mage_Adminhtml_Contro
20
  $this->getResponse()->setBody(self::EMPTY_CODE);
21
  }
22
  }
23
-
24
  }
25
-
26
  public function changeGroupAction()
27
  {
28
-
29
  $groupId = $this->getRequest()->getParam("group");
30
  $apiKey = $this->getRequest()->getParam("key");
31
-
32
  $api = Mage::getModel("crconnect/api");
33
  if ($api->isConnected()) {
34
  $forms = $api->getFormsForGroup($apiKey, $groupId);
@@ -38,19 +31,19 @@ class Conlabz_Crconnect_Adminhtml_ConfigController extends Mage_Adminhtml_Contro
38
  $this->getResponse()->setBody(self::EMPTY_CODE);
39
  }
40
  }
41
-
42
  }
43
-
44
  public function getGroupsBlockAction()
45
  {
46
-
47
- echo Mage::app()->getLayout()->createBlock('crconnect/config_groupsapis')->toHtml();
48
-
 
 
49
  }
 
50
  protected function _isAllowed()
51
  {
52
-
53
  return true;
54
-
55
  }
56
  }
1
  <?php
2
+ class Conlabz_Crconnect_Adminhtml_CrconfigController extends Mage_Adminhtml_Controller_Action
3
  {
 
 
4
  const EMPTY_CODE = "empty";
5
+
6
  public function confirmKeyAction()
7
  {
 
8
  $apiKey = $this->getRequest()->getParam("key");
 
 
9
  $api = Mage::getModel("crconnect/api");
10
  if ($api->isConnected()) {
11
  $groups = $api->getGroupsForKey($apiKey);
15
  $this->getResponse()->setBody(self::EMPTY_CODE);
16
  }
17
  }
 
18
  }
19
+
20
  public function changeGroupAction()
21
  {
 
22
  $groupId = $this->getRequest()->getParam("group");
23
  $apiKey = $this->getRequest()->getParam("key");
24
+
25
  $api = Mage::getModel("crconnect/api");
26
  if ($api->isConnected()) {
27
  $forms = $api->getFormsForGroup($apiKey, $groupId);
31
  $this->getResponse()->setBody(self::EMPTY_CODE);
32
  }
33
  }
 
34
  }
35
+
36
  public function getGroupsBlockAction()
37
  {
38
+ $this->getResponse()->setBody(
39
+ $this->getLayout()
40
+ ->createBlock('crconnect/config_groupsApis')
41
+ ->toHtml()
42
+ );
43
  }
44
+
45
  protected function _isAllowed()
46
  {
 
47
  return true;
 
48
  }
49
  }
app/code/community/Conlabz/CrConnect/controllers/Adminhtml/CrconnectController.php CHANGED
@@ -1,17 +1,14 @@
1
  <?php
2
  class Conlabz_Crconnect_Adminhtml_CrconnectController extends Mage_Adminhtml_Controller_Action
3
  {
4
-
5
  /*
6
  * Accounts list action
7
  */
8
  public function synchronizeAction()
9
  {
10
-
11
-
12
  $syncedUsers = Mage::getModel("crconnect/api")->synchronize();
13
  $result = array();
14
-
15
  if ($syncedUsers !== false) {
16
  $result['error'] = false;
17
  $result['message'] = Mage::helper('crconnect')->__("Synchronization successfull. %s users were transmitted.", $syncedUsers);
@@ -21,15 +18,15 @@ class Conlabz_Crconnect_Adminhtml_CrconnectController extends Mage_Adminhtml_Con
21
  $result['message'] = Mage::helper('crconnect')->__("Error occured while synchronization process. Please try again later.");
22
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__("Error occured while synchronization process. Please try again later."));
23
  }
24
-
25
  $this->getResponse()->setBody(json_encode($result));
26
-
27
  }
28
-
29
  protected function _isAllowed()
30
  {
31
-
32
  return true;
33
-
34
  }
35
  }
1
  <?php
2
  class Conlabz_Crconnect_Adminhtml_CrconnectController extends Mage_Adminhtml_Controller_Action
3
  {
 
4
  /*
5
  * Accounts list action
6
  */
7
  public function synchronizeAction()
8
  {
 
 
9
  $syncedUsers = Mage::getModel("crconnect/api")->synchronize();
10
  $result = array();
11
+
12
  if ($syncedUsers !== false) {
13
  $result['error'] = false;
14
  $result['message'] = Mage::helper('crconnect')->__("Synchronization successfull. %s users were transmitted.", $syncedUsers);
18
  $result['message'] = Mage::helper('crconnect')->__("Error occured while synchronization process. Please try again later.");
19
  Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__("Error occured while synchronization process. Please try again later."));
20
  }
21
+
22
  $this->getResponse()->setBody(json_encode($result));
23
+
24
  }
25
+
26
  protected function _isAllowed()
27
  {
28
+
29
  return true;
30
+
31
  }
32
  }
app/code/community/Conlabz/CrConnect/controllers/HookController.php CHANGED
@@ -28,26 +28,26 @@ include "Mage/Newsletter/controllers/SubscriberController.php";
28
  // overrides the newAction method.
29
  class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberController
30
  {
31
-
32
  public function confirmAction()
33
  {
34
  $id = (int) $this->getRequest()->getParam('id');
35
  $code = (string) $this->getRequest()->getParam('code');
36
-
37
  if ($id && $code) {
38
  $subscriber = Mage::getModel('newsletter/subscriber')->load($id);
39
  $session = Mage::getSingleton('core/session');
40
-
41
  if ($subscriber->getId() && $subscriber->getCode()) {
42
  if ($subscriber->confirm($code)) {
43
  Mage::log("Cleverreach_CrConnect: newsletter signup for ".$subscriber->getEmail().", confirmation");
44
-
45
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
46
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
47
  $confirm = trim(Mage::getStoreConfig('newsletter/subscription/confirm'));
48
-
49
 
50
-
 
51
  $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($subscriber->getEmail());
52
 
53
  if ($customer->getId()) {
@@ -59,9 +59,9 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
59
  }
60
  }
61
  }
62
-
63
  }
64
-
65
  try {
66
  $client = new SoapClient(
67
  Mage::helper('crconnect')->getWsdl(),
@@ -72,14 +72,14 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
72
  $session->addException($e, $this->__('There was a problem with the subscription'));
73
  $this->_redirectReferer();
74
  }
75
-
76
  try {
77
  $result = $client->receiverAdd($apiKey, $listID, array(
78
  "email" => $subscriber->getEmail(),
79
  "source" => "MAGENTO (frontend)",
80
  "attributes" => array("key" => "newsletter", "value" => "1"),
81
  ));
82
-
83
  if ($result->status!="SUCCESS" && $result->statuscode == "50") {
84
  $result = $client->receiverUpdate($apiKey, $listID, array(
85
  "email" => $subscriber->getEmail(),
@@ -87,15 +87,15 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
87
  "attributes" => array("key" => "newsletter", "value" => "1"),
88
  "deactivated"=>0
89
  ));
90
-
91
  }
92
-
93
  } catch (Exception $e) {
94
  Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
95
  $session->addException($e, $this->__('Subscription was invalid'));
96
  $this->_redirectReferer();
97
  }
98
-
99
  parent::confirmAction();
100
  } else {
101
  $session->addError($this->__('Invalid subscription confirmation code'));
@@ -107,23 +107,23 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
107
 
108
  $this->_redirectUrl(Mage::getBaseUrl());
109
  }
110
-
111
-
112
  public function newAction()
113
  {
114
-
115
  if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
116
  $session = Mage::getSingleton('core/session');
117
  $customerSession = Mage::getSingleton('customer/session');
118
  $email = (string) $this->getRequest()->getPost('email');
119
-
120
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
121
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
122
  $confirm = trim(Mage::getStoreConfig('newsletter/subscription/confirm'));
123
 
124
  if ($apiKey && $listID && !$confirm) {
125
  Mage::log("Cleverreach_CrConnect: newsletter signup for $email, no confirmation");
126
-
127
  try {
128
  $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
129
  } catch (Exception $e) {
@@ -142,7 +142,7 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
142
  /* $result = $client->receiverGetByEmail($apiKey, $listID, 'alex.nuzil@conlabz.de', 1); */
143
  /* var_dump($result); */
144
  /* exit; */
145
-
146
  if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1') {
147
  $groupKeys = Mage::helper('crconnect')->getKeys();
148
  if ($groupId = $customerSession->getCustomerGroupId()) {
@@ -151,7 +151,7 @@ class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberControl
151
  }
152
  }
153
  }
154
-
155
  $result = $client->receiverAdd($apiKey, $listID, array(
156
  "email" => $email,
157
  "source" => "MAGENTO (frontend)",
28
  // overrides the newAction method.
29
  class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberController
30
  {
31
+
32
  public function confirmAction()
33
  {
34
  $id = (int) $this->getRequest()->getParam('id');
35
  $code = (string) $this->getRequest()->getParam('code');
36
+
37
  if ($id && $code) {
38
  $subscriber = Mage::getModel('newsletter/subscriber')->load($id);
39
  $session = Mage::getSingleton('core/session');
40
+
41
  if ($subscriber->getId() && $subscriber->getCode()) {
42
  if ($subscriber->confirm($code)) {
43
  Mage::log("Cleverreach_CrConnect: newsletter signup for ".$subscriber->getEmail().", confirmation");
44
+
45
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
46
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
47
  $confirm = trim(Mage::getStoreConfig('newsletter/subscription/confirm'));
 
48
 
49
+
50
+
51
  $customer = Mage::getModel('customer/customer')->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail($subscriber->getEmail());
52
 
53
  if ($customer->getId()) {
59
  }
60
  }
61
  }
62
+
63
  }
64
+
65
  try {
66
  $client = new SoapClient(
67
  Mage::helper('crconnect')->getWsdl(),
72
  $session->addException($e, $this->__('There was a problem with the subscription'));
73
  $this->_redirectReferer();
74
  }
75
+
76
  try {
77
  $result = $client->receiverAdd($apiKey, $listID, array(
78
  "email" => $subscriber->getEmail(),
79
  "source" => "MAGENTO (frontend)",
80
  "attributes" => array("key" => "newsletter", "value" => "1"),
81
  ));
82
+
83
  if ($result->status!="SUCCESS" && $result->statuscode == "50") {
84
  $result = $client->receiverUpdate($apiKey, $listID, array(
85
  "email" => $subscriber->getEmail(),
87
  "attributes" => array("key" => "newsletter", "value" => "1"),
88
  "deactivated"=>0
89
  ));
90
+
91
  }
92
+
93
  } catch (Exception $e) {
94
  Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
95
  $session->addException($e, $this->__('Subscription was invalid'));
96
  $this->_redirectReferer();
97
  }
98
+
99
  parent::confirmAction();
100
  } else {
101
  $session->addError($this->__('Invalid subscription confirmation code'));
107
 
108
  $this->_redirectUrl(Mage::getBaseUrl());
109
  }
110
+
111
+
112
  public function newAction()
113
  {
114
+
115
  if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
116
  $session = Mage::getSingleton('core/session');
117
  $customerSession = Mage::getSingleton('customer/session');
118
  $email = (string) $this->getRequest()->getPost('email');
119
+
120
  $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
121
  $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
122
  $confirm = trim(Mage::getStoreConfig('newsletter/subscription/confirm'));
123
 
124
  if ($apiKey && $listID && !$confirm) {
125
  Mage::log("Cleverreach_CrConnect: newsletter signup for $email, no confirmation");
126
+
127
  try {
128
  $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
129
  } catch (Exception $e) {
142
  /* $result = $client->receiverGetByEmail($apiKey, $listID, 'alex.nuzil@conlabz.de', 1); */
143
  /* var_dump($result); */
144
  /* exit; */
145
+
146
  if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1') {
147
  $groupKeys = Mage::helper('crconnect')->getKeys();
148
  if ($groupId = $customerSession->getCustomerGroupId()) {
151
  }
152
  }
153
  }
154
+
155
  $result = $client->receiverAdd($apiKey, $listID, array(
156
  "email" => $email,
157
  "source" => "MAGENTO (frontend)",
app/code/community/Conlabz/CrConnect/controllers/ManageController.php CHANGED
@@ -4,12 +4,10 @@ include "Mage/Newsletter/controllers/ManageController.php";
4
 
5
  class Conlabz_CrConnect_ManageController extends Mage_Newsletter_ManageController
6
  {
7
-
8
  public function saveAction()
9
  {
10
-
11
  if (!$this->_validateFormKey()) {
12
- return $this->_redirect('customer/account/');
13
  }
14
  try {
15
  $email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
@@ -24,7 +22,7 @@ class Conlabz_CrConnect_ManageController extends Mage_Newsletter_ManageControlle
24
  } else {
25
  Mage::getSingleton('customer/session')->addSuccess($this->__('Thank you for your subscription.'));
26
  }
27
-
28
  }
29
  } else {
30
  if ($subscriber->isSubscribed()) {
@@ -55,6 +53,6 @@ class Conlabz_CrConnect_ManageController extends Mage_Newsletter_ManageControlle
55
  Mage::getSingleton('customer/session')->addError($e->getMessage());
56
  Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.'));
57
  }
58
- $this->_redirect('customer/account/');
59
  }
60
  }
4
 
5
  class Conlabz_CrConnect_ManageController extends Mage_Newsletter_ManageController
6
  {
 
7
  public function saveAction()
8
  {
 
9
  if (!$this->_validateFormKey()) {
10
+ return $this->_redirect('customer/account');
11
  }
12
  try {
13
  $email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
22
  } else {
23
  Mage::getSingleton('customer/session')->addSuccess($this->__('Thank you for your subscription.'));
24
  }
25
+
26
  }
27
  } else {
28
  if ($subscriber->isSubscribed()) {
53
  Mage::getSingleton('customer/session')->addError($e->getMessage());
54
  Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.'));
55
  }
56
+ $this->_redirect('customer/account');
57
  }
58
  }
app/code/community/Conlabz/CrConnect/controllers/SearchController.php CHANGED
@@ -1,21 +1,27 @@
1
  <?php
2
  class Conlabz_CrConnect_SearchController extends Mage_Core_Controller_Front_Action
3
  {
4
-
5
  public function indexAction()
6
  {
7
-
8
- $systemPassword = Mage::helper("crconnect")->getCleverReachFeedPassword();
9
 
10
  $store = $this->getRequest()->getParam('store');
11
- $password = $this->getRequest()->getParam("password");
12
 
13
- if (($systemPassword || $password) && $password != $systemPassword) {
14
- die(Mage::helper("crconnect")->__("You have no permissions to view this page"));
 
 
 
 
15
  }
16
 
 
 
 
17
  $search = Mage::getModel('crconnect/search');
18
- $action = $this->getRequest()->getParam('get');
 
19
  switch ($action) {
20
  case 'filter':
21
  $returnData = $search->getFilter();
@@ -27,6 +33,8 @@ class Conlabz_CrConnect_SearchController extends Mage_Core_Controller_Front_Acti
27
  break;
28
  }
29
 
30
- $this->getResponse()->setBody(json_encode($returnData));
 
 
31
  }
32
  }
1
  <?php
2
  class Conlabz_CrConnect_SearchController extends Mage_Core_Controller_Front_Action
3
  {
 
4
  public function indexAction()
5
  {
6
+ $systemPassword = Mage::helper('crconnect')->getCleverReachFeedPassword();
 
7
 
8
  $store = $this->getRequest()->getParam('store');
9
+ $password = $this->getRequest()->getParam('password');
10
 
11
+ if ($systemPassword && $password != $systemPassword) {
12
+ $this->getResponse()
13
+ ->setHeader('HTTP/1.1','403 Forbidden')
14
+ ->setBody('You have no permissions to view this page')
15
+ ->sendResponse();
16
+ exit;
17
  }
18
 
19
+ // make sure to set the correct store, so that correct categories and products are used
20
+ Mage::app()->setCurrentStore($store);
21
+
22
  $search = Mage::getModel('crconnect/search');
23
+ $action = $this->getRequest()->getParam('get', 'filter');
24
+ $returnData = array();
25
  switch ($action) {
26
  case 'filter':
27
  $returnData = $search->getFilter();
33
  break;
34
  }
35
 
36
+ $this->getResponse()
37
+ ->setHeader('Content-Type', 'application/json')
38
+ ->setBody(Mage::helper('core')->jsonEncode($returnData));
39
  }
40
  }
app/code/community/Conlabz/CrConnect/controllers/SubscriberController.php CHANGED
@@ -22,20 +22,15 @@ include "Mage/Newsletter/controllers/SubscriberController.php";
22
 
23
  class Conlabz_CrConnect_SubscriberController extends Mage_Newsletter_SubscriberController
24
  {
25
-
26
  const XML_PATH_LOGGED_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_logged_email_template';
27
 
28
  public function newAction()
29
  {
30
-
31
  if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
32
  $session = Mage::getSingleton('core/session');
33
- $customerSession = Mage::getSingleton('customer/session');
34
  $email = (string) $this->getRequest()->getPost('email');
35
-
36
  try {
37
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email);
38
-
39
  if ($status) {
40
  if (Mage::helper("crconnect")->isDoubleOptInEnabled()) {
41
  Mage::getSingleton('core/session')->addSuccess($this->__('Confirmation request has been sent.'));
@@ -43,7 +38,6 @@ class Conlabz_CrConnect_SubscriberController extends Mage_Newsletter_SubscriberC
43
  Mage::getSingleton('core/session')->addSuccess($this->__('Thank you for your subscription.'));
44
  }
45
  }
46
-
47
  $this->_redirectReferer();
48
  } catch (Exception $e) {
49
  $session->addException($e, $this->__('There was a problem with the subscription'));
22
 
23
  class Conlabz_CrConnect_SubscriberController extends Mage_Newsletter_SubscriberController
24
  {
 
25
  const XML_PATH_LOGGED_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_logged_email_template';
26
 
27
  public function newAction()
28
  {
 
29
  if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
30
  $session = Mage::getSingleton('core/session');
 
31
  $email = (string) $this->getRequest()->getPost('email');
 
32
  try {
33
  $status = Mage::getModel("newsletter/subscriber")->subscribe($email);
 
34
  if ($status) {
35
  if (Mage::helper("crconnect")->isDoubleOptInEnabled()) {
36
  Mage::getSingleton('core/session')->addSuccess($this->__('Confirmation request has been sent.'));
38
  Mage::getSingleton('core/session')->addSuccess($this->__('Thank you for your subscription.'));
39
  }
40
  }
 
41
  $this->_redirectReferer();
42
  } catch (Exception $e) {
43
  $session->addException($e, $this->__('There was a problem with the subscription'));
app/code/community/Conlabz/CrConnect/controllers/UnsubscribeController.php CHANGED
@@ -24,11 +24,11 @@ class Conlabz_CrConnect_UnsubscribeController extends Mage_Core_Controller_Front
24
  public function indexAction()
25
  {
26
  // don't do anything if we didn't get the email parameter
27
- if (isset($_GET['email'])) {
28
- $email = $_GET['email'];
29
  $apiKey = trim(Mage::getStoreConfig('newsletter/crconnect/api_key'));
30
  $listID = trim(Mage::getStoreConfig('newsletter/crconnect/list_id'));
31
-
32
  // Check that the email address actually is unsubscribed in
33
  // CleverReach
34
  if ($apiKey && $listID) {
@@ -50,19 +50,19 @@ class Conlabz_CrConnect_UnsubscribeController extends Mage_Core_Controller_Front
50
  } else {
51
  Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
52
  }
53
-
54
  // If we are unsubscribed in cleverreach, mark us as
55
  // unsubscribed in Magento.
56
  if ($tmp->data->deactivated) {
57
  try {
58
  Mage::log("CleverReach_CrConnect: Unsubscribing $email");
59
- $collection = Mage::getModel('newsletter/subscriber')
60
  ->loadByEmail($email)
61
  ->unsubscribe();
62
 
63
  Mage::getSingleton('customer/session')->addSuccess($this->__('You were successfully unsubscribed'));
64
  } catch (Exception $e) {
65
- Mage::log("CleverReach_CrConnect: ".$e->getMessage());
66
  Mage::getSingleton('customer/session')->addError($this->__('There was an error while saving your subscription details'));
67
  }
68
  } else {
@@ -70,7 +70,7 @@ class Conlabz_CrConnect_UnsubscribeController extends Mage_Core_Controller_Front
70
  }
71
  }
72
  }
73
-
74
- $this->_redirect('customer/account/');
75
  }
76
  }
24
  public function indexAction()
25
  {
26
  // don't do anything if we didn't get the email parameter
27
+ $request = $this->getRequest();
28
+ if ($email = $request->getParam('email')) {
29
  $apiKey = trim(Mage::getStoreConfig('newsletter/crconnect/api_key'));
30
  $listID = trim(Mage::getStoreConfig('newsletter/crconnect/list_id'));
31
+ $session = Mage::getSingleton('core/session');
32
  // Check that the email address actually is unsubscribed in
33
  // CleverReach
34
  if ($apiKey && $listID) {
50
  } else {
51
  Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
52
  }
53
+
54
  // If we are unsubscribed in cleverreach, mark us as
55
  // unsubscribed in Magento.
56
  if ($tmp->data->deactivated) {
57
  try {
58
  Mage::log("CleverReach_CrConnect: Unsubscribing $email");
59
+ Mage::getModel('newsletter/subscriber')
60
  ->loadByEmail($email)
61
  ->unsubscribe();
62
 
63
  Mage::getSingleton('customer/session')->addSuccess($this->__('You were successfully unsubscribed'));
64
  } catch (Exception $e) {
65
+ Mage::log("CleverReach_CrConnect: " . $e->getMessage());
66
  Mage::getSingleton('customer/session')->addError($this->__('There was an error while saving your subscription details'));
67
  }
68
  } else {
70
  }
71
  }
72
  }
73
+
74
+ $this->_redirect('customer/account');
75
  }
76
  }
app/code/community/Conlabz/CrConnect/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Conlabz_CrConnect>
5
- <version>3.0.6</version>
6
  </Conlabz_CrConnect>
7
  </modules>
8
  <global>
@@ -50,7 +50,7 @@
50
  <method>trackingCodesSet</method>
51
  </crconnect_customer_session_init>
52
  </observers>
53
- </customer_session_init>
54
  <checkout_onepage_controller_success_action>
55
  <observers>
56
  <crconnect_checkout_onepage_controller_success_action>
@@ -59,7 +59,7 @@
59
  <method>checkoutSuccess</method>
60
  </crconnect_checkout_onepage_controller_success_action>
61
  </observers>
62
- </checkout_onepage_controller_success_action>
63
  <sales_order_place_after>
64
  <observers>
65
  <crconnect_sales_order_place_after>
@@ -94,7 +94,7 @@
94
  <modules>
95
  <Conlabz_CrConnect>
96
  <files>
97
- <default>Conlabz_CleverReach.csv</default>
98
  </files>
99
  </Conlabz_CrConnect>
100
  </modules>
@@ -128,21 +128,21 @@
128
  </adminhtml>
129
  <admin>
130
  <routers>
131
- <crconnect>
132
- <use>admin</use>
133
- <args>
134
- <module>Conlabz_CrConnect</module>
135
- <frontName>crconnect</frontName>
136
- </args>
137
- </crconnect>
138
  </routers>
139
- </admin>
140
  <frontend>
141
  <translate>
142
  <modules>
143
  <Conlabz_CrConnect>
144
  <files>
145
- <default>Conlabz_CleverReach.csv</default>
146
  </files>
147
  </Conlabz_CrConnect>
148
  </modules>
@@ -155,6 +155,13 @@
155
  </modules>
156
  </args>
157
  </newsletter>
 
 
 
 
 
 
 
158
  </routers>
159
  <layout>
160
  <updates>
@@ -164,4 +171,11 @@
164
  </updates>
165
  </layout>
166
  </frontend>
167
- </config>
 
 
 
 
 
 
 
2
  <config>
3
  <modules>
4
  <Conlabz_CrConnect>
5
+ <version>3.1.5</version>
6
  </Conlabz_CrConnect>
7
  </modules>
8
  <global>
50
  <method>trackingCodesSet</method>
51
  </crconnect_customer_session_init>
52
  </observers>
53
+ </customer_session_init>
54
  <checkout_onepage_controller_success_action>
55
  <observers>
56
  <crconnect_checkout_onepage_controller_success_action>
59
  <method>checkoutSuccess</method>
60
  </crconnect_checkout_onepage_controller_success_action>
61
  </observers>
62
+ </checkout_onepage_controller_success_action>
63
  <sales_order_place_after>
64
  <observers>
65
  <crconnect_sales_order_place_after>
94
  <modules>
95
  <Conlabz_CrConnect>
96
  <files>
97
+ <default>Conlabz_CrConnect.csv</default>
98
  </files>
99
  </Conlabz_CrConnect>
100
  </modules>
128
  </adminhtml>
129
  <admin>
130
  <routers>
131
+ <adminhtml>
132
+                 <args>
133
+                     <modules>
134
+                     <Conlabz_CrConnect after="Mage_Adminhtml">Conlabz_CrConnect_Adminhtml</Conlabz_CrConnect>
135
+                     </modules>
136
+                 </args>
137
+             </adminhtml>
138
  </routers>
139
+ </admin>
140
  <frontend>
141
  <translate>
142
  <modules>
143
  <Conlabz_CrConnect>
144
  <files>
145
+ <default>Conlabz_CrConnect.csv</default>
146
  </files>
147
  </Conlabz_CrConnect>
148
  </modules>
155
  </modules>
156
  </args>
157
  </newsletter>
158
+ <crconnect>
159
+ <use>standard</use>
160
+ <args>
161
+ <module>Conlabz_CrConnect</module>
162
+ <frontName>crconnect</frontName>
163
+ </args>
164
+ </crconnect>
165
  </routers>
166
  <layout>
167
  <updates>
171
  </updates>
172
  </layout>
173
  </frontend>
174
+ <phpunit>
175
+ <suite>
176
+ <modules>
177
+ <Conlabz_CrConnect />
178
+ </modules>
179
+ </suite>
180
+ </phpunit>
181
+ </config>
app/code/community/Conlabz/CrConnect/etc/jstranslator.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <jstranslator>
3
+ <please-select-group translate="message" module="crconnect">
4
+ <message>Please select subscribers group</message>
5
+ </please-select-group>
6
+ <please-select-form translate="message" module="crconnect">
7
+ <message>Please select form</message>
8
+ </please-select-form>
9
+ <please-select-form-default translate="message" module="crconnect">
10
+ <message>No forms to select</message>
11
+ </please-select-form-default>
12
+ <please-select-group-default translate="message" module="crconnect">
13
+ <message>No groups to select</message>
14
+ </please-select-group-default>
15
+ </jstranslator>
app/design/adminhtml/default/default/layout/crconnect.xml CHANGED
@@ -2,13 +2,13 @@
2
  <layout>
3
  <adminhtml_system_config_edit>
4
  <reference name="head">
5
- <action method="addItem"><type>skin_js</type><name>js/crconnect.js</name><params/></action>
 
 
 
6
  </reference>
7
- <reference name="root">
8
- <block type="core/template" name="crconnect_header" output="toHtml">
9
- <action method="setTemplate"><template>crconnect/config/header.phtml</template></action>
10
- </block>
11
  </reference>
12
  </adminhtml_system_config_edit>
13
-
14
- </layout>
2
  <layout>
3
  <adminhtml_system_config_edit>
4
  <reference name="head">
5
+ <action method="addItem">
6
+ <type>skin_js</type>
7
+ <name>js/crconnect.js</name>
8
+ </action>
9
  </reference>
10
+ <reference name="before_body_end">
11
+ <block type="adminhtml/template" name="crconnect.config" template="crconnect/config.phtml" />
 
 
12
  </reference>
13
  </adminhtml_system_config_edit>
14
+ </layout>
 
app/design/adminhtml/default/default/template/crconnect/config.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Mage_Adminhtml_Block_Template */
3
+ /* @var $helper Conlabz_CrConnect_Helper_Data */
4
+ $helper = $this->helper('crconnect');
5
+ ?>
6
+ <script>
7
+ var crconnectOptions = {
8
+ baseConfirmKeyUrl: "<?php echo $this->getUrl("adminhtml/crconfig/confirmKey")?>",
9
+ baseChangeGroupUrl:"<?php echo $this->getUrl("adminhtml/crconfig/changeGroup")?>",
10
+ baseGroupsBlockUrl: "<?php echo $this->getUrl("adminhtml/crconfig/getGroupsBlock")?>",
11
+ savedDefaultListId: "<?php echo $helper->getDefaultListId();?>",
12
+ savedDefaultFormId: "<?php echo $helper->getDefaultFormId();?>",
13
+ savedFormsKeys: <?php echo $this->helper('core')->jsonEncode($helper->getFormsIdsByKeys()) ?>
14
+ };
15
+ </script>
app/design/adminhtml/default/default/template/crconnect/config/header.phtml DELETED
@@ -1,19 +0,0 @@
1
- <script>
2
- var baseConfirmKeyUrl = "<?php echo $this->getUrl("crconnect/adminhtml_config/confirmKey")?>";
3
- var baseChangeGroupUrl = "<?php echo $this->getUrl("crconnect/adminhtml_config/changeGroup")?>";
4
- var baseGroupsBlockUrl = "<?php echo $this->getUrl("crconnect/adminhtml_config/getGroupsBlock")?>";
5
-
6
- var savedDefaultListId = "<?php echo Mage::helper("crconnect")->getDefaultListId();?>";
7
- var savedDefaultFormId = "<?php echo Mage::helper("crconnect")->getDefaultFormId();?>";
8
- var savedFormsKeys = new Array();
9
- <?php foreach (Mage::helper("crconnect")->getFormsIdsByKeys() as $key=>$formKey):?>
10
- savedFormsKeys[<?php echo "'" . $key . "'";?>] = "<?php echo $formKey;?>";
11
- <?php endforeach;?>
12
-
13
- var crconnectLang = new Array();
14
- crconnectLang['please:select:group:default'] = "<?php echo Mage::helper("crconnect")->__("No groups to select")?>";
15
- crconnectLang['please:select:form:default'] = "<?php echo Mage::helper("crconnect")->__("No forms to select")?>";
16
- crconnectLang['please:select:group'] = "<?php echo Mage::helper("crconnect")->__("Please select subscribers group")?>";
17
- crconnectLang['please:select:form'] = "<?php echo Mage::helper("crconnect")->__("Please select form")?>";
18
-
19
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/crconnect/newsletter/subscriber/list.phtml CHANGED
@@ -1,24 +1,24 @@
1
  <script>
2
- function synchronizeData(){
3
-
4
- var url = '<?php echo $this->getUrl("crconnect/adminhtml_crconnect/synchronize")?>id/';
5
- new Ajax.Request(url, {
6
- method: 'post',
7
- onSuccess: function(transport) {
8
- editData = transport.responseText.evalJSON(true);
9
- if (editData.error == false){
10
- $("success-messages").show();
11
- $("success-messages-content").innerHTML = editData.message;
12
- }else{
13
- $("error-messages").show();
14
- $("error-messages-content").innerHTML = editData.message;
 
 
 
15
  }
16
- scroll(0,0);
17
- document.location.assign("<?php echo $this->getUrl("*/*/")?>");
18
- }
19
- });
20
 
21
- }
22
  </script>
23
  <style>
24
  .overview tr td:first-child {
@@ -26,135 +26,136 @@ function synchronizeData(){
26
  }
27
  </style>
28
  <?php $info = $this->getSubscribersListData(); ?>
29
- <div id="error-messages" <?php if (sizeof($info['error']) == 0): ?>style="display:none"<?php endif; ?>><ul class="messages"><li class="error-msg"><ul><li id="error-messages-content"><?php echo implode("<br />", $info['error'])?></li></ul></li></ul></div>
30
  <div id="success-messages" style="display:none"><ul class="messages"><li class="success-msg"><ul><li id="success-messages-content"></li></ul></li></ul></div>
31
  <div class="content-header">
32
  <table cellspacing="0">
33
- <tr>
34
  <td style="width: 50%;">
35
  <h3><?php echo Mage::helper('newsletter')->__('Newsletter Subscribers') ?></h3>
36
  </td>
37
- <td align="right"><img src="<?php echo $this->getSkinUrl('images/cleverreach/cleverreach-logo.png')?>" alt="" /></td>
38
- </tr>
39
  </table>
40
  </div>
41
  <?php if (sizeof($info['error']) == 0): ?>
42
- <p><?php echo Mage::helper("crconnect")->__('Magento subscribers list has been deactivated since deactivation will most likly happen in Cleverreach.')?>
43
- <br /><?php echo Mage::helper("crconnect")->__('Please use your Cleverreach account to activate/deactivate your subscribers.')?></p>
44
 
45
- <?php if(isset($info['info']) && isset($info['info']['client'])): ?>
46
- <div class="entry-edit">
47
- <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo Mage::helper("crconnect")->__('CleverReach Connect general information');?></h4></div>
48
- <fieldset>
49
- <table class="box-left" cellspacing="2">
50
- <tbody>
51
- <tr>
52
- <td><strong><?php echo Mage::helper("crconnect")->__('CleverReach client ID')?>:</strong></td>
53
- <td><?php echo $info['info']['client']->id?></td>
54
- </tr>
55
- <tr>
56
- <td><strong><?php echo Mage::helper("crconnect")->__('Name')?></strong></td>
57
- <td><?php echo $info['info']['client']->firstname?> <?php echo $info['info']['client']->name?></td>
58
- </tr>
59
- <tr>
60
- <td><strong><?php echo Mage::helper("crconnect")->__('Company');?></strong></td>
61
- <td><?php echo $info['info']['client']->company?></td>
62
- </tr>
63
- <tr>
64
- <td><strong><?php echo Mage::helper("crconnect")->__('E-Mail')?></strong></td>
65
- <td><?php echo $info['info']['client']->email?></td>
66
- </tr>
67
- <tr>
68
- <td><strong><?php echo Mage::helper("crconnect")->__('Active Subscribers in Magento system')?></strong></td>
69
- <td><?php echo $info['info']['actvie_subscribers']?></td>
70
- </tr>
71
- <tr>
72
- <td><strong><?php echo Mage::helper("crconnect")->__('Inactive Subscribers in Magento system')?></strong></td>
73
- <td><?php echo $info['info']['inactive_subscribers']?></td>
74
- </tr>
75
- </tbody></table>
76
- <div class="box-right">
77
- <strong><?php echo Mage::helper("crconnect")->__('Login')?></strong><br />
78
- <a href="http://<?php echo $info['info']['client']->login_domain?>/admin/" target="_blank"><b><?php echo Mage::helper("crconnect")->__('Cleaverreach login');?></b></a>
79
- </div>
80
- </fieldset>
81
- </div>
82
  <?php endif; ?>
83
 
84
- <?php if(isset($info['info']) && isset($info['info']['list']) && $info['info']['list']): ?>
85
- <div class="entry-edit overview">
86
- <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo Mage::helper("crconnect")->__('CleverReach Connect General list information')?></h4></div>
87
- <fieldset>
88
- <table class="box-left" cellspacing="2">
89
- <tbody>
90
- <tr>
91
- <td><strong><?php echo Mage::helper("crconnect")->__('List name')?></strong></td>
92
- <td><?php echo $info['info']['list']->name?></td>
93
- </tr>
94
- <tr>
95
- <td><strong><?php echo Mage::helper("crconnect")->__('Last mailing')?></strong></td>
96
- <td><?php if (isset($info['info']['list']->last_mailing)):?><?php echo date("r", @$info['info']['list']->last_mailing)?><?php else:?><b><font color="red"><?php echo Mage::helper("crconnect")->__('Never Sent');?></font></b><?php endif;?></td>
97
- </tr>
98
- </tbody></table>
99
- <table class="box-right" cellspacing="2">
100
- <tbody>
101
- <tr>
102
- <td><strong><?php echo Mage::helper("crconnect")->__('Active receivers')?></strong></td>
103
- <td><?php echo $info['info']['list']->active?></td>
104
- </tr>
105
- <tr>
106
- <td><strong><?php echo Mage::helper("crconnect")->__('Inactive receivers')?></strong></td>
107
- <td><?php echo $info['info']['list']->inactive?></td>
108
- </tr>
109
- <tr>
110
- <td><strong><?php echo Mage::helper("crconnect")->__('Total receivers');?></strong></td>
111
- <td><?php echo $info['info']['list']->total?></td>
112
- </tr>
113
- </tbody>
114
- </table>
115
- </fieldset>
116
- </div>
 
117
  <?php endif; ?>
118
- <?php if(isset($info['info']) && isset($info['info']['groups']) && is_array($info['info']['groups']) && sizeof($info['info']['groups']) > 0): ?>
119
- <?php foreach ($info['info']['groups'] as $group):?>
120
  <div class="entry-edit overview">
121
- <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo $group->name?></h4></div>
122
  <fieldset>
123
  <table class="box-left" cellspacing="2">
124
  <tbody>
125
- <tr>
126
- <td><strong><?php echo Mage::helper("crconnect")->__('List name')?></strong></td>
127
- <td><?php echo $group->name?></td>
128
- </tr>
129
- <tr>
130
- <td><strong><?php echo Mage::helper("crconnect")->__('Last mailing')?></strong></td>
131
- <td><?php if (isset($group->last_mailing)):?><?php echo date("r", @$group->last_mailing)?><?php else:?><b><font color="red"><?php echo Mage::helper("crconnect")->__('Never Sent');?></font></b><?php endif;?></td>
132
- </tr>
133
- </tbody></table>
134
  <table class="box-right" cellspacing="2">
135
  <tbody>
136
  <tr>
137
- <td><strong><?php echo Mage::helper("crconnect")->__('Active receivers')?></strong></td>
138
- <td><?php echo $group->active?></td>
139
  </tr>
140
  <tr>
141
- <td><strong><?php echo Mage::helper("crconnect")->__('Inactive receivers')?></strong></td>
142
- <td><?php echo $group->inactive?></td>
143
  </tr>
144
  <tr>
145
- <td><strong><?php echo Mage::helper("crconnect")->__('Total receivers');?></strong></td>
146
- <td><?php echo $group->total?></td>
147
  </tr>
148
  </tbody>
149
  </table>
150
  </fieldset>
151
  </div>
152
- <?php endforeach;?>
153
  <?php endif; ?>
154
  <div id="cr_import">
155
- <button type="button" class="scalable" onclick="synchronizeData()" style=""><span><span><span><?php echo Mage::helper("crconnect")->__('Synchronize data with CleverReach')?></span></span></span></button>
156
- &nbsp;&nbsp;&nbsp;&nbsp;<?php echo Mage::helper("crconnect")->__('Warning: Please wait untill the synchronization is finished. Depending on the amount of data this might take a while.')?>
157
  </div>
158
- <?php else:?>
159
- <button type="button" class="scalable" onclick="document.location.assign('<?php echo $this->getUrl('adminhtml/system_config/edit', array('section'=>'crroot'))?>')" style=""><span><span><span><?php echo Mage::helper("crconnect")->__('CleverReach extension configuration')?></span></span></span></button>
160
- <?php endif; ?>
1
  <script>
2
+ function synchronizeData() {
3
+
4
+ var url = '<?php echo $this->getUrl("adminhtml/crconnect/synchronize") ?>id/';
5
+ new Ajax.Request(url, {
6
+ method: 'post',
7
+ onSuccess: function (transport) {
8
+ editData = transport.responseText.evalJSON(true);
9
+ if (editData.error == false) {
10
+ $("success-messages").show();
11
+ $("success-messages-content").innerHTML = editData.message;
12
+ } else {
13
+ $("error-messages").show();
14
+ $("error-messages-content").innerHTML = editData.message;
15
+ }
16
+ scroll(0, 0);
17
+ document.location.assign("<?php echo $this->getUrl("*/*/") ?>");
18
  }
19
+ });
 
 
 
20
 
21
+ }
22
  </script>
23
  <style>
24
  .overview tr td:first-child {
26
  }
27
  </style>
28
  <?php $info = $this->getSubscribersListData(); ?>
29
+ <div id="error-messages" <?php if (sizeof($info['error']) == 0): ?>style="display:none"<?php endif; ?>><ul class="messages"><li class="error-msg"><ul><li id="error-messages-content"><?php echo implode("<br />", $info['error']) ?></li></ul></li></ul></div>
30
  <div id="success-messages" style="display:none"><ul class="messages"><li class="success-msg"><ul><li id="success-messages-content"></li></ul></li></ul></div>
31
  <div class="content-header">
32
  <table cellspacing="0">
33
+ <tr>
34
  <td style="width: 50%;">
35
  <h3><?php echo Mage::helper('newsletter')->__('Newsletter Subscribers') ?></h3>
36
  </td>
37
+ <td align="right"><img src="<?php echo $this->getSkinUrl('images/cleverreach/cleverreach-logo.png') ?>" alt="" /></td>
38
+ </tr>
39
  </table>
40
  </div>
41
  <?php if (sizeof($info['error']) == 0): ?>
42
+ <p><?php echo Mage::helper("crconnect")->__('Magento subscribers list has been deactivated since deactivation will most likly happen in Cleverreach.') ?>
43
+ <br /><?php echo Mage::helper("crconnect")->__('Please use your Cleverreach account to activate/deactivate your subscribers.') ?></p>
44
 
45
+ <?php if (isset($info['info']) && isset($info['info']['client'])): ?>
46
+ <div class="entry-edit">
47
+ <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo Mage::helper("crconnect")->__('CleverReach Connect general information'); ?></h4></div>
48
+ <fieldset>
49
+ <table class="box-left" cellspacing="2">
50
+ <tbody>
51
+ <tr>
52
+ <td><strong><?php echo Mage::helper("crconnect")->__('CleverReach client ID') ?>:</strong></td>
53
+ <td><?php echo $info['info']['client']->id ?></td>
54
+ </tr>
55
+ <tr>
56
+ <td><strong><?php echo Mage::helper("crconnect")->__('Name') ?></strong></td>
57
+ <td><?php echo $info['info']['client']->firstname ?> <?php echo $info['info']['client']->name ?></td>
58
+ </tr>
59
+ <tr>
60
+ <td><strong><?php echo Mage::helper("crconnect")->__('Company'); ?></strong></td>
61
+ <td><?php echo $info['info']['client']->company ?></td>
62
+ </tr>
63
+ <tr>
64
+ <td><strong><?php echo Mage::helper("crconnect")->__('E-Mail') ?></strong></td>
65
+ <td><?php echo $info['info']['client']->email ?></td>
66
+ </tr>
67
+ <tr>
68
+ <td><strong><?php echo Mage::helper("crconnect")->__('Active Subscribers in Magento system') ?></strong></td>
69
+ <td><?php echo $info['info']['actvie_subscribers'] ?></td>
70
+ </tr>
71
+ <tr>
72
+ <td><strong><?php echo Mage::helper("crconnect")->__('Inactive Subscribers in Magento system') ?></strong></td>
73
+ <td><?php echo $info['info']['inactive_subscribers'] ?></td>
74
+ </tr>
75
+ </tbody></table>
76
+ <div class="box-right">
77
+ <strong><?php echo Mage::helper("crconnect")->__('Login') ?></strong><br />
78
+ <a href="http://<?php echo $info['info']['client']->login_domain ?>/admin/" target="_blank"><b><?php echo Mage::helper("crconnect")->__('Cleaverreach login'); ?></b></a>
79
+ </div>
80
+ </fieldset>
81
+ </div>
82
  <?php endif; ?>
83
 
84
+ <?php if (isset($info['info']) && isset($info['info']['list']) && $info['info']['list']): ?>
85
+ <div class="entry-edit overview">
86
+ <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo Mage::helper("crconnect")->__('CleverReach Connect General list information') ?></h4></div>
87
+ <fieldset>
88
+ <table class="box-left" cellspacing="2">
89
+ <tbody>
90
+ <tr>
91
+ <td><strong><?php echo Mage::helper("crconnect")->__('List name') ?></strong></td>
92
+ <td><?php echo $info['info']['list']->name ?></td>
93
+ </tr>
94
+ <tr>
95
+ <td><strong><?php echo Mage::helper("crconnect")->__('Last mailing') ?></strong></td>
96
+ <td><?php if (isset($info['info']['list']->last_mailing)): ?><?php echo date("r", @$info['info']['list']->last_mailing) ?><?php else: ?><b><font color="red"><?php echo Mage::helper("crconnect")->__('Never Sent'); ?></font></b><?php endif; ?></td>
97
+ </tr>
98
+ </tbody>
99
+ </table>
100
+ <table class="box-right" cellspacing="2">
101
+ <tbody>
102
+ <tr>
103
+ <td><strong><?php echo Mage::helper("crconnect")->__('Active receivers') ?></strong></td>
104
+ <td><?php echo $info['info']['list']->active ?></td>
105
+ </tr>
106
+ <tr>
107
+ <td><strong><?php echo Mage::helper("crconnect")->__('Inactive receivers') ?></strong></td>
108
+ <td><?php echo $info['info']['list']->inactive ?></td>
109
+ </tr>
110
+ <tr>
111
+ <td><strong><?php echo Mage::helper("crconnect")->__('Total receivers'); ?></strong></td>
112
+ <td><?php echo $info['info']['list']->total ?></td>
113
+ </tr>
114
+ </tbody>
115
+ </table>
116
+ </fieldset>
117
+ </div>
118
  <?php endif; ?>
119
+ <?php if (isset($info['info']) && isset($info['info']['groups']) && is_array($info['info']['groups']) && sizeof($info['info']['groups']) > 0): ?>
120
+ <?php foreach ($info['info']['groups'] as $group): ?>
121
  <div class="entry-edit overview">
122
+ <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo $group->name ?></h4></div>
123
  <fieldset>
124
  <table class="box-left" cellspacing="2">
125
  <tbody>
126
+ <tr>
127
+ <td><strong><?php echo Mage::helper("crconnect")->__('List name') ?></strong></td>
128
+ <td><?php echo $group->name ?></td>
129
+ </tr>
130
+ <tr>
131
+ <td><strong><?php echo Mage::helper("crconnect")->__('Last mailing') ?></strong></td>
132
+ <td><?php if (isset($group->last_mailing)): ?><?php echo date("r", @$group->last_mailing) ?><?php else: ?><b><font color="red"><?php echo Mage::helper("crconnect")->__('Never Sent'); ?></font></b><?php endif; ?></td>
133
+ </tr>
134
+ </tbody></table>
135
  <table class="box-right" cellspacing="2">
136
  <tbody>
137
  <tr>
138
+ <td><strong><?php echo Mage::helper("crconnect")->__('Active receivers') ?></strong></td>
139
+ <td><?php echo $group->active ?></td>
140
  </tr>
141
  <tr>
142
+ <td><strong><?php echo Mage::helper("crconnect")->__('Inactive receivers') ?></strong></td>
143
+ <td><?php echo $group->inactive ?></td>
144
  </tr>
145
  <tr>
146
+ <td><strong><?php echo Mage::helper("crconnect")->__('Total receivers'); ?></strong></td>
147
+ <td><?php echo $group->total ?></td>
148
  </tr>
149
  </tbody>
150
  </table>
151
  </fieldset>
152
  </div>
153
+ <?php endforeach; ?>
154
  <?php endif; ?>
155
  <div id="cr_import">
156
+ <button type="button" class="scalable" onclick="synchronizeData()" style=""><span><span><span><?php echo Mage::helper("crconnect")->__('Synchronize data with CleverReach') ?></span></span></span></button>
157
+ &nbsp;&nbsp;&nbsp;&nbsp;<?php echo Mage::helper("crconnect")->__('Warning: Please wait untill the synchronization is finished. Depending on the amount of data this might take a while.') ?>
158
  </div>
159
+ <?php else: ?>
160
+ <button type="button" class="scalable" onclick="document.location.assign('<?php echo $this->getUrl('adminhtml/system_config/edit', array('section' => 'crroot')) ?>')" style=""><span><span><span><?php echo Mage::helper("crconnect")->__('CleverReach extension configuration') ?></span></span></span></button>
161
+ <?php endif; ?>
app/design/adminhtml/default/default/template/crconnect/system/config/form/field/cr_array_groups.phtml CHANGED
@@ -41,148 +41,122 @@ function callRowDelete(id){
41
  </div>
42
  <script type="text/javascript">
43
  // <!--
44
- var editedSelects = new Array();
45
- var stringElements = new Array();
46
- <?php foreach ($this->_columns as $columnName => $column): ?>
47
- stringElements['<?php echo $columnName; ?>'] = '<?php echo $this->_renderCellTemplate($columnName) ?>';
48
- <?php endforeach; ?>
 
 
49
  var rowTemplate = "";
50
- function initRowTemplate(){
51
- rowTemplate = new Template(
52
- '<tr id="#{_id}" class="simple-added-row">'
53
- <?php foreach ($this->_columns as $columnName => $column): ?>
 
54
  + '<td class="#{_id}-<?php echo $columnName ?>">'
55
- + stringElements['<?php echo $columnName; ?>']
56
- + '</td>'
57
- <?php endforeach; ?>
58
- <?php if ($this->_addAfter): ?>
59
  + '<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></button></td>'
60
- <?php endif; ?>
61
- + '<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></button></td>'
62
- + '</tr>'
63
- );
64
- }
65
  initRowTemplate();
66
- // create row creator
67
- var arrayRow<?php echo $_htmlId ?> = {
68
- // define row prototypeJS template
69
- template : new Template(
70
- '<tr id="#{_id}" class="simple-added-row">'
71
- <?php foreach ($this->_columns as $columnName => $column): ?>
72
- + '<td class="#{_id}-<?php echo $columnName ?>">'
73
- + stringElements['<?php echo $columnName; ?>']
74
- + '</td>'
75
- <?php endforeach; ?>
76
- <?php if ($this->_addAfter): ?>
77
- + '<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></button></td>'
78
- <?php endif; ?>
79
- + '<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></button></td>'
80
- + '</tr>'
81
- ),
82
- rowsCount : 0,
83
- add : function(templateData, insertAfterId)
84
- {
85
- // generate default template data
86
- if ('' == templateData) {
87
- var d = new Date();
88
- var templateData = {
89
- <?php foreach ($this->_columns as $columnName => $column): ?>
90
- <?php echo $columnName ?> : '',
91
- <?php endforeach; ?>
92
- _id : '_' + d.getTime() + '_' + d.getMilliseconds()
93
- };
94
- }
95
-
96
 
97
- // insert before last row
98
- if ('' == insertAfterId) {
99
- new Insertion.Before(
100
- $('addRow<?php echo $_htmlId ?>'),
101
- rowTemplate.evaluate(templateData)
102
- );
103
- }
104
- // insert after specified row
105
- else {
106
- new Insertion.After(
107
- $(insertAfterId),
108
- rowTemplate.evaluate(templateData)
109
- );
110
- }
111
- // set the selected drop-down list item
112
- <?php foreach ($this->_columns as $columnName => $column): ?>
113
- var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName ?>' + ' option')
114
- for (var index = 0; index < options.length; ++index)
115
- {
116
- var option = options[index]
117
- if (option.getAttribute('value') == templateData.<?php echo $columnName ?>)
118
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  option.selected = true
120
- <?php if ($columnName == "crconnect"): ?>
121
- editedSelects.push(templateData._id);
122
- // Event.observe(window, 'load', Crconnect.changeSubGroup($(templateData._id+"_crconnect")));
123
- <?php endif; ?>
124
- }
125
- }
126
- <?php endforeach; ?>
127
-
128
- <?php if ($this->_addAfter): ?>
129
- Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
130
- <?php endif; ?>
131
-
132
- this.rowsCount += 1;
133
- },
134
- del : function(rowId)
135
- {
136
- $(rowId).remove();
137
- this.rowsCount -= 1;
138
- if (0 == this.rowsCount) {
139
- this.showButtonOnly();
140
- }
141
- },
142
- showButtonOnly : function()
143
- {
144
- $('grid<?php echo $_htmlId ?>').hide();
145
- $('empty<?php echo $_htmlId ?>').show();
146
  }
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
-
149
- // bind add action to "Add" button in last row
150
- //Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
151
-
152
- // add existing rows
153
- <?php
154
- $_addAfterId = "headings{$_htmlId}";
155
- foreach ($this->getArrayRows() as $_rowId => $_row) {
156
- echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
157
- /* print "%%%%%%%%%%%%%%%";
158
- print_r($_row->toJson()); */
159
- $_addAfterId = $_rowId;
160
- }
161
- ?>
162
-
163
- function emptyAction(){
164
-
165
- $('grid<?php echo $_htmlId ?>').show();
166
- $('empty<?php echo $_htmlId ?>').hide();
167
- arrayRow<?php echo $_htmlId ?>.add('', '');
168
  }
169
-
170
- // initialize standalone button
171
  $('empty<?php echo $_htmlId ?>').hide();
172
- //Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
173
- // $('grid<?php echo $_htmlId ?>').show();
174
- // $('empty<?php echo $_htmlId ?>').hide();
175
- // arrayRow<?php echo $_htmlId ?>.add('', '');
176
- //});
177
-
178
- // if no rows, hide grid and show button only
179
- <?php if (!$this->getArrayRows()): ?>
180
- arrayRow<?php echo $_htmlId ?>.showButtonOnly();
181
- <?php endif; ?>
182
-
183
- // toggle the grid, if element is disabled (depending on scope)
184
- <?php if ($this->getElement()->getDisabled()): ?>
185
- toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
186
- <?php endif; ?>
187
  // -->
188
- </script>
41
  </div>
42
  <script type="text/javascript">
43
  // <!--
44
+ var crconnectElements = {
45
+ editedSelects: new Array(),
46
+ stringElements: new Array()
47
+ };
48
+ <?php foreach ($this->_columns as $columnName => $column): ?>
49
+ crconnectElements.stringElements['<?php echo $columnName; ?>'] = '<?php echo $this->_renderCellTemplate($columnName) ?>';
50
+ <?php endforeach; ?>
51
  var rowTemplate = "";
52
+ function initRowTemplate()
53
+ {
54
+ rowTemplate = new Template(
55
+ '<tr id="#{_id}" class="simple-added-row">'
56
+ <?php foreach ($this->_columns as $columnName => $column): ?>
57
  + '<td class="#{_id}-<?php echo $columnName ?>">'
58
+ + crconnectElements.stringElements['<?php echo $columnName; ?>']
59
+ + '</td>'
60
+ <?php endforeach; ?>
61
+ <?php if ($this->_addAfter): ?>
62
  + '<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></button></td>'
63
+ <?php endif; ?>
64
+ + '<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></button></td>'
65
+ + '</tr>'
66
+ );
67
+ }
68
  initRowTemplate();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
+ var arrayRow<?php echo $_htmlId ?> = {
71
+ template : new Template(
72
+ '<tr id="#{_id}" class="simple-added-row">'
73
+ <?php foreach ($this->_columns as $columnName => $column): ?>
74
+ + '<td class="#{_id}-<?php echo $columnName ?>">'
75
+ + crconnectElements.stringElements['<?php echo $columnName; ?>']
76
+ + '</td>'
77
+ <?php endforeach; ?>
78
+ <?php if ($this->_addAfter): ?>
79
+ + '<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></button></td>'
80
+ <?php endif; ?>
81
+ + '<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></button></td>'
82
+ + '</tr>'
83
+ ),
84
+ rowsCount: 0,
85
+ add: function(templateData, insertAfterId) {
86
+ // generate default template data
87
+ if ('' == templateData) {
88
+ var d = new Date();
89
+ var templateData = {
90
+ <?php foreach ($this->_columns as $columnName => $column): ?>
91
+ <?php echo $columnName ?> : '',
92
+ <?php endforeach; ?>
93
+ _id : '_' + d.getTime() + '_' + d.getMilliseconds()
94
+ };
95
+ }
96
+ if ('' == insertAfterId) {
97
+ new Insertion.Before(
98
+ $('addRow<?php echo $_htmlId ?>'),
99
+ rowTemplate.evaluate(templateData)
100
+ );
101
+ } else {
102
+ new Insertion.After(
103
+ $(insertAfterId),
104
+ rowTemplate.evaluate(templateData)
105
+ );
106
+ }
107
+ <?php foreach ($this->_columns as $columnName => $column): ?>
108
+ var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName ?>' + ' option')
109
+ for (var index = 0; index < options.length; ++index) {
110
+ var option = options[index]
111
+ if (option.getAttribute('value') == templateData.<?php echo $columnName ?>) {
112
  option.selected = true
113
+ <?php if ($columnName == "crconnect"): ?>
114
+ crconnectElements.editedSelects.push(templateData._id);
115
+ <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
117
+ }
118
+ <?php endforeach; ?>
119
+ <?php if ($this->_addAfter): ?>
120
+ Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
121
+ <?php endif; ?>
122
+ this.rowsCount += 1;
123
+ },
124
+ del: function(rowId) {
125
+ $(rowId).remove();
126
+ this.rowsCount -= 1;
127
+ if (0 == this.rowsCount) {
128
+ this.showButtonOnly();
129
  }
130
+ },
131
+ showButtonOnly: function() {
132
+ $('grid<?php echo $_htmlId ?>').hide();
133
+ $('empty<?php echo $_htmlId ?>').show();
134
+ }
135
+ }
136
+ <?php
137
+ $_addAfterId = "headings{$_htmlId}";
138
+ foreach ($this->getArrayRows() as $_rowId => $_row) {
139
+ echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
140
+ $_addAfterId = $_rowId;
141
+ }
142
+ ?>
143
+ function emptyAction()
144
+ {
145
+ $('grid<?php echo $_htmlId ?>').show();
146
+ $('empty<?php echo $_htmlId ?>').hide();
147
+ arrayRow<?php echo $_htmlId ?>.add('', '');
 
 
148
  }
 
 
149
  $('empty<?php echo $_htmlId ?>').hide();
150
+ //Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
151
+ // $('grid<?php echo $_htmlId ?>').show();
152
+ // $('empty<?php echo $_htmlId ?>').hide();
153
+ // arrayRow<?php echo $_htmlId ?>.add('', '');
154
+ //});
155
+ <?php if (!$this->getArrayRows()): ?>
156
+ arrayRow<?php echo $_htmlId ?>.showButtonOnly();
157
+ <?php endif; ?>
158
+ <?php if ($this->getElement()->getDisabled()): ?>
159
+ toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
160
+ <?php endif; ?>
 
 
 
 
161
  // -->
162
+ </script>
app/design/frontend/base/default/layout/crconnect.xml CHANGED
@@ -2,8 +2,8 @@
2
  <layout version="0.1.0">
3
 
4
  <newsletter_manage_index translate="label">
5
- <label>Customer My Account Newsletter Subscriptions</label>
6
  <reference name="my.account.wrapper">
 
7
  <block type="crconnect/customer_newsletter" name="customer_newsletter" template="crconnect/customer/form/newsletter.phtml">
8
  <block type="page/html_wrapper" name="customer.newsletter.form.before" as="form_before" translate="label">
9
  <label>Newsletter Subscription Form Before</label>
@@ -13,21 +13,14 @@
13
  </reference>
14
  </newsletter_manage_index>
15
 
16
- <customer_account_index translate="label">
17
- <label>Customer My Account Dashboard</label>
18
- <!-- Mage_Customer -->
19
- <reference name="root">
20
- <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
21
- </reference>
22
- <reference name="my.account.wrapper">
23
- <block type="customer/account_dashboard" name="customer_account_dashboard" template="customer/account/dashboard.phtml">
24
- <block type="customer/account_dashboard_hello" name="customer_account_dashboard_hello" as="hello" template="customer/account/dashboard/hello.phtml"/>
25
- <block type="core/template" name="customer_account_dashboard_top" as="top" />
26
- <block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="crconnect/customer/account/dashboard/info.phtml"/>
27
- <block type="customer/account_dashboard_newsletter" name="customer_account_dashboard_newsletter" as="newsletter" template="customer/account/dashboard/newsletter.phtml"/>
28
- <block type="customer/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/>
29
- </block>
30
  </reference>
 
31
  </customer_account_index>
32
 
33
  </layout>
2
  <layout version="0.1.0">
3
 
4
  <newsletter_manage_index translate="label">
 
5
  <reference name="my.account.wrapper">
6
+ <!-- @TODO: refactor subscription model/block so we can use magento default -->
7
  <block type="crconnect/customer_newsletter" name="customer_newsletter" template="crconnect/customer/form/newsletter.phtml">
8
  <block type="page/html_wrapper" name="customer.newsletter.form.before" as="form_before" translate="label">
9
  <label>Newsletter Subscription Form Before</label>
13
  </reference>
14
  </newsletter_manage_index>
15
 
16
+ <customer_account_index>
17
+ <!-- @TODO: refactor subscription model so we can use default template -->
18
+ <reference name="customer_account_dashboard_info">
19
+ <action method="setTemplate">
20
+ <template>crconnect/customer/account/dashboard/info.phtml</template>
21
+ </action>
 
 
 
 
 
 
 
 
22
  </reference>
23
+
24
  </customer_account_index>
25
 
26
  </layout>
app/etc/modules/Conlabz_CrConnect.xml CHANGED
@@ -4,6 +4,9 @@
4
  <Conlabz_CrConnect>
5
  <active>true</active>
6
  <codePool>community</codePool>
 
 
 
7
  </Conlabz_CrConnect>
8
  </modules>
9
- </config>
4
  <Conlabz_CrConnect>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <depends>
8
+ <Mage_Newsletter />
9
+ </depends>
10
  </Conlabz_CrConnect>
11
  </modules>
12
+ </config>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Conlabz_CrConnect</name>
4
- <version>3.1.4</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Synchronizes your Magento subscribers, customers and sales with CleverReach Email Marketing Software.</summary>
10
  <description>With CleverReach (http://www.cleverreach.de) you can create professional emails online, dispatch them reliably, track their success and manage receivers. &#xFEFF;&#xFEFF;&#xFEFF;CleverReach&#xFEFF;&#xFEFF;&#xFEFF; is equipped with a particularly user-friendly interface, which you can use intuitively and without special knowledge.</description>
11
- <notes>Stability Improvements</notes>
12
  <authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
13
- <date>2016-01-25</date>
14
- <time>08:45:32</time>
15
- <contents><target name="magecommunity"><dir name="Conlabz"><dir name="CrConnect"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Newsletter.php" hash="ff47d3028a8e766077ee78affd52eea6"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="e1b516bc593a41bcc6d00b259776c8b8"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="da3907dba74081f724f23b7a6b6df255"/><file name="Key.php" hash="44c2fc49a5b97cdacec1cada7a256a88"/><file name="Url.php" hash="becf4140ce0997e95548b758d8b7ed68"/></dir><dir name="Customer"><file name="Newsletter.php" hash="b24e73f404a338e079854ca565a1f042"/></dir><file name="Groupsapis.php" hash="f20a158b439469cdd498b16cc459ab4a"/></dir><dir name="Helper"><file name="Data.php" hash="9f44473c621458480a723c1efa929105"/></dir><dir name="Model"><file name="Api.php" hash="040c50b65ddc04540ea994ff1bacd678"/><dir name="Checkout"><file name="Observer.php" hash="0daf2d1dba169f72bbea827556cf0a76"/></dir><dir name="Customer"><file name="Observer.php" hash="878370bd5958b3813f0b90f395b27ecf"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="96e4b452bf916d5afa209cb80192eba0"/></dir><file name="Observer.php" hash="b6dfa6eacb7da5b073dc68d0f5d953ca"/><file name="Search.php" hash="26cd428e4b7ae5222a1de5186ad1ab54"/><file name="Subscriber.php" hash="4c916fa47576f0b02f68846a98e38f80"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EmptyForms.php" hash="910b9588b11edf73be1fc0103e49b997"/><file name="EmptyList.php" hash="6fe676d12ff5fa9231c3b0869b1ec750"/></dir></dir></dir><dir name="Website"><file name="Observer.php" hash="6c068fc61ae6ed512cbdce2a28f48cb7"/></dir></dir><dir name="controllers"><file name="AccountController.php" hash="86f79b2accced4b5dff847f855b46de9"/><dir name="Adminhtml"><file name="ConfigController.php" hash="1ceec04c5eda41140a00eee2de2971a4"/><file name="CrconnectController.php" hash="1136640545274b3bb6caa1451c625ee8"/></dir><file name="HookController.php" hash="2267000f03000c5696693b822a7054a0"/><file name="ManageController.php" hash="169191283031e6d0bc671e7bb88c6e30"/><file name="SearchController.php" hash="5ea211a82fd7239aaf8e3e7b78968d94"/><file name="SubscriberController.php" hash="2d1786f171f3fdf92ec839ba7bbc82b4"/><file name="UnsubscribeController.php" hash="06179908a7834597d6410f47f5868a98"/></dir><dir name="etc"><file name="adminhtml.xml" hash="05f8a5b43c8abe877f05e09eec5d8c65"/><file name="config.xml" hash="f9bc53c474b849311de20f30a39a2022"/><file name="system.xml" hash="634952e319523e7640152ddaeedeaef9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Conlabz_CrConnect.xml" hash="282358cc102bf617b7d5afcaa47ec489"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="956fea6e3eb0e98fc6bbcc7241f9123e"/></dir><dir name="template"><dir name="crconnect"><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="a533451e27b90284d3414e391b460231"/></dir></dir><dir name="form"><file name="newsletter.phtml" hash="4a1309d0d6d2587c8534dd4a1ccdf235"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="1185a92ac6c2117d5e440f709d0eca24"/></dir><dir name="template"><dir name="crconnect"><dir name="config"><file name="header.phtml" hash="727bc6a2a9b67c1e5819faa91c06ffd3"/></dir><dir name="newsletter"><dir name="subscriber"><file name="list.phtml" hash="94952fb1921397c4ad33387d8387c463"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_groups.phtml" hash="ac84db9b1e8b342337a478ecba62e0b1"/><file name="cr_array_groups.phtml" hash="d2f70aa406d8b15f819481acbf0ccbee"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Conlabz_CleverReach.csv" hash="4cb844c7288d9995d21d39eb4015fa44"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="cleverreach"><file name="cleverreach-logo.png" hash="bff60f831ca9e1dc9bcbdb2e3f5a5805"/></dir></dir><dir name="js"><file name="crconnect.js" hash="72c951b0b46862253c7159255d82b2e0"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Conlabz_CrConnect</name>
4
+ <version>3.1.5</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Synchronizes your Magento subscribers, customers and sales with CleverReach Email Marketing Software.</summary>
10
  <description>With CleverReach (http://www.cleverreach.de) you can create professional emails online, dispatch them reliably, track their success and manage receivers. &#xFEFF;&#xFEFF;&#xFEFF;CleverReach&#xFEFF;&#xFEFF;&#xFEFF; is equipped with a particularly user-friendly interface, which you can use intuitively and without special knowledge.</description>
11
+ <notes>Bugfix: Customer registration as newsletter subscriber</notes>
12
  <authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
13
+ <date>2016-04-08</date>
14
+ <time>07:42:30</time>
15
+ <contents><target name="magecommunity"><dir name="Conlabz"><dir name="CrConnect"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Newsletter.php" hash="ff47d3028a8e766077ee78affd52eea6"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="e1b516bc593a41bcc6d00b259776c8b8"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="da3907dba74081f724f23b7a6b6df255"/><file name="Key.php" hash="44c2fc49a5b97cdacec1cada7a256a88"/><file name="Url.php" hash="becf4140ce0997e95548b758d8b7ed68"/></dir><dir name="Customer"><file name="Newsletter.php" hash="1acc2f35d1c67e8e15640c3117a00dfd"/></dir><file name="Groupsapis.php" hash="f20a158b439469cdd498b16cc459ab4a"/></dir><dir name="Helper"><file name="Data.php" hash="9e9584f6771982ee8eba5a59155d02dd"/></dir><dir name="Model"><file name="Api.php" hash="6c020a734db38132ce7016e560427671"/><dir name="Checkout"><file name="Observer.php" hash="8fd916c7332ce6ebfa9197666c2987a9"/></dir><dir name="Customer"><file name="Observer.php" hash="878370bd5958b3813f0b90f395b27ecf"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="96e4b452bf916d5afa209cb80192eba0"/></dir><file name="Observer.php" hash="2483f2c0d3667f80f8d87c6d8b6908ba"/><file name="Search.php" hash="5419d8b49f901e2d28eff3d57ae9de4f"/><file name="Subscriber.php" hash="3e3698a40f540a038ad4dc56e1975070"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EmptyForms.php" hash="910b9588b11edf73be1fc0103e49b997"/><file name="EmptyList.php" hash="6fe676d12ff5fa9231c3b0869b1ec750"/></dir></dir></dir><dir name="Website"><file name="Observer.php" hash="6c068fc61ae6ed512cbdce2a28f48cb7"/></dir></dir><dir name="Test"><dir name="Config"><file name="ActivationXml.php" hash="0270720ffc36ea493b9c976377bdfdcd"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CrconfigController.php" hash="5d60907f68efc7722e8c3ca1426ef2f3"/><file name="CrconnectController.php" hash="fa3cb1d4f515cabd0e378715258db203"/></dir><file name="HookController.php" hash="2c81dd3ebd9310ca86afc732b2e2d1c6"/><file name="ManageController.php" hash="12ff08a154cb21dc0fe4fed3cd718d1c"/><file name="SearchController.php" hash="0141ec8a414c86619ff63c6a856af470"/><file name="SubscriberController.php" hash="3bbf81a698e630d4a04f638a53ecd3e9"/><file name="UnsubscribeController.php" hash="eaba3ee3bef995d4bb6f7e17b1709585"/></dir><dir name="etc"><file name="adminhtml.xml" hash="05f8a5b43c8abe877f05e09eec5d8c65"/><file name="config.xml" hash="93eceb6388a095be99954874f6912558"/><file name="jstranslator.xml" hash="040e5e790dcae18ddf223d54e38e45b0"/><file name="system.xml" hash="634952e319523e7640152ddaeedeaef9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Conlabz_CrConnect.xml" hash="dd6482e7f0daedb3387e80bdff66f321"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="dd115195559fe2058fbd6fbdceabdddc"/></dir><dir name="template"><dir name="crconnect"><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="a533451e27b90284d3414e391b460231"/></dir></dir><dir name="form"><file name="newsletter.phtml" hash="4a1309d0d6d2587c8534dd4a1ccdf235"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="fac2e1194c8c007a54abfe3e82fd6834"/></dir><dir name="template"><dir name="crconnect"><file name="config.phtml" hash="9f2232c8311fa439434d8023181a7ab5"/><dir name="newsletter"><dir name="subscriber"><file name="list.phtml" hash="2d7dd105e2c543d19746ada03fa54ff8"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_groups.phtml" hash="ac84db9b1e8b342337a478ecba62e0b1"/><file name="cr_array_groups.phtml" hash="c924ef81c5699817327580eb7b8a2e86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Conlabz_CleverReach.csv" hash="4cb844c7288d9995d21d39eb4015fa44"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="cleverreach"><file name="cleverreach-logo.png" hash="bff60f831ca9e1dc9bcbdb2e3f5a5805"/></dir></dir><dir name="js"><file name="crconnect.js" hash="72c951b0b46862253c7159255d82b2e0"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>