Version Notes
GetResponse Integration
Download this release
Release Info
Developer | GetResponse |
Extension | GetResponse |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- app/code/community/GetresponseIntegration/Getresponse/Helper/Api.php +30 -42
- app/code/community/GetresponseIntegration/Getresponse/Helper/GrApi.php +7 -8
- app/code/community/GetresponseIntegration/Getresponse/Model/Customs.php +4 -3
- app/code/community/GetresponseIntegration/Getresponse/Model/Observer.php +61 -0
- app/code/community/GetresponseIntegration/Getresponse/controllers/IndexController.php +49 -4
- app/code/community/GetresponseIntegration/Getresponse/etc/config.xml +15 -1
- app/code/community/GetresponseIntegration/Getresponse/sql/getresponse_setup/upgrade-1.0.2-1.0.3.php +17 -0
- app/design/adminhtml/default/default/template/getresponse/menu.phtml +7 -0
- app/design/adminhtml/default/default/template/getresponse/newsletter.phtml +137 -0
- package.xml +6 -6
- skin/adminhtml/default/default/css/getresponse.css +1 -1
app/code/community/GetresponseIntegration/Getresponse/Helper/Api.php
CHANGED
@@ -12,14 +12,9 @@ class GetresponseIntegration_Getresponse_Helper_Api extends Mage_Core_Helper_Abs
|
|
12 |
self::CONTACT_UPDATED => 'Updated',
|
13 |
self::CONTACT_ERROR => 'Not added'
|
14 |
);
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
* All custom fields.
|
19 |
-
*
|
20 |
-
* @var
|
21 |
-
*/
|
22 |
-
private $all_custom_fields;
|
23 |
|
24 |
/**
|
25 |
* Getresponse API instance
|
@@ -76,12 +71,15 @@ class GetresponseIntegration_Getresponse_Helper_Api extends Mage_Core_Helper_Abs
|
|
76 |
public function addContact($campaign, $name, $email, $cycle_day = '', $user_customs = array())
|
77 |
{
|
78 |
$params = array(
|
79 |
-
'name' => $name,
|
80 |
'email' => $email,
|
81 |
'campaign' => array('campaignId' => $campaign),
|
82 |
'ipAddress' => $_SERVER['REMOTE_ADDR'],
|
83 |
);
|
84 |
|
|
|
|
|
|
|
|
|
85 |
if (is_numeric($cycle_day) && $cycle_day >= 0) {
|
86 |
$params['dayOfCycle'] = $cycle_day;
|
87 |
}
|
@@ -157,43 +155,33 @@ class GetresponseIntegration_Getresponse_Helper_Api extends Mage_Core_Helper_Abs
|
|
157 |
return $custom_fields;
|
158 |
}
|
159 |
|
160 |
-
if (empty($this->all_custom_fields)) {
|
161 |
-
$this->all_custom_fields = $this->get_custom_fields();
|
162 |
-
}
|
163 |
-
|
164 |
-
$dropCustoms = false;
|
165 |
-
|
166 |
foreach ($user_customs as $name => $value) {
|
167 |
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
}
|
192 |
|
193 |
-
if ($dropCustoms) {
|
194 |
-
$this->all_custom_fields = [];
|
195 |
-
}
|
196 |
-
|
197 |
return $custom_fields;
|
198 |
}
|
199 |
|
12 |
self::CONTACT_UPDATED => 'Updated',
|
13 |
self::CONTACT_ERROR => 'Not added'
|
14 |
);
|
15 |
+
|
16 |
+
/** @var array */
|
17 |
+
private $cachedCustoms = [];
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
* Getresponse API instance
|
71 |
public function addContact($campaign, $name, $email, $cycle_day = '', $user_customs = array())
|
72 |
{
|
73 |
$params = array(
|
|
|
74 |
'email' => $email,
|
75 |
'campaign' => array('campaignId' => $campaign),
|
76 |
'ipAddress' => $_SERVER['REMOTE_ADDR'],
|
77 |
);
|
78 |
|
79 |
+
if (!empty(trim($name))) {
|
80 |
+
$params['name'] = trim($name);
|
81 |
+
}
|
82 |
+
|
83 |
if (is_numeric($cycle_day) && $cycle_day >= 0) {
|
84 |
$params['dayOfCycle'] = $cycle_day;
|
85 |
}
|
155 |
return $custom_fields;
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
foreach ($user_customs as $name => $value) {
|
159 |
|
160 |
+
if (!isset($this->cachedCustoms[$name])) {
|
161 |
+
$customs = (array) $this->grapi()->get_custom_fields(['query[name]' => $name]);
|
162 |
+
$custom = reset($customs);
|
163 |
+
|
164 |
+
// custom field not found - create new
|
165 |
+
if (empty($custom) || empty($custom->customFieldId)) {
|
166 |
+
$custom = $this->grapi()->add_custom_field([
|
167 |
+
'name' => $name,
|
168 |
+
'type' => is_array($value) ? "checkbox" : "text",
|
169 |
+
'hidden' => "false",
|
170 |
+
'values' => is_array($value) ? $value : [$value],
|
171 |
+
]);
|
172 |
+
}
|
173 |
+
|
174 |
+
$this->cachedCustoms[$name] = $custom;
|
175 |
+
} else {
|
176 |
+
$custom = $this->cachedCustoms[$name];
|
177 |
+
}
|
178 |
+
|
179 |
+
$custom_fields[] = array(
|
180 |
+
'customFieldId' => $custom->customFieldId,
|
181 |
+
'value' => is_array($value) ? $value : array($value)
|
182 |
+
);
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
185 |
return $custom_fields;
|
186 |
}
|
187 |
|
app/code/community/GetresponseIntegration/Getresponse/Helper/GrApi.php
CHANGED
@@ -284,13 +284,12 @@ class GetresponseIntegration_Getresponse_Helper_GrApi
|
|
284 |
return $this->call('subscription-confirmations/body/' . $lang);
|
285 |
}
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
*/
|
294 |
public function add_custom_field($params = array())
|
295 |
{
|
296 |
return $this->call('custom-fields', 'POST', $params);
|
@@ -317,7 +316,7 @@ class GetresponseIntegration_Getresponse_Helper_GrApi
|
|
317 |
*/
|
318 |
public function get_custom_fields($params = array())
|
319 |
{
|
320 |
-
|
321 |
}
|
322 |
|
323 |
/**
|
284 |
return $this->call('subscription-confirmations/body/' . $lang);
|
285 |
}
|
286 |
|
287 |
+
/**
|
288 |
+
* retrieve single custom field
|
289 |
+
*
|
290 |
+
* @param array $params
|
291 |
+
* @return mixed
|
292 |
+
*/
|
|
|
293 |
public function add_custom_field($params = array())
|
294 |
{
|
295 |
return $this->call('custom-fields', 'POST', $params);
|
316 |
*/
|
317 |
public function get_custom_fields($params = array())
|
318 |
{
|
319 |
+
return $this->call('custom-fields?' . $this->setParams($params));
|
320 |
}
|
321 |
|
322 |
/**
|
app/code/community/GetresponseIntegration/Getresponse/Model/Customs.php
CHANGED
@@ -112,14 +112,15 @@ class GetresponseIntegration_Getresponse_Model_Customs extends Mage_Core_Model_A
|
|
112 |
if ( !empty($user_customs) && !empty($db_customs)) {
|
113 |
|
114 |
foreach ($db_customs as $cf) {
|
115 |
-
if (
|
116 |
-
|
|
|
|
|
117 |
) {
|
118 |
$fields[$cf['custom_value']] = trim(preg_replace('/\s+/', ' ', $user_customs[$cf['custom_field']]));
|
119 |
}
|
120 |
}
|
121 |
}
|
122 |
-
|
123 |
return $fields;
|
124 |
}
|
125 |
|
112 |
if ( !empty($user_customs) && !empty($db_customs)) {
|
113 |
|
114 |
foreach ($db_customs as $cf) {
|
115 |
+
if (
|
116 |
+
in_array($cf['custom_field'], array_keys($user_customs))
|
117 |
+
&& !empty($user_customs[$cf['custom_field']])
|
118 |
+
&& !in_array($cf['custom_field'], array('firstname', 'lastname', 'email'))
|
119 |
) {
|
120 |
$fields[$cf['custom_value']] = trim(preg_replace('/\s+/', ' ', $user_customs[$cf['custom_field']]));
|
121 |
}
|
122 |
}
|
123 |
}
|
|
|
124 |
return $fields;
|
125 |
}
|
126 |
|
app/code/community/GetresponseIntegration/Getresponse/Model/Observer.php
CHANGED
@@ -515,4 +515,65 @@ class GetresponseIntegration_Getresponse_Model_Observer
|
|
515 |
|
516 |
return $this;
|
517 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
515 |
|
516 |
return $this;
|
517 |
}
|
518 |
+
|
519 |
+
/**
|
520 |
+
* @param Varien_Event_Observer $observer
|
521 |
+
*
|
522 |
+
* @return $this
|
523 |
+
*/
|
524 |
+
public function initBeforeAddToNewsletterAction(Varien_Event_Observer $observer)
|
525 |
+
{
|
526 |
+
if ( !Mage::helper('getresponse')->isEnabled()) {
|
527 |
+
return $this;
|
528 |
+
}
|
529 |
+
|
530 |
+
$shop_id = Mage::helper('getresponse')->getStoreId();
|
531 |
+
$settings = Mage::getModel('getresponse/settings')->load($shop_id)->getData();
|
532 |
+
|
533 |
+
if (empty($settings['api_key']) || '1' !== $settings['newsletter_subscription'] || empty($settings['newsletter_campaign_id'])) {
|
534 |
+
return $this;
|
535 |
+
}
|
536 |
+
|
537 |
+
$name = $email = null;
|
538 |
+
$post = Mage::app()->getRequest()->getPost();
|
539 |
+
|
540 |
+
/** @var Mage_Customer_Model_Session $customerSession */
|
541 |
+
$customerSession = Mage::getSingleton('customer/session');
|
542 |
+
$customer = $customerSession->getCustomer();
|
543 |
+
|
544 |
+
// only, if customer is logged in.
|
545 |
+
if (!$customer->isEmpty() && strlen($customer->email) > 0 && isset($post['is_subscribed']) && $post['is_subscribed'] === 1) {
|
546 |
+
$name = $customer->firstname . ' ' . $customer->lastname;
|
547 |
+
$email = $customer->email;
|
548 |
+
} else if (isset($post['email']) && !empty($post['email'])) {
|
549 |
+
$name = 'Friend';
|
550 |
+
$email = $post['email'];
|
551 |
+
}
|
552 |
+
|
553 |
+
if (empty($email)) {
|
554 |
+
return $this;
|
555 |
+
}
|
556 |
+
|
557 |
+
$subscriberModel = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
|
558 |
+
|
559 |
+
if (false === $subscriberModel->isSubscribed()) {
|
560 |
+
return $this;
|
561 |
+
}
|
562 |
+
|
563 |
+
Mage::helper('getresponse/api')->setApiDetails(
|
564 |
+
$settings['api_key'],
|
565 |
+
$settings['api_url'],
|
566 |
+
$settings['api_domain']
|
567 |
+
);
|
568 |
+
|
569 |
+
Mage::helper('getresponse/api')->addContact(
|
570 |
+
$settings['newsletter_campaign_id'],
|
571 |
+
$name,
|
572 |
+
$email,
|
573 |
+
$settings['cycle_day'],
|
574 |
+
[]
|
575 |
+
);
|
576 |
+
|
577 |
+
return $this;
|
578 |
+
}
|
579 |
}
|
app/code/community/GetresponseIntegration/Getresponse/controllers/IndexController.php
CHANGED
@@ -134,7 +134,7 @@ class GetresponseIntegration_Getresponse_IndexController extends Mage_Adminhtml_
|
|
134 |
|
135 |
Mage::getModel('getresponse/settings')->updateSettings(
|
136 |
array(
|
137 |
-
|
138 |
),
|
139 |
$this->current_shop_id
|
140 |
);
|
@@ -143,6 +143,53 @@ class GetresponseIntegration_Getresponse_IndexController extends Mage_Adminhtml_
|
|
143 |
$this->_redirect('getresponse/index/webtraffic');
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
/**
|
147 |
* GET getresponse/index/index
|
148 |
*/
|
@@ -807,7 +854,6 @@ class GetresponseIntegration_Getresponse_IndexController extends Mage_Adminhtml_
|
|
807 |
}
|
808 |
|
809 |
$custom_fields = !empty($params['gr_custom_field']) ? $params['gr_custom_field'] : array();
|
810 |
-
$custom_fields = array('firstname' => 'firstname', 'lastname' => 'lastname') + $custom_fields;
|
811 |
|
812 |
if ( !empty($params['gr_custom_field'])) {
|
813 |
foreach ($params['gr_custom_field'] as $field_key => $field_value) {
|
@@ -825,7 +871,6 @@ class GetresponseIntegration_Getresponse_IndexController extends Mage_Adminhtml_
|
|
825 |
'error' => 0,
|
826 |
];
|
827 |
|
828 |
-
|
829 |
if ( !empty($subscribers)) {
|
830 |
foreach ($subscribers as $subscriber) {
|
831 |
$customer = Mage::getResourceModel('customer/customer_collection')
|
@@ -846,7 +891,7 @@ class GetresponseIntegration_Getresponse_IndexController extends Mage_Adminhtml_
|
|
846 |
if (!empty($customer)) {
|
847 |
$name = $customer->getName();
|
848 |
} else {
|
849 |
-
$name =
|
850 |
}
|
851 |
$result = Mage::helper('getresponse/api')->addContact(
|
852 |
$campaign_id,
|
134 |
|
135 |
Mage::getModel('getresponse/settings')->updateSettings(
|
136 |
array(
|
137 |
+
'has_active_traffic_module' => (isset($params['has_active_traffic_module']) && $params['has_active_traffic_module'] == 1) ? 1 : 0
|
138 |
),
|
139 |
$this->current_shop_id
|
140 |
);
|
143 |
$this->_redirect('getresponse/index/webtraffic');
|
144 |
}
|
145 |
|
146 |
+
/**
|
147 |
+
* GET getresponse/index/newsletter
|
148 |
+
*/
|
149 |
+
public function newsletterAction()
|
150 |
+
{
|
151 |
+
$this->settings->api = Mage::getModel('getresponse/settings')->load($this->current_shop_id)->getData();
|
152 |
+
|
153 |
+
$this->_title($this->__('Subscription via newsletter'))
|
154 |
+
->_title($this->__('GetResponse'));
|
155 |
+
|
156 |
+
$this->active_tab = 'newsletter';
|
157 |
+
|
158 |
+
$this->_initAction();
|
159 |
+
$this->disableIntegrationIfApiNotActive();
|
160 |
+
|
161 |
+
$this->settings->campaign_days = Mage::helper('getresponse/api')->getCampaignDays();
|
162 |
+
$this->setNewCampaignSettings();
|
163 |
+
|
164 |
+
$this->_addContent($this->getLayout()
|
165 |
+
->createBlock('Mage_Core_Block_Template', 'getresponse_content')
|
166 |
+
->setTemplate('getresponse/newsletter.phtml')
|
167 |
+
->assign('settings', $this->settings)
|
168 |
+
);
|
169 |
+
|
170 |
+
$this->renderLayout();
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* POST getresponse/index/activate_newsletter
|
175 |
+
*/
|
176 |
+
public function activate_newsletterAction()
|
177 |
+
{
|
178 |
+
$this->_initAction();
|
179 |
+
$params = $this->getRequest()->getParams();
|
180 |
+
|
181 |
+
Mage::getModel('getresponse/settings')->updateSettings(
|
182 |
+
array(
|
183 |
+
'newsletter_subscription' => (isset($params['newsletter_subscription']) && $params['newsletter_subscription'] == 1) ? 1 : 0,
|
184 |
+
'newsletter_campaign_id' => (isset($params['newsletter_campaign_id'])) ? $params['newsletter_campaign_id'] : ''
|
185 |
+
),
|
186 |
+
$this->current_shop_id
|
187 |
+
);
|
188 |
+
|
189 |
+
Mage::getSingleton('core/session')->addSuccess('Settings have been updated.');
|
190 |
+
$this->_redirect('getresponse/index/newsletter');
|
191 |
+
}
|
192 |
+
|
193 |
/**
|
194 |
* GET getresponse/index/index
|
195 |
*/
|
854 |
}
|
855 |
|
856 |
$custom_fields = !empty($params['gr_custom_field']) ? $params['gr_custom_field'] : array();
|
|
|
857 |
|
858 |
if ( !empty($params['gr_custom_field'])) {
|
859 |
foreach ($params['gr_custom_field'] as $field_key => $field_value) {
|
871 |
'error' => 0,
|
872 |
];
|
873 |
|
|
|
874 |
if ( !empty($subscribers)) {
|
875 |
foreach ($subscribers as $subscriber) {
|
876 |
$customer = Mage::getResourceModel('customer/customer_collection')
|
891 |
if (!empty($customer)) {
|
892 |
$name = $customer->getName();
|
893 |
} else {
|
894 |
+
$name = null;
|
895 |
}
|
896 |
$result = Mage::helper('getresponse/api')->addContact(
|
897 |
$campaign_id,
|
app/code/community/GetresponseIntegration/Getresponse/etc/config.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<config>
|
2 |
<modules>
|
3 |
<GetresponseIntegration_Getresponse>
|
4 |
-
<version>1.0.
|
5 |
</GetresponseIntegration_Getresponse>
|
6 |
</modules>
|
7 |
|
@@ -127,6 +127,14 @@
|
|
127 |
</updates>
|
128 |
</layout>
|
129 |
<events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
<controller_action_layout_generate_blocks_before>
|
131 |
<observers>
|
132 |
<getresponse_block_observer>
|
@@ -231,6 +239,7 @@
|
|
231 |
<title>Campaign rules</title>
|
232 |
<action>getresponse/index/automation</action>
|
233 |
</automation_page>
|
|
|
234 |
<shop_page module="getresponse">
|
235 |
<title>GetResponse E-commerce</title>
|
236 |
<action>getresponse/shop/index</action>
|
@@ -239,6 +248,11 @@
|
|
239 |
<title>Web Traffic Tracking</title>
|
240 |
<action>getresponse/index/webtraffic</action>
|
241 |
</web_traffic_page>
|
|
|
|
|
|
|
|
|
|
|
242 |
</children>
|
243 |
</getresponse_menu>
|
244 |
</menu>
|
1 |
<config>
|
2 |
<modules>
|
3 |
<GetresponseIntegration_Getresponse>
|
4 |
+
<version>1.0.5</version>
|
5 |
</GetresponseIntegration_Getresponse>
|
6 |
</modules>
|
7 |
|
127 |
</updates>
|
128 |
</layout>
|
129 |
<events>
|
130 |
+
<newsletter_subscriber_save_commit_after>
|
131 |
+
<observers>
|
132 |
+
<getresponse_add_from_newsletter_form>
|
133 |
+
<class>GetresponseIntegration_Getresponse_Model_Observer</class>
|
134 |
+
<method>initBeforeAddToNewsletterAction</method>
|
135 |
+
</getresponse_add_from_newsletter_form>
|
136 |
+
</observers>
|
137 |
+
</newsletter_subscriber_save_commit_after>
|
138 |
<controller_action_layout_generate_blocks_before>
|
139 |
<observers>
|
140 |
<getresponse_block_observer>
|
239 |
<title>Campaign rules</title>
|
240 |
<action>getresponse/index/automation</action>
|
241 |
</automation_page>
|
242 |
+
<!--
|
243 |
<shop_page module="getresponse">
|
244 |
<title>GetResponse E-commerce</title>
|
245 |
<action>getresponse/shop/index</action>
|
248 |
<title>Web Traffic Tracking</title>
|
249 |
<action>getresponse/index/webtraffic</action>
|
250 |
</web_traffic_page>
|
251 |
+
-->
|
252 |
+
<newsletter_page module="getresponse">
|
253 |
+
<title>Subscription via newsletter</title>
|
254 |
+
<action>getresponse/index/newsletter</action>
|
255 |
+
</newsletter_page>
|
256 |
</children>
|
257 |
</getresponse_menu>
|
258 |
</menu>
|
app/code/community/GetresponseIntegration/Getresponse/sql/getresponse_setup/upgrade-1.0.2-1.0.3.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @var $installer Mage_Core_Model_Resource_Setup
|
5 |
+
*/
|
6 |
+
$installer = $this;
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
try {
|
10 |
+
$installer->run("
|
11 |
+
ALTER TABLE `{$installer->getTable('getresponse_settings')}` ADD `newsletter_subscription` TINYINT(1) NOT NULL DEFAULT 0;
|
12 |
+
ALTER TABLE `{$installer->getTable('getresponse_settings')}` ADD `newsletter_campaign_id` CHAR(5) NULL;
|
13 |
+
");
|
14 |
+
} catch (\Exception $e) {
|
15 |
+
}
|
16 |
+
|
17 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/getresponse/menu.phtml
CHANGED
@@ -50,6 +50,13 @@
|
|
50 |
<span>GetResponse E-commerce</span>
|
51 |
</a>
|
52 |
</li> */ ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
<?php }
|
54 |
else { ?>
|
55 |
<li>
|
50 |
<span>GetResponse E-commerce</span>
|
51 |
</a>
|
52 |
</li> */ ?>
|
53 |
+
<li class="">
|
54 |
+
<a href="<?php echo Mage::helper("adminhtml")->getUrl('getresponse/index/newsletter'); ?>"
|
55 |
+
class="tab-item-link <?php if ($active_tab == 'newsletter') : echo 'active'; endif; ?>"
|
56 |
+
title="newsletter">
|
57 |
+
<span>Subscription via newsletter</span>
|
58 |
+
</a>
|
59 |
+
</li>
|
60 |
<?php }
|
61 |
else { ?>
|
62 |
<li>
|
app/design/adminhtml/default/default/template/getresponse/newsletter.phtml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<div class="content-header">
|
3 |
+
<h3 class="icon-head head-categories">Subscription via newsletter</h3>
|
4 |
+
</div>
|
5 |
+
<?php include_once('add_campaign.phtml'); ?>
|
6 |
+
<form id="getresponse_export_form" method="post"
|
7 |
+
action="<?php echo Mage::helper("adminhtml")->getUrl('getresponse/index/activate_newsletter'); ?>">
|
8 |
+
|
9 |
+
<p style="padding-bottom: 10px;">
|
10 |
+
You can add subscribers to a specific GetResponse campaign when people join to Magento newsletter (using the
|
11 |
+
newsletter formular). Select an existing campaign or create a new one for your visitors.
|
12 |
+
</p>
|
13 |
+
|
14 |
+
<p>
|
15 |
+
<span class="switch_active_subscription">
|
16 |
+
<input
|
17 |
+
class="GR_checkbox"
|
18 |
+
type="checkbox"
|
19 |
+
name="newsletter_subscription"
|
20 |
+
id="newsletter_subscription"
|
21 |
+
value="1"
|
22 |
+
<?php if (isset($settings->api['newsletter_subscription']) and $settings->api['newsletter_subscription'] == 1) : ?>
|
23 |
+
checked="checked"
|
24 |
+
<?php endif; ?>
|
25 |
+
/>
|
26 |
+
</span>
|
27 |
+
<label class="GR_label" for="active_subscription">Allow subscriptions when customers joins to newsletter</label>
|
28 |
+
|
29 |
+
</p>
|
30 |
+
|
31 |
+
<div id="details"
|
32 |
+
style="<?php if (!isset($settings->api['newsletter_subscription']) || $settings->api['newsletter_subscription'] !== '1') {
|
33 |
+
echo "display: none;";
|
34 |
+
} ?>">
|
35 |
+
<p>
|
36 |
+
<label class="GR_label" for="newsletter_campaign_id">Select your campaign</label>
|
37 |
+
<?php
|
38 |
+
if (!empty($settings->campaigns)) {
|
39 |
+
?>
|
40 |
+
<select class="GR_input" name="newsletter_campaign_id" id="newsletter_campaign_id">
|
41 |
+
<?php
|
42 |
+
foreach ($settings->campaigns as $id => $name) {
|
43 |
+
echo '<option value="' . $id . '"', ($id == $settings->api['newsletter_campaign_id']) ? ' selected="selected"' : '', '>' . $name . '</option>';
|
44 |
+
}
|
45 |
+
?>
|
46 |
+
</select>
|
47 |
+
<?php } else {
|
48 |
+
?>
|
49 |
+
<span class="error">An error occurred while trying to get campaigns.</span>
|
50 |
+
<?php
|
51 |
+
}
|
52 |
+
?>
|
53 |
+
<button id="create-campaign">Add new campaign</button>
|
54 |
+
</p>
|
55 |
+
|
56 |
+
<p id="cycle_day_section" style="padding: 5px 0px 10px 0px;">
|
57 |
+
|
58 |
+
<label class="GR_label"></label>
|
59 |
+
|
60 |
+
<span>
|
61 |
+
<input type="checkbox" class="GR_checkbox" name="gr_autoresponder" id="gr_autoresponder" value="1"/>
|
62 |
+
</span>
|
63 |
+
|
64 |
+
<label for="gr_autoresponder">Add to autoresponder sequence</label>
|
65 |
+
<br/>
|
66 |
+
<label class="GR_label" for="cycle_day"></label>
|
67 |
+
<select class="GR_input" name="cycle_day" id="cycle_day"></select>
|
68 |
+
</p>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<script>
|
72 |
+
var details = jQuery('#details');
|
73 |
+
|
74 |
+
function switchSubscriptionHandler() {
|
75 |
+
jQuery('.switch_active_subscription').find('[class*=GR_checkbox]').on("click", function (e) {
|
76 |
+
details.toggle('slow');
|
77 |
+
});
|
78 |
+
}
|
79 |
+
|
80 |
+
switchSubscriptionHandler();
|
81 |
+
|
82 |
+
jQuery('#newsletter_campaign_id').change(function () {
|
83 |
+
getCycleDays();
|
84 |
+
});
|
85 |
+
|
86 |
+
function getCycleDays() {
|
87 |
+
var newsletter_campaign_id = jQuery('#newsletter_campaign_id').val(),
|
88 |
+
day_element = jQuery('#cycle_day'),
|
89 |
+
checkbox = jQuery('#gr_autoresponder'),
|
90 |
+
cycles = jQuery.parseJSON('<?php echo isset($settings->campaign_days) ? addslashes(json_encode($settings->campaign_days)) : "{}"; ?>');
|
91 |
+
|
92 |
+
if (cycles.hasOwnProperty(newsletter_campaign_id)) {
|
93 |
+
day_element.html('');
|
94 |
+
checkbox.removeAttr('disabled');
|
95 |
+
day_element.removeAttr('disabled');
|
96 |
+
var obj = cycles[newsletter_campaign_id];
|
97 |
+
for (var prop in obj) {
|
98 |
+
if (obj.hasOwnProperty(prop)) {
|
99 |
+
|
100 |
+
var selected = '<?php if (isset($settings->api['cycle_day'])) {
|
101 |
+
echo $settings->api['cycle_day'];
|
102 |
+
} else {
|
103 |
+
echo '';
|
104 |
+
} ?>';
|
105 |
+
|
106 |
+
var select = (selected == obj[prop].day) ? 'selected' : '';
|
107 |
+
|
108 |
+
if ('' != select) {
|
109 |
+
checkbox.attr('checked', 'checked');
|
110 |
+
}
|
111 |
+
|
112 |
+
var option = '<option value="' + parseInt(obj[prop].day) + '" ' + select + '>Day ' +
|
113 |
+
obj[prop].day + ': ' + obj[prop].name + ' (' + obj[prop].status + ')' +
|
114 |
+
'</option>';
|
115 |
+
|
116 |
+
day_element.append(option);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
day_element.html('<option value="">no autoresponders</option>');
|
121 |
+
day_element.attr('disabled', 'disabled');
|
122 |
+
checkbox.attr('disabled', 'disabled');
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
getCycleDays();
|
127 |
+
</script>
|
128 |
+
|
129 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"/>
|
130 |
+
|
131 |
+
<div style="margin-left: 212px;">
|
132 |
+
<button style="margin-top: 12px;" id="gr_export" type="submit" name="Submit" class="save">
|
133 |
+
<span><span>Save subscription settings</span></span></button>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
</form>
|
137 |
+
</div>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>GetResponse</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>GetResponse integration</summary>
|
10 |
<description>GetResponse integration</description>
|
11 |
<notes>GetResponse Integration</notes>
|
12 |
-
<authors><author><name>GetResponse</name><user>
|
13 |
-
<date>2017-
|
14 |
-
<time>
|
15 |
-
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="GetresponseIntegration"><dir name="Getresponse"><dir name="Block"><dir name="Adminhtml"><file name="Adminblock.php" hash="0ad06d81dd175a56b4b90a2846617877"/></dir><file name="Getresponse.php" hash="32ca083c81b2d7f87357508061465118"/></dir><dir name="Helper"><file name="Api.php" hash="
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>GetResponse</name>
|
4 |
+
<version>1.0.7</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>GetResponse integration</summary>
|
10 |
<description>GetResponse integration</description>
|
11 |
<notes>GetResponse Integration</notes>
|
12 |
+
<authors><author><name>GetResponse</name><user>GetResponseIntegrations</user><email>grintegrations@getresponse.com</email></author></authors>
|
13 |
+
<date>2017-07-17</date>
|
14 |
+
<time>13:52:32</time>
|
15 |
+
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="GetresponseIntegration"><dir name="Getresponse"><dir name="Block"><dir name="Adminhtml"><file name="Adminblock.php" hash="0ad06d81dd175a56b4b90a2846617877"/></dir><file name="Getresponse.php" hash="32ca083c81b2d7f87357508061465118"/></dir><dir name="Helper"><file name="Api.php" hash="5292f3b49a6c2ee2b94f4ced48cb75a7"/><file name="Data.php" hash="c5bf1da28bcb8ad0e72741ef6fb1ee42"/><file name="GrApi.php" hash="5cb45e03022c4d5a720fe1ed1d148cf3"/><file name="GrShop.php" hash="6e8cc92c9327ba316d3cb2f8e26dd426"/></dir><dir name="Model"><file name="Account.php" hash="b45fd3eed3f4d05ab9c03ddc91ff17f6"/><file name="Automations.php" hash="3d8c1a129022a37f6c85b6faa33a4252"/><file name="Customs.php" hash="61d3a74890c0a11e441df94f2cfc1aba"/><file name="Observer.php" hash="34121e631d099735b53690462c272769"/><dir name="Resource"><dir name="Account"><file name="Collection.php" hash="624f58c7a83294650922d9a7a45b1974"/></dir><file name="Account.php" hash="9432375297daa51675b15b499c2646bb"/><dir name="Automations"><file name="Collection.php" hash="cacb1df3b9bf939bf5f25c9131a5bc28"/></dir><file name="Automations.php" hash="98a3b43796699e32047e3e126cc5bc02"/><dir name="Customs"><file name="Collection.php" hash="8c24203f9d7361e0f289a2a11476c76e"/></dir><file name="Customs.php" hash="7d02c5cb590197537d0395bcd6097403"/><dir name="Settings"><file name="Collection.php" hash="27cb24c2f12cb124e84a15317864ba05"/></dir><file name="Settings.php" hash="86aaed24693e442ad88f54f0fbd53758"/><file name="Setup.php" hash="aa38a1f6cc9e7e207d3e23ba14cb6044"/><file name="Shop.php" hash="ba84ea2eef9e534f254ad7bffc828dac"/><dir name="Webforms"><file name="Collection.php" hash="dd1576c1be5783b5fe312b2930dde00d"/></dir><file name="Webforms.php" hash="2aa38d6cbdc06b77d21d09cb1e84431b"/></dir><file name="Settings.php" hash="aed16cf6b22cec5edf7236a26b533a11"/><file name="Shop.php" hash="af6bf55bc719dac448851cba3a3a73c0"/><file name="Webforms.php" hash="a87719dc7c19812e7b65c99cbf749d6a"/></dir><dir name="controllers"><file name="IndexController.php" hash="52f7265f65c2aef76493608fbc5826aa"/><file name="ShopController.php" hash="0c42d97a689c6d4957233128929d917d"/></dir><dir name="etc"><file name="config.xml" hash="47fb8986ab7fcc2b293d67bab207d956"/></dir><dir name="sql"><dir name="getresponse_setup"><file name="install-1.0.0.php" hash="cb466ca6ca52f2069e7e2164023c3fcc"/><file name="upgrade-1.0.0-1.0.2.php" hash="28876ad063475894cc2ee1876cb02e90"/><file name="upgrade-1.0.2-1.0.3.php" hash="ecd044a1dab8ccc8a22d37b4c8d68bf8"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="GetresponseIntegration.xml" hash="be731e09168a813cb212b8fca5e965ee"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="getresponse_integration.xml" hash="47671a4fa68bc507e84ac249c4ae6c16"/></dir><dir name="template"><dir name="getresponse"><file name="account.phtml" hash="63008fca38ce2e2b1c14886d7087a0aa"/><file name="add_automation.phtml" hash="22acb48c46780566e267f90c2472e40d"/><file name="add_campaign.phtml" hash="650a91ce92255f78fc82e9c8f7b03800"/><file name="add_shop.phtml" hash="91140cae7e786333ea3e8d7df48f9fed"/><file name="apikey.phtml" hash="6fd5d3b170db5227de12be250b76a590"/><file name="automation.phtml" hash="f6a398a744de84f7a424cc7af896a5b9"/><file name="automation_js.phtml" hash="f3297dcf4c0832516ae862b93114d135"/><file name="export.phtml" hash="2df8f56dba76573ca6c969eb4ad0d43a"/><file name="menu.phtml" hash="04a51e387ff5ea97ba31fb130a152485"/><file name="newsletter.phtml" hash="94fa15fca6f9778a8d31c3e9eab89671"/><file name="shop.phtml" hash="504826a381e8f7ed611239cdca5cf94a"/><file name="viapage.phtml" hash="50c82ed634bbab27abbe4c23f79067b8"/><file name="viawebform.phtml" hash="6c7cd09828f700d05932414ce1c247b8"/><file name="webtraffic.phtml" hash="e0bce42aa52c268d073b644a61e31cb6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="getresponse"><dir><dir name="checkout"><file name="billing.extra.phtml" hash="2b71b0160320554c93055f31088301da"/></dir></dir><file name="webform.phtml" hash="c97a8bb5e55f512b751302716d3604ab"/></dir></dir><dir name="layout"><file name="getresponse.xml" hash="ccadd00312dba6de863f9c7c9cf6c92e"/></dir></dir></dir><dir name="default"><dir name="default"><dir name="template"><dir name="getresponse"><file name="getresponse.phtml" hash="5ee6103a36e4b98079680579e32b4ded"/></dir></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><file name="getresponse-custom-field.css" hash="6c57a9a936a3107fa2f271ade637aa44"/><file name="getresponse.css" hash="55b7516adda9c59c12b57a055db73776"/><dir><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="4d4e638960a1a29b0d6b693b445087da"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="d0cc3ffc3dc84d3a7c48867c75e2485f"/><file name="ui-bg_flat_10_000000_40x100.png" hash="c31d5fc3eb7d82c628a82e3b87024cd1"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="c17f552e8f4697d7608c57653af36df0"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="fe58c3539111d3021776e6833169c5e1"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="b624f702075cd719a38f428e143025ea"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="23932de7c235b03187b8a5de3d024490"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="0b708185ce8927f18c7b3b82a7e7c247"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="53acc69aaee6e2cb73b2021317e24af3"/><file name="ui-icons_222222_256x240.png" hash="4c27b34156b7a3776f31cc456ca01c10"/><file name="ui-icons_228ef1_256x240.png" hash="2f257489d9600ddf56d195a179ebc9df"/><file name="ui-icons_ef8c08_256x240.png" hash="772a64d6df4b93d230e9b38e1ab7522a"/><file name="ui-icons_ffd27a_256x240.png" hash="6686d21b904e18b100210169bb1c04ad"/><file name="ui-icons_ffffff_256x240.png" hash="a19fe1b2d726e920c12e43a65df9039a"/></dir></dir><file name="jquery-ui.min.css" hash="26812a28850395f8f865be4893fb20c7"/><file name="jquery.switchButton.css" hash="afa60ae180e5d2d5ed65bf5feba96be1"/></dir><dir name="images"><dir name="getresponse"><file name="getresponse_icons.png" hash="ad368ba26172b3a90d8fe373eec0cd52"/><file name="loader.big.white.gif" hash="f27ae53fdc1c8c55f0d249b72592d75d"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="getresponse"><file name="getresponse-custom-field.src-verified.js" hash="5643f2df123db3ec92be40dc139703ea"/><file name="jquery-1.11.3.min.js" hash="895323ed2f7258af4fae2c738c8aea49"/><file name="jquery-ui.min.js" hash="d935d506ae9c8dd9e0f96706fbb91f65"/><file name="jquery.noconflict.js" hash="09bfdd3b964eb2b17b5d6caa1d20a607"/><file name="jquery.switchButton.js" hash="86aeb2caefce157c567434ef972f670b"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.4.0</min><max>5.6.50</max></php></required></dependencies>
|
18 |
</package>
|
skin/adminhtml/default/default/css/getresponse.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
.GR_label { display: inline-block !important; width:
|
2 |
.GR_label_short { display: inline-block !important; width: 210px !important; font-weight: 600;}
|
3 |
.GR_input { width: 250px !important; }
|
4 |
.GR_api { width: 320px !important; }
|
1 |
+
.GR_label { display: inline-block !important; width: 325px !important; font-weight: 600;}
|
2 |
.GR_label_short { display: inline-block !important; width: 210px !important; font-weight: 600;}
|
3 |
.GR_input { width: 250px !important; }
|
4 |
.GR_api { width: 320px !important; }
|