Conlabz_CrConnect - Version 3.0.3

Version Notes

Export customer information to CR during init synchronization

Download this release

Release Info

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


Code changes from version 3.0.2 to 3.0.3

CleverReachDocumentation.docx DELETED
Binary file
CleverReachDocumentationGerman.docx DELETED
Binary file
app/code/community/Conlabz/CrConnect/.DS_Store ADDED
Binary file
app/code/community/Conlabz/CrConnect/Block/Groupsapis.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- class Conlabz_CrConnect_Block_GroupsApis extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
3
- {
4
- protected $magentoOptions;
5
-
6
- public function __construct()
7
- {
8
- $this->addColumn('magento', array(
9
- 'label' => Mage::helper('adminhtml')->__('Magento user groups'),
10
- 'size' => 28,
11
- ));
12
- $this->addColumn('crconnect', array(
13
- 'label' => Mage::helper('adminhtml')->__('CrConnect group API key'),
14
- 'size' => 28
15
- ));
16
- $this->_addAfter = false;
17
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add API keys for group');
18
-
19
- parent::__construct();
20
- $this->setTemplate('crconnect/system/config/form/field/array_groups.phtml');
21
-
22
- // customer options
23
- $this->magentoOptions = array();
24
- $allGroups = Mage::getModel('customer/group')->getCollection()->toOptionHash();
25
- foreach($allGroups as $key=>$allGroup){
26
- $this->magentoOptions[$key] = $allGroup;
27
- }
28
-
29
- }
30
-
31
- protected function _renderCellTemplate($columnName)
32
- {
33
- if (empty($this->_columns[$columnName])) {
34
- throw new Exception('Wrong column name specified.');
35
- }
36
- $column = $this->_columns[$columnName];
37
- $inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
38
-
39
- if($columnName == 'magento')
40
- {
41
- $rendered = '<select name="'.$inputName.'">';
42
- foreach($this->magentoOptions as $att => $name)
43
- {
44
- $rendered .= '<option value="'.$att.'">'.$name.'</option>';
45
- }
46
- $rendered .= '</select>';
47
- }
48
- else
49
- {
50
- return '<input type="text" name="' . $inputName . '" value="#{' . $columnName . '}" ' . ($column['size'] ? 'size="' . $column['size'] . '"' : '') . '/>';
51
- }
52
-
53
- return $rendered;
54
- }
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/Model/Api.php CHANGED
@@ -488,8 +488,6 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract {
488
 
489
  $userGroup = 0;
490
 
491
- $tmp["email"] = "";
492
-
493
  // If we should separate customers to different groups, then get customer Groups iD if exists
494
  if ($this->_helper->isSeparationEnabled()) {
495
  if ($subscriber["subscriber_email"]) {
@@ -500,17 +498,24 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract {
500
  }
501
  }
502
  }
503
- $tmp["email"] = $subscriber["subscriber_email"];
504
- $tmp["source"] = "MAGENTO";
505
-
506
-
507
- // Prepare customer attributes
508
- $tmp["attributes"] = array(
509
- 0 => array("key" => "firstname", "value" => @$subscriber["customer_firstname"]),
510
- 1 => array("key" => "lastname", "value" => @$subscriber["customer_lastname"]),
511
- 2 => array("key" => "newsletter", "value" => "1")
512
- );
513
-
 
 
 
 
 
 
 
514
  // Separate users by Batch, 25 users in one
515
  if ($tmp["email"]) {
516
  $batch[$subscriber["store_id"]][$userGroup][floor($i++ / 25)][] = $tmp; //max 25 per batch
488
 
489
  $userGroup = 0;
490
 
 
 
491
  // If we should separate customers to different groups, then get customer Groups iD if exists
492
  if ($this->_helper->isSeparationEnabled()) {
493
  if ($subscriber["subscriber_email"]) {
498
  }
499
  }
500
  }
501
+
502
+
503
+ if (isset($subscriber['customer_id']) && $subscriber['customer_id']){
504
+ $tmp = $this->_helper->prepareUserdata(Mage::getModel("customer/customer")->load($subscriber['customer_id']));
505
+ }else{
506
+
507
+ $tmp["email"] = $subscriber["subscriber_email"];
508
+ $tmp["source"] = "MAGENTO";
509
+
510
+ // Prepare customer attributes
511
+ $tmp["attributes"] = array(
512
+ 0 => array("key" => "firstname", "value" => @$subscriber["customer_firstname"]),
513
+ 1 => array("key" => "lastname", "value" => @$subscriber["customer_lastname"]),
514
+ 2 => array("key" => "newsletter", "value" => "1")
515
+ );
516
+
517
+ }
518
+
519
  // Separate users by Batch, 25 users in one
520
  if ($tmp["email"]) {
521
  $batch[$subscriber["store_id"]][$userGroup][floor($i++ / 25)][] = $tmp; //max 25 per batch
app/code/community/Conlabz/CrConnect/Model/Checkout/Observer.php DELETED
@@ -1,175 +0,0 @@
1
- <?php
2
- /**
3
- * Conlabz GmbH
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com and you will be sent a copy immediately.
14
- *
15
- * @category CleverReach
16
- * @package Conlabz_CrConnect
17
- * @copyright Copyright (c) 2012 Conlabz GmbH (http://www.conlabz.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
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{
36
- $lastOrderId = false;
37
- Mage::log("CleverReach_CrConnect: order sycing deactivated");
38
- }
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
- {
47
- $subscribed = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed();
48
- }
49
-
50
- if($subscribed){
51
- $add = array("newsletter" => "1");
52
- }else{
53
- $add = array("newsletter" => "0");
54
- }
55
-
56
- $email = $order->getCustomerEmail();
57
-
58
- if($email){
59
- if($customer->getEmail()){
60
- $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, $add, false);
61
- }else{
62
- $shippingAddress = $order->getBillingAddress()->getData();
63
- if($shippingAddress){
64
- $crReceiver = array (
65
- 'email' => $email,
66
- //'registered' => strtotime($shippingAddress["created_at"]),
67
- //'activated' => strtotime($shippingAddress["updated_at"]),
68
- 'source' => 'MAGENTO',
69
- 'attributes' => array(0 => array("key" => "firstname", "value" => @$shippingAddress["firstname"]),
70
- 1 => array("key" => "lastname", "value" => @$shippingAddress["lastname"]),
71
- 2 => array("key" => "street", "value" => @$shippingAddress["street"]),
72
- 3 => array("key" => "zip", "value" => @$shippingAddress["postcode"]),
73
- 4 => array("key" => "city", "value" => @$shippingAddress["city"]),
74
- 5 => array("key" => "country", "value" => @$shippingAddress["country_id"]),
75
- 6 => array("key" => "salutation", "value" => @$shippingAddress["prefix"]),
76
- 7 => array("key" => "title", "value" => @$shippingAddress["suffix"]),
77
- 8 => array("key" => "company", "value" => @$shippingAddress["company"]))
78
- );
79
-
80
- $cookie = Mage::getSingleton('core/cookie');
81
- if ($cookie->get('crmailing')){
82
- $crReceiver['orders'][0]['mailings_id'] = $cookie->get('crmailing');
83
- }
84
-
85
- if($subscribed){
86
- $crReceiver["attributes"][] = array("key" => 'newsletter', "value" => "1");
87
- }
88
- }
89
- }
90
- }
91
-
92
- }
93
-
94
- if($apiKey && $listID && $email && $lastOrderId && $syncOrders)
95
- {
96
-
97
- try {
98
- $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
99
- } catch(Exception $e) {
100
- Mage::log("CleverReach_CrConnect: Error connecting to CleverReach server: ".$e->getMessage());
101
- }
102
-
103
- /* ########################### */
104
- if($crReceiver)
105
- {
106
- try {
107
- $tmp = $crReceiver;
108
- $addTxt="keeping status";
109
- //if new users should be activated by default. do it
110
- if($syncOrderStatus){
111
- $tmp["deactivated"] = 0;
112
- $addTxt = "forced active";
113
- }
114
-
115
- // Get keys for different user groups
116
- if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1'){
117
- $groupKeys = Mage::helper('crconnect')->getKeys();
118
- if ($groupId = $customer->getGroupId()){
119
- if (isset($groupKeys[$groupId])){
120
- $return = $client->receiverAdd($apiKey, $groupKeys[$groupId], $tmp);
121
- }
122
- }
123
- }else{
124
- $return = $client->receiverAdd($apiKey, $listID, $tmp);
125
- }
126
-
127
- if($return->status=="SUCCESS"){
128
- Mage::log("CleverReach_CrConnect: subscribed ($addTxt) - ".$crReceiver["email"]);
129
- }else{
130
- if($return->statuscode=="50"){ //seems to exists allready, try update
131
- $return = $client->receiverUpdate($apiKey, $listID, $tmp);
132
- if(!$return->status=="SUCCESS"){
133
- Mage::log("CleverReach_CrConnect: order insert error - ".$return->message);
134
- }else{
135
- Mage::log("CleverReach_CrConnect: resubscribed ($addTxt) - ".$crReceiver["email"]);
136
- }
137
- }else{
138
- Mage::log("CleverReach_CrConnect: error - ".$return->message);
139
- }
140
- }
141
- } catch(Exception $e) {
142
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
143
- }
144
- }
145
-
146
- /* ########################### */
147
-
148
- $items = $order->getAllItems();
149
- if($items)foreach ($items as $item){
150
-
151
- $tmpItem = array();
152
- $tmpItem["order_id"] = $lastOrderId;
153
- $tmpItem["product"] = $item->getName();
154
- $tmpItem["product_id"] = $item->getProductId();
155
- $tmpItem["price"] = round($item->getPrice(),2);
156
- $tmpItem["quantity"] = (integer)$item->getQtyOrdered();
157
- $tmpItem["purchase_date"] = time();
158
- $tmpItem["currency"] = $order->getData('order_currency_code');
159
- $tmpItem["source"] = "MAGENTO Order";
160
-
161
- $cookie = Mage::getSingleton('core/cookie');
162
- if ($cookie->get('crmailing')){
163
- $tmpItem['mailings_id'] = $cookie->get('crmailing');
164
- }
165
-
166
- $tmp = $client->receiverAddOrder($apiKey, $listID, $email, $tmpItem);
167
- if($tmp->status!="SUCCESS"){
168
- Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
169
- }else{
170
- Mage::log("CleverReach_CrConnect: submitted: ".$tmpItem["order_id"]." - ".$tmpItem["product"]);
171
- }
172
- }
173
- }
174
- }
175
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/Model/Customer/Observer.php DELETED
@@ -1,243 +0,0 @@
1
- <?php
2
- /**
3
- * Conlabz GmbH
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com and you will be sent a copy immediately.
14
- *
15
- * @category CleverReach
16
- * @package Conlabz_CrConnect
17
- * @copyright Copyright (c) 2012 Conlabz GmbH (http://conlabz.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- class SubscriberCustomField
22
- {
23
- function SubscriberCustomField($k, $v)
24
- {
25
- $this->Key = $k;
26
- $this->Value = $v;
27
- }
28
- }
29
-
30
- class Conlabz_CrConnect_Model_Customer_Observer
31
- {
32
- public function session_init($observer)
33
- {
34
-
35
- $mailingId = Mage::getSingleton('core/app')->getRequest()->getParam('crmailing');
36
- $cookie = Mage::getSingleton('core/cookie');
37
- if ($mailingId){
38
- $cookie->set('crmailing', $mailingId ,time()+3600*24*14,'/');
39
- }
40
- $customerId = Mage::getSingleton('core/app')->getRequest()->getParam('crcustomer');
41
- $cookie = Mage::getSingleton('core/cookie');
42
- if ($customerId){
43
- $cookie->set('crcustomer', $customerId ,time()+3600*24*14,'/');
44
- }
45
-
46
- }
47
-
48
- public function check_subscription_status($observer)
49
- {
50
-
51
- $event = $observer->getEvent();
52
- $customer = $event->getCustomer();
53
-
54
- $apiKey = trim(Mage::getStoreConfig('crroot/crconnect/api_key'));
55
- $listID = trim(Mage::getStoreConfig('crroot/crconnect/list_id'));
56
-
57
- $name = $customer->getFirstname() . " " . $customer->getLastname();
58
- $newEmail = $customer->getEmail();
59
- $subscribed = $customer->getIsSubscribed();
60
-
61
- $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
62
-
63
- $shippingAddress = false;
64
- if($tmp = $customer->getDefaultBillingAddress())
65
- $shippingAddress = $tmp->getData();
66
-
67
-
68
- try {
69
- $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
70
- } catch(Exception $e) {
71
- Mage::log("CleverReach_CrConnect: Error connecting to CleverReach server: ".$e->getMessage());
72
- }
73
-
74
- $keys = Mage::helper('crconnect')->getKeys();
75
-
76
- $isCustomSubscribed = false;
77
- if (isset($keys[$groupId])){
78
- $isCustomSubscribed = Mage::helper('crconnect')->getSubscriber($newEmail, $groupId);
79
- }
80
-
81
- if ($isCustomSubscribed){
82
- if (isset($_POST['is_gsubscribed']) && $_POST['is_gsubscribed'] == 1){
83
-
84
- }else{
85
- try {
86
-
87
- $return = $client->receiverSetInactive($apiKey, $keys[$groupId], $newEmail);
88
-
89
- } catch(Exception $e) {
90
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
91
- return;
92
- }
93
- }
94
- }else{
95
-
96
- if (isset($_POST['is_gsubscribed']) && $_POST['is_gsubscribed'] == 1){
97
-
98
- $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, array('newsletter'=>1), true);
99
- $return = $client->receiverAdd($apiKey, $keys[$groupId], $crReceiver);
100
- if ($return->status == "ERROR"){
101
- if($return->statuscode=="50"){ //try update
102
- $crReceiver["deactivated"] = 0;
103
- $return = $client->receiverUpdate($apiKey, $keys[$groupId], $crReceiver);
104
- Mage::log("CleverReach_CrConnect:". $crReceiver["attributes"][1]["key"]);
105
- if(!$return->status=="SUCCESS"){
106
- Mage::log("CleverReach_CrConnect: resubscribe error - ".$return->message);
107
- }
108
- }
109
- }
110
-
111
- }
112
- }
113
-
114
- $oldEmail = Mage::getModel('customer/customer')->load($customer->getId())->getEmail();
115
-
116
- // if subscribed is NULL (i.e. because the form didn't set it one way
117
- // or the other), get the existing value from the database
118
-
119
- if($subscribed === NULL)
120
- {
121
- $subscribed = Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->isSubscribed();
122
- }
123
-
124
- if($apiKey and $listID)
125
- {
126
- if($subscribed)
127
- {
128
- $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, array('newsletter'=>1), true);
129
- Mage::log("CleverReach_CrConnect: Subscribing new email address (ob): $newEmail");
130
- try {
131
-
132
- // Get keys for different user groups
133
- if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1'){
134
- $groupKeys = Mage::helper('crconnect')->getKeys();
135
- if ($groupId = $customer->getGroupId()){
136
- if (isset($groupKeys[$groupId])){
137
- $return = $client->receiverSetInactive($apiKey, $listID, $crReceiver["email"]);
138
- $listID = $groupKeys[$groupId];
139
- }
140
- }
141
- }
142
- $return = $client->receiverAdd($apiKey, $listID, $crReceiver);
143
- if($return->status=="SUCCESS"){
144
- Mage::log("CleverReach_CrConnect: subscribed - ".$crReceiver["email"]);
145
- }else{
146
- if($return->statuscode=="50"){ //try update
147
- $crReceiver["deactivated"] = 0;
148
- $return = $client->receiverUpdate($apiKey, $listID, $crReceiver);
149
- Mage::log("CleverReach_CrConnect:". $crReceiver["attributes"][1]["key"]);
150
- if(!$return->status=="SUCCESS"){
151
- Mage::log("CleverReach_CrConnect: resubscribe error - ".$return->message);
152
- }
153
- }else{
154
- Mage::log("CleverReach_CrConnect: error - ".$return->message);
155
- }
156
- }
157
- } catch(Exception $e) {
158
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
159
- }
160
- }
161
- elseif($oldEmail)
162
- {
163
-
164
- Mage::log("CleverReach_CrConnect: Unsubscribing: $oldEmail");
165
- $crReceiver = Mage::helper('crconnect')->prepareUserdata($customer, array('newsletter'=>0), false);
166
- try {
167
- $return = $client->receiverSetInactive($apiKey, $listID, $crReceiver["email"]);
168
- if($return->status=="SUCCESS"){
169
- Mage::log("CleverReach_CrConnect: unsubscribed - ".$crReceiver["email"]);
170
-
171
- if($return->status == "SUCCESS"){
172
- Mage::log("CleverReach_CrConnect: updating newsletterflag");
173
- $client->receiverUpdate($apiKey, $listID, $crReceiver);
174
- }
175
- }else{ //call failed
176
- Mage::log("CleverReach_CrConnect: error - ".$return->message);
177
- }
178
- } catch(Exception $e) {
179
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
180
- }
181
- }
182
- }
183
- }
184
-
185
- public function customer_deleted($observer)
186
- {
187
-
188
- $event = $observer->getEvent();
189
- $customer = $event->getCustomer();
190
-
191
- $apiKey = trim(Mage::getStoreConfig('newsletter/crconnect/api_key'));
192
- $listID = trim(Mage::getStoreConfig('newsletter/crconnect/list_id'));
193
-
194
- $email = $customer->getEmail();
195
-
196
- $keys = Mage::helper('crconnect')->getKeys();
197
-
198
- $isCustomSubscribed = false;
199
- if (isset($keys[$customer->getGroupId()])){
200
- $isCustomSubscribed = Mage::helper('crconnect')->getSubscriber($email, $customer->getGroupId());
201
- }
202
-
203
- if($apiKey and $listID)
204
- {
205
- try {
206
- $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
207
- } catch(Exception $e) {
208
- Mage::log("CleverReach_CrConnect: Error connecting to server: ".$e->getMessage());
209
- }
210
-
211
- Mage::log("CleverReach_CrConnect: Customer deleted, unsubscribing: $email");
212
- try {
213
- $return = $client->receiverDelete($apiKey, $listID, $email);
214
- if($return->status=="SUCCESS"){
215
- Mage::log("CleverReach_CrConnect: deleted - ".$email);
216
- }else{ //call failed
217
- Mage::log("CleverReach_CrConnect: error - ".$return["message"]);
218
- }
219
-
220
- if ($isCustomSubscribed){
221
- $return = $client->receiverDelete($apiKey, $keys[$groupId], $email);
222
- if($return->status=="SUCCESS"){
223
- Mage::log("CleverReach_CrConnect: deleted - ".$email);
224
- }else{ //call failed
225
- Mage::log("CleverReach_CrConnect: error - ".$return["message"]);
226
- }
227
- }
228
-
229
- } catch(Exception $e) {
230
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
231
- }
232
- }
233
- }
234
-
235
-
236
- public function getIsSubscribed($observer){
237
- Mage::log("CleverReach_CrConnect: stat");
238
- //Mage_Customer_Block_Newsletter
239
- }
240
-
241
-
242
- }
243
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/Model/Observer.php CHANGED
@@ -22,14 +22,10 @@ class Conlabz_CrConnect_Model_Observer{
22
 
23
  $email = $customer->getEmail();
24
 
25
- Mage::getModel("crconnect/subscriber")->updateCustomer($customer);
26
-
27
  $subscriber = Mage::getModel("newsletter/subscriber")->loadByEmail($email);
28
  $subscriber->setEmail($email);
29
  if (Mage::app()->getStore()->isAdmin()){
30
  return true;
31
- // $website = Mage::getModel('core/website')->load($customer->getWebsiteId())->getCode();
32
- // Mage::getSingleton("adminhtml/session")->setCrCustomerWebsite($website);
33
  }
34
 
35
  $subscriptionCheckbox1 = Mage::app()->getRequest()->getParam('subscription');
@@ -79,8 +75,6 @@ class Conlabz_CrConnect_Model_Observer{
79
  }
80
 
81
  }
82
-
83
- // Mage::getSingleton("adminhtml/session")->unsCrCustomerWebsite();
84
 
85
  return true;
86
 
22
 
23
  $email = $customer->getEmail();
24
 
 
 
25
  $subscriber = Mage::getModel("newsletter/subscriber")->loadByEmail($email);
26
  $subscriber->setEmail($email);
27
  if (Mage::app()->getStore()->isAdmin()){
28
  return true;
 
 
29
  }
30
 
31
  $subscriptionCheckbox1 = Mage::app()->getRequest()->getParam('subscription');
75
  }
76
 
77
  }
 
 
78
 
79
  return true;
80
 
app/code/community/Conlabz/CrConnect/Model/Website/Observer.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- /**
3
- * Conlabz GmbH
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com and you will be sent a copy immediately.
14
- *
15
- * @category CleverReach
16
- * @package Conlanz_CrConnect
17
- * @copyright Copyright (c) 2012 Conlabz GmbH (http://conlabz.de)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
-
22
- class Conlabz_CrConnect_Model_Website_Observer
23
- {
24
- public function trackingCodeCheck(){
25
- $mailingId = Mage::getSingleton('core/app')->getRequest()->getParam('crmailing');
26
- $cookie = Mage::getSingleton('core/cookie');
27
- if ($mailingId){
28
- $cookie->set('crmailing', $mailingId ,time()+3600*24*14,'/');
29
- }
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/controllers/AccountController.php DELETED
@@ -1,149 +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
-
34
- $status = Mage::getModel("newsletter/subscriber")->subscribe($this->getRequest()->getPost('email'));
35
- if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
36
- Mage::getSingleton('customer/session')->addSuccess($this->__('Confirmation request has been sent.'));
37
- }
38
- else {
39
- Mage::getSingleton('customer/session')->addSuccess($this->__('Thank you for your subscription.'));
40
- }
41
-
42
- }else{
43
-
44
-
45
- if ($this->getRequest()->getParam('is_subscribed', false)) {
46
- $customer->setIsSubscribed(1);
47
- }
48
-
49
- }
50
- /**
51
- * Initialize customer group id
52
- */
53
- $customer->getGroupId();
54
-
55
- if ($this->getRequest()->getPost('create_address')) {
56
- /* @var $address Mage_Customer_Model_Address */
57
- $address = Mage::getModel('customer/address');
58
- /* @var $addressForm Mage_Customer_Model_Form */
59
- $addressForm = Mage::getModel('customer/form');
60
- $addressForm->setFormCode('customer_register_address')
61
- ->setEntity($address);
62
-
63
- $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
64
- $addressErrors = $addressForm->validateData($addressData);
65
- if ($addressErrors === true) {
66
- $address->setId(null)
67
- ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
68
- ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
69
- $addressForm->compactData($addressData);
70
- $customer->addAddress($address);
71
-
72
- $addressErrors = $address->validate();
73
- if (is_array($addressErrors)) {
74
- $errors = array_merge($errors, $addressErrors);
75
- }
76
- } else {
77
- $errors = array_merge($errors, $addressErrors);
78
- }
79
- }
80
-
81
- try {
82
- $customerErrors = $customerForm->validateData($customerData);
83
- if ($customerErrors !== true) {
84
- $errors = array_merge($customerErrors, $errors);
85
- } else {
86
- $customerForm->compactData($customerData);
87
- $customer->setPassword($this->getRequest()->getPost('password'));
88
- $customer->setConfirmation($this->getRequest()->getPost('confirmation'));
89
- $customerErrors = $customer->validate();
90
- if (is_array($customerErrors)) {
91
- $errors = array_merge($customerErrors, $errors);
92
- }
93
- }
94
-
95
- $validationResult = count($errors) == 0;
96
-
97
- if (true === $validationResult) {
98
- $customer->save();
99
-
100
- Mage::dispatchEvent('customer_register_success',
101
- array('account_controller' => $this, 'customer' => $customer)
102
- );
103
-
104
- if ($customer->isConfirmationRequired()) {
105
- $customer->sendNewAccountEmail(
106
- 'confirmation',
107
- $session->getBeforeAuthUrl(),
108
- Mage::app()->getStore()->getId()
109
- );
110
- $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())));
111
- $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
112
- return;
113
- } else {
114
- $session->setCustomerAsLoggedIn($customer);
115
- $url = $this->_welcomeCustomer($customer);
116
- $this->_redirectSuccess($url);
117
- return;
118
- }
119
- } else {
120
- $session->setCustomerFormData($this->getRequest()->getPost());
121
- if (is_array($errors)) {
122
- foreach ($errors as $errorMessage) {
123
- $session->addError($errorMessage);
124
- }
125
- } else {
126
- $session->addError($this->__('Invalid customer data'));
127
- }
128
- }
129
- } catch (Mage_Core_Exception $e) {
130
- $session->setCustomerFormData($this->getRequest()->getPost());
131
- if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
132
- $url = Mage::getUrl('customer/account/forgotpassword');
133
- $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);
134
- $session->setEscapeMessages(false);
135
- } else {
136
- $message = $e->getMessage();
137
- }
138
- $session->addError($message);
139
- } catch (Exception $e) {
140
- $session->setCustomerFormData($this->getRequest()->getPost())
141
- ->addException($e, $this->__('Cannot save the customer.'));
142
- }
143
- }
144
-
145
- $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
146
- }
147
-
148
-
149
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/controllers/HookController.php DELETED
@@ -1,176 +0,0 @@
1
- <?php
2
- /**
3
- * Conlabz GmbH
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com and you will be sent a copy immediately.
14
- *
15
- * @category CleverReach
16
- * @package Conlabz_CrConnect
17
- * @copyright Copyright (c) 2012 Conlabz GmbH (http://www.cleverreach.com)
18
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
- */
20
-
21
- include "Mage/Newsletter/controllers/SubscriberController.php";
22
-
23
- // Class that 'hooks' newsletter subscriptions from the frontend sign-up box.
24
- // This is necessary because the Mage_Newsletter_Model_Subscriber class
25
- // doesn't extend Mage_Core_Model_Abstract and so can't be observed directly.
26
- // Instead we redirect all requests for newsletter/subscriber to this
27
- // controller, which extends Mage_Newsletter_SubscriberController and
28
- // overrides the newAction method.
29
- class Conlabz_CrConnect_HookController extends Mage_Newsletter_SubscriberController {
30
-
31
- public function confirmAction()
32
- {
33
- $id = (int) $this->getRequest()->getParam('id');
34
- $code = (string) $this->getRequest()->getParam('code');
35
-
36
- if ($id && $code) {
37
- $subscriber = Mage::getModel('newsletter/subscriber')->load($id);
38
- $session = Mage::getSingleton('core/session');
39
-
40
- if($subscriber->getId() && $subscriber->getCode()) {
41
- if($subscriber->confirm($code)) {
42
-
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()){
54
-
55
- if (Mage::getStoreConfig('crroot/crconnect/showgroup') == '1'){
56
- $groupKeys = Mage::helper('crconnect')->getKeys();
57
- if ($groupId = $customer->getGroupId()){
58
- if (isset($groupKeys[$groupId])){
59
- $listID = $groupKeys[$groupId];
60
- }
61
- }
62
- }
63
-
64
- }
65
-
66
- try {
67
- $client = new SoapClient(Mage::helper('crconnect')->getWsdl(),
68
- array("trace" => true));
69
- } catch(Exception $e) {
70
- Mage::log("CleverReach_CrConnect: Error connecting to server: ".$e->getMessage());
71
- $session->addException($e, $this->__('There was a problem with the subscription'));
72
- $this->_redirectReferer();
73
- }
74
-
75
- try {
76
- $result = $client->receiverAdd($apiKey, $listID, array(
77
- "email" => $subscriber->getEmail(),
78
- "source" => "MAGENTO (frontend)",
79
- "attributes" => array("key" => "newsletter", "value" => "1"),
80
- )
81
- );
82
-
83
- if($result->status!="SUCCESS" && $result->statuscode == "50"){
84
-
85
- $result = $client->receiverUpdate($apiKey, $listID, array(
86
- "email" => $subscriber->getEmail(),
87
- "source" => "MAGENTO (frontend)",
88
- "attributes" => array("key" => "newsletter", "value" => "1"),
89
- "deactivated"=>0
90
- ));
91
-
92
- }
93
-
94
- } catch (Exception $e) {
95
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
96
- $session->addException($e, $this->__('Subscription was invalid'));
97
- $this->_redirectReferer();
98
- }
99
-
100
- parent::confirmAction();
101
- } else {
102
- $session->addError($this->__('Invalid subscription confirmation code'));
103
- }
104
- } else {
105
- $session->addError($this->__('Invalid subscription ID'));
106
- }
107
- }
108
-
109
- $this->_redirectUrl(Mage::getBaseUrl());
110
- }
111
-
112
-
113
- public function newAction() {
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) {
130
- Mage::log("CleverReach_CrConnect: Error connecting to server: ".$e->getMessage());
131
- $session->addException($e, $this->__('There was a problem with the subscription'));
132
- $this->_redirectReferer();
133
- }
134
-
135
-
136
- $customerHelper = Mage::helper('customer');
137
- {
138
- // otherwise if nobody's logged in, ignore the custom
139
- // attributes and just set the name to '(Guest)'
140
- try {
141
- /* echo "<pre>"; */
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()){
149
- if (isset($groupKeys[$groupId])){
150
- $return = $listID = $groupKeys[$groupId];
151
- }
152
- }
153
- }
154
-
155
- $result = $client->receiverAdd($apiKey, $listID, array(
156
- "email" => $email,
157
- "source" => "MAGENTO (frontend)",
158
- "attributes" => array('0'=>array('key'=>'store', 'value'=>Mage::app()->getStore()->getCode(), 'variable'=>'{STORE}'),"newsletter"=>"1"),
159
- )
160
- );
161
- } catch (Exception $e) {
162
- Mage::log("CleverReach_CrConnect: Error in SOAP call: ".$e->getMessage());
163
- $session->addException($e, $this->__('There was a problem with the subscription'));
164
- $this->_redirectReferer();
165
- }
166
- }
167
- } else if($apiKey && $listID && $confirm){
168
- Mage::log("Cleverreach_CrConnect: skiping $email, waiting for confirmation");
169
- }else{
170
- Mage::log("Cleverreach_CrConnect: error: API key and/or ListID missing");
171
- }
172
- }
173
-
174
- parent::newAction();
175
- }
176
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/controllers/UnsubscribeController.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Conlabz GmbH
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com and you will be sent a copy immediately.
15
- *
16
- * @category CleverReach
17
- * @package Conlabz_CrConnect
18
- * @copyright Copyright (c) 2012 Conlabz GmbH (http://conlabz.de)
19
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
- */
21
-
22
- class Conlabz_CrConnect_UnsubscribeController extends Mage_Core_Controller_Front_Action
23
- {
24
- public function indexAction()
25
- {
26
- // don't do anything if we didn't get the email parameter
27
- if(isset($_GET['email']))
28
- {
29
- $email = $_GET['email'];
30
- $apiKey = trim(Mage::getStoreConfig('newsletter/crconnect/api_key'));
31
- $listID = trim(Mage::getStoreConfig('newsletter/crconnect/list_id'));
32
-
33
- // Check that the email address actually is unsubscribed in
34
- // CleverReach
35
- if($apiKey && $listID)
36
- {
37
- try {
38
- $client = new SoapClient(Mage::helper('crconnect')->getWsdl(), array("trace" => true));
39
- } catch(Exception $e) {
40
- Mage::log("CleverReach_CrConnect: Error connecting to CleverReach server: ".$e->getMessage());
41
- $session->addException($e, $this->__('There was a problem with the subscription'));
42
- $this->_redirectReferer();
43
- }
44
-
45
- //get data from cleverreach
46
- Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
47
- $tmp = $client->receiverGetByEmail($apiKey, $email);
48
- if($tmp->status!="SUCCESS"){
49
- Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
50
- $session->addException($e, $this->__('There was a problem with the unsubscription'));
51
- $this->_redirectReferer();
52
- }else{
53
- Mage::log("CleverReach_CrConnect: Error - ".$tmp->message);
54
- }
55
-
56
- // If we are unsubscribed in cleverreach, mark us as
57
- // unsubscribed in Magento.
58
- if($tmp->data->deactivated)
59
- {
60
- try
61
- {
62
- Mage::log("CleverReach_CrConnect: Unsubscribing $email");
63
- $collection = Mage::getModel('newsletter/subscriber')
64
- ->loadByEmail($email)
65
- ->unsubscribe();
66
-
67
- Mage::getSingleton('customer/session')->addSuccess($this->__('You were successfully unsubscribed'));
68
- }
69
- catch (Exception $e)
70
- {
71
- Mage::log("CleverReach_CrConnect: ".$e->getMessage());
72
- Mage::getSingleton('customer/session')->addError($this->__('There was an error while saving your subscription details'));
73
- }
74
- }
75
- else
76
- {
77
- Mage::log("CleverReach_CrConnect: Not unsubscribing $email, not unsubscribed in Campaign Monitor");
78
- }
79
- }
80
- }
81
-
82
- $this->_redirect('customer/account/');
83
- }
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Conlabz/CrConnect/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Conlabz_CrConnect>
5
- <version>3.0.2</version>
6
  </Conlabz_CrConnect>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Conlabz_CrConnect>
5
+ <version>3.0.3</version>
6
  </Conlabz_CrConnect>
7
  </modules>
8
  <global>
app/design/adminhtml/default/default/template/crconnect/system/config/form/field/array_groups.phtml DELETED
@@ -1,157 +0,0 @@
1
- <?php
2
- $_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
3
-
4
- $_colspan = 2;
5
- if (!$this->_addAfter) {
6
- $_colspan -= 1;
7
- }
8
- $_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
9
- ?>
10
-
11
- <div class="grid" id="grid<?php echo $_htmlId ?>">
12
- <table cellpadding="0" cellspacing="0" class="border">
13
- <tbody>
14
-
15
- <tr class="headings" id="headings<?php echo $_htmlId ?>">
16
- <?php foreach ($this->_columns as $columnName => $column):?>
17
- <th><?php echo $column['label'] ?></th>
18
- <?php endforeach;?>
19
- <th <?php echo $_colspan?>></th>
20
- </tr>
21
-
22
- <tr id="addRow<?php echo $_htmlId ?>">
23
- <td colspan="<?php echo count($this->_columns) ?>"></td>
24
- <td <?php echo $_colspan?>>
25
- <button style="" onclick="" class="scalable add" type="button" id="addToEndBtn<?php echo $_htmlId ?>">
26
- <span><?php echo $this->_addButtonLabel ?></span>
27
- </button>
28
- </td>
29
- </tr>
30
-
31
- </tbody>
32
- </table>
33
- <input type="hidden" name="<?php echo $this->getElement()->getName() ?>[__empty]" value="" />
34
- </div>
35
- <div id="empty<?php echo $_htmlId ?>">
36
- <button style="" onclick="" class="scalable add" type="button" id="emptyAddBtn<?php echo $_htmlId ?>">
37
- <span><?php echo $this->_addButtonLabel ?></span>
38
- </button>
39
- </div>
40
-
41
- <script type="text/javascript">
42
- // <!--
43
- // create row creator
44
- var arrayRow<?php echo $_htmlId ?> = {
45
- // define row prototypeJS template
46
- template : new Template(
47
- '<tr id="#{_id}">'
48
- <?php foreach ($this->_columns as $columnName => $column):?>
49
- +'<td class="#{_id}-<?php echo $columnName?>">'
50
- +'<?php echo $this->_renderCellTemplate($columnName)?>'
51
- +'</td>'
52
- <?php endforeach;?>
53
- <?php if ($this->_addAfter):?>
54
- +'<td><button onclick="" class="scalable add" type="button" id="addAfterBtn#{_id}"><span><?php echo Mage::helper('adminhtml')->__('Add after') ?></span></button></td>'
55
- <?php endif;?>
56
- +'<td><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'#{_id}\')" class="scalable delete" type="button"><span><?php echo Mage::helper('adminhtml')->__('Delete') ?></span></button></td>'
57
- +'</tr>'
58
- ),
59
-
60
- rowsCount : 0,
61
-
62
- add : function(templateData, insertAfterId)
63
- {
64
- // generate default template data
65
- if ('' == templateData) {
66
- var d = new Date();
67
- var templateData = {
68
- <?php foreach ($this->_columns as $columnName => $column):?>
69
- <?php echo $columnName ?> : '',
70
- <?php endforeach;?>
71
- _id : '_' + d.getTime() + '_' + d.getMilliseconds()
72
- };
73
- }
74
-
75
- // insert before last row
76
- if ('' == insertAfterId) {
77
- new Insertion.Before(
78
- $('addRow<?php echo $_htmlId ?>'),
79
- this.template.evaluate(templateData)
80
- );
81
- }
82
- // insert after specified row
83
- else {
84
- new Insertion.After(
85
- $(insertAfterId),
86
- this.template.evaluate(templateData)
87
- );
88
- }
89
- // set the selected drop-down list item
90
- <?php foreach ($this->_columns as $columnName => $column):?>
91
- var options = $$('td.' + templateData._id + '-' + '<?php echo $columnName?>' + ' option')
92
- for(var index = 0; index < options.length; ++index)
93
- {
94
- var option = options[index]
95
- if(option.getAttribute('value') == templateData.<?php echo $columnName?>)
96
- {
97
- option.selected = true
98
- }
99
- }
100
- <?php endforeach;?>
101
-
102
- <?php if ($this->_addAfter):?>
103
- Event.observe('addAfterBtn' + templateData._id, 'click', this.add.bind(this, '', templateData._id));
104
- <?php endif;?>
105
-
106
- this.rowsCount += 1;
107
- },
108
-
109
- del : function(rowId)
110
- {
111
- $(rowId).remove();
112
- this.rowsCount -= 1;
113
- if (0 == this.rowsCount) {
114
- this.showButtonOnly();
115
- }
116
- },
117
-
118
- showButtonOnly : function()
119
- {
120
- $('grid<?php echo $_htmlId ?>').hide();
121
- $('empty<?php echo $_htmlId ?>').show();
122
- }
123
- }
124
-
125
- // bind add action to "Add" button in last row
126
- Event.observe('addToEndBtn<?php echo $_htmlId ?>', 'click', arrayRow<?php echo $_htmlId ?>.add.bind(arrayRow<?php echo $_htmlId ?>, '', ''));
127
-
128
- // add existing rows
129
- <?php
130
- $_addAfterId = "headings{$_htmlId}";
131
- foreach ($this->getArrayRows() as $_rowId => $_row) {
132
- echo "arrayRow{$_htmlId}.add(" . $_row->toJson() . ", '{$_addAfterId}');\n";
133
- /*print "%%%%%%%%%%%%%%%";
134
- print_r($_row->toJson());*/
135
- $_addAfterId = $_rowId;
136
- }
137
- ?>
138
-
139
- // initialize standalone button
140
- $('empty<?php echo $_htmlId ?>').hide();
141
- Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
142
- $('grid<?php echo $_htmlId ?>').show();
143
- $('empty<?php echo $_htmlId ?>').hide();
144
- arrayRow<?php echo $_htmlId ?>.add('', '');
145
- });
146
-
147
- // if no rows, hide grid and show button only
148
- <?php if (!$this->getArrayRows()):?>
149
- arrayRow<?php echo $_htmlId ?>.showButtonOnly();
150
- <?php endif;?>
151
-
152
- // toggle the grid, if element is disabled (depending on scope)
153
- <?php if ($this->getElement()->getDisabled()):?>
154
- toggleValueElements({checked:true}, $('grid<?php echo $_htmlId ?>').parentNode);
155
- <?php endif;?>
156
- // -->
157
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Conlabz_CrConnect</name>
4
- <version>3.0.2</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
@@ -18,11 +18,11 @@ To setup the synchronization, all you need is your CleverReach API key and the r
18
  Once set up, the Extension will handle subscriptions and unsubscribe requests. Users can unsubscribe themselves in Magento or in CleverReach. CleverReach Connect will track users who have followed the links in your email campaign. When a user completes a purchase, the plugin will quietly send the basic details of the order back to your reporting dashboard in the CleverReach tool. Thus you will be able to analyse conversions which originated from your mailings.&#xD;
19
  &#xD;
20
  Please note that subscribers imported form an order won't have the "receive newsletter" flag set to 1.</description>
21
- <notes>Update customer info on CR after customer edit</notes>
22
  <authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
23
- <date>2014-08-15</date>
24
- <time>15:18:23</time>
25
- <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="0354815224028e6fc90671a61abb2232"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="9eaf627b6255229e1861208dd1b9a280"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="6ecac377484995a89c7718a015f74a89"/><file name="Key.php" hash="42f31c0d35632948a702106540d5e85b"/><file name="Url.php" hash="f330f299b19ed1b266ec6a3eb5d31fa1"/></dir><dir name="Customer"><file name="Newsletter.php" hash="f645682ece7817b4386538026fa580dc"/></dir><file name="Groupsapis.php" hash="cecd60a67b2e72effd2bc7ac1e1fdc58"/></dir><dir name="Helper"><file name="Data.php" hash="293591f9f29cf83d777454c4f0eed40e"/></dir><dir name="Model"><file name="Api.php" hash="1c7e822831cd757a48cbb211855f6cbd"/><dir name="Checkout"><file name="Observer.php" hash="cf99d26d4d85c3106d480b035b98287f"/></dir><dir name="Customer"><file name="Observer.php" hash="6dd8ed2fc9c3dd0e5a2771fb1857ec81"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="51cb181afbd60baaadd5ed4385497763"/></dir><file name="Observer.php" hash="8b05c8437a4f8ec1d0dfefe9981fc046"/><file name="Search.php" hash="e2bcaa4e316d028141075cbd0c964e67"/><file name="Subscriber.php" hash="932db13369c1f1d9e106b1600531d681"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EmptyForms.php" hash="feb6f16d6b26e0cdaedb06bc68ce1c63"/><file name="EmptyList.php" hash="8f3f19184a183b1f5dce98d70608bcb1"/></dir></dir></dir><dir name="Website"><file name="Observer.php" hash="db48be43fed458ed4169771a55cf2288"/></dir></dir><dir name="controllers"><file name="AccountController.php" hash="009b2b88f4d9a5daeb050ce617d677b6"/><dir name="Adminhtml"><file name="ConfigController.php" hash="d5a14810dea4a39e593f963119fca26e"/><file name="CrconnectController.php" hash="07e1950ceb80342fc006ea00db084596"/></dir><file name="HookController.php" hash="3235db4d5ecf422ff9d58771af94fca5"/><file name="ManageController.php" hash="739fdf9934ca2665b9ffdf43edbef733"/><file name="SearchController.php" hash="2f7947cf6774a6874c815f71d3468152"/><file name="SubscriberController.php" hash="9cd8eb59c885b6f0b9133c0a1271bbe9"/><file name="UnsubscribeController.php" hash="357908ed531f29de19b7ddbb549ed4e4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="00bab70876fc5def3883b74cb1da413c"/><file name="config.xml" hash="6279d7a54f9fb1b12ecc263f97ebe335"/><file name="system.xml" hash="9f5c8170faedd86fcc35df4be9dc93b9"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><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 name="layout"><file name="crconnect.xml" hash="1185a92ac6c2117d5e440f709d0eca24"/></dir></dir></dir></dir><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></target><target name="mageetc"><dir name="modules"><file name="Conlabz_CrConnect.xml" hash="282358cc102bf617b7d5afcaa47ec489"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Conlabz_CleverReach.csv" hash="22f87461d771b644cb0ac3dc2cc78118"/></dir><dir name="en_US"><file name="Conlabz_CleverReach.csv" hash="7d6b2f9b03bcba2abf2c5eacdd2192e1"/></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><target name="mage"><dir name="."><file name="CleverReachDocumentation.docx" hash="571866f1b26b6c1ba5881644b2ecf9db"/><file name="CleverReachDocumentationGerman.docx" hash="ed975c640c6fd92115505f0790ba6231"/></dir></target></contents>
26
  <compatible/>
27
- <dependencies><required><php><min>5.2.13</min><max>5.4.0</max></php></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Conlabz_CrConnect</name>
4
+ <version>3.0.3</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License</license>
7
  <channel>community</channel>
18
  Once set up, the Extension will handle subscriptions and unsubscribe requests. Users can unsubscribe themselves in Magento or in CleverReach. CleverReach Connect will track users who have followed the links in your email campaign. When a user completes a purchase, the plugin will quietly send the basic details of the order back to your reporting dashboard in the CleverReach tool. Thus you will be able to analyse conversions which originated from your mailings.&#xD;
19
  &#xD;
20
  Please note that subscribers imported form an order won't have the "receive newsletter" flag set to 1.</description>
21
+ <notes>Export customer information to CR during init synchronization</notes>
22
  <authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
23
+ <date>2014-11-14</date>
24
+ <time>09:47:14</time>
25
+ <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="0354815224028e6fc90671a61abb2232"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="9eaf627b6255229e1861208dd1b9a280"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="6ecac377484995a89c7718a015f74a89"/><file name="Key.php" hash="42f31c0d35632948a702106540d5e85b"/><file name="Url.php" hash="f330f299b19ed1b266ec6a3eb5d31fa1"/></dir><dir name="Customer"><file name="Newsletter.php" hash="f645682ece7817b4386538026fa580dc"/></dir></dir><dir name="Helper"><file name="Data.php" hash="293591f9f29cf83d777454c4f0eed40e"/></dir><dir name="Model"><file name="Api.php" hash="9857eaa767f6be8c2b88e58080d1b05f"/><dir name="Newsletter"><file name="Subscriber.php" hash="51cb181afbd60baaadd5ed4385497763"/></dir><file name="Observer.php" hash="9f4d191d6b5bdb7d489d7ad6c0b3a65a"/><file name="Search.php" hash="e2bcaa4e316d028141075cbd0c964e67"/><file name="Subscriber.php" hash="932db13369c1f1d9e106b1600531d681"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EmptyForms.php" hash="feb6f16d6b26e0cdaedb06bc68ce1c63"/><file name="EmptyList.php" hash="8f3f19184a183b1f5dce98d70608bcb1"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="d5a14810dea4a39e593f963119fca26e"/><file name="CrconnectController.php" hash="07e1950ceb80342fc006ea00db084596"/></dir><file name="ManageController.php" hash="739fdf9934ca2665b9ffdf43edbef733"/><file name="SearchController.php" hash="2f7947cf6774a6874c815f71d3468152"/><file name="SubscriberController.php" hash="9cd8eb59c885b6f0b9133c0a1271bbe9"/></dir><dir name="etc"><file name="adminhtml.xml" hash="00bab70876fc5def3883b74cb1da413c"/><file name="config.xml" hash="6e5df2000963ce4131a2a081f83b7615"/><file name="system.xml" hash="9f5c8170faedd86fcc35df4be9dc93b9"/></dir><file name=".DS_Store" hash="f8821c8d76ce076faa6d642b00aa9227"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><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="cr_array_groups.phtml" hash="d2f70aa406d8b15f819481acbf0ccbee"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="crconnect.xml" hash="1185a92ac6c2117d5e440f709d0eca24"/></dir></dir></dir></dir><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></target><target name="mageetc"><dir name="modules"><file name="Conlabz_CrConnect.xml" hash="282358cc102bf617b7d5afcaa47ec489"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Conlabz_CleverReach.csv" hash="22f87461d771b644cb0ac3dc2cc78118"/></dir><dir name="en_US"><file name="Conlabz_CleverReach.csv" hash="7d6b2f9b03bcba2abf2c5eacdd2192e1"/></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><target name="mage"><dir name="."><file name="CleverReachDocumentation.docx" hash=""/><file name="CleverReachDocumentationGerman.docx" hash=""/></dir></target></contents>
26
  <compatible/>
27
+ <dependencies><required><php><min>5.2.13</min><max>5.5.0</max></php></required></dependencies>
28
  </package>