Version Notes
GetResponse Integration
Download this release
Release Info
Developer | GetResponse |
Extension | GetResponse |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- app/code/community/GetresponseIntegration/Getresponse/Helper/Api.php +21 -33
- app/code/community/GetresponseIntegration/Getresponse/Helper/GrApi.php +6 -7
- app/code/community/GetresponseIntegration/Getresponse/Model/Customs.php +4 -3
- app/code/community/GetresponseIntegration/Getresponse/controllers/IndexController.php +1 -3
- app/code/community/GetresponseIntegration/Getresponse/etc/config.xml +1 -1
- package.xml +4 -4
app/code/community/GetresponseIntegration/Getresponse/Helper/Api.php
CHANGED
@@ -13,14 +13,6 @@ class GetresponseIntegration_Getresponse_Helper_Api extends Mage_Core_Helper_Abs
|
|
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
|
26 |
*/
|
@@ -76,18 +68,19 @@ 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 |
}
|
88 |
|
89 |
-
$this->all_custom_fields = $this->get_custom_fields();
|
90 |
-
|
91 |
$contact = $this->getContact($email, $campaign);
|
92 |
|
93 |
// If contact already exists in gr account.
|
@@ -160,28 +153,23 @@ class GetresponseIntegration_Getresponse_Helper_Api extends Mage_Core_Helper_Abs
|
|
160 |
}
|
161 |
|
162 |
foreach ($user_customs as $name => $value) {
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
$custom_fields[] = array('customFieldId' => $custom->customFieldId,
|
181 |
-
'value' => is_array($value) ? $value : array($value)
|
182 |
-
);
|
183 |
-
}
|
184 |
-
}
|
185 |
}
|
186 |
|
187 |
return $custom_fields;
|
13 |
self::CONTACT_ERROR => 'Not added'
|
14 |
);
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Getresponse API instance
|
18 |
*/
|
68 |
public function addContact($campaign, $name, $email, $cycle_day = '', $user_customs = array())
|
69 |
{
|
70 |
$params = array(
|
|
|
71 |
'email' => $email,
|
72 |
'campaign' => array('campaignId' => $campaign),
|
73 |
'ipAddress' => $_SERVER['REMOTE_ADDR'],
|
74 |
);
|
75 |
|
76 |
+
if (!empty(trim($name))) {
|
77 |
+
$params['name'] = trim($name);
|
78 |
+
}
|
79 |
+
|
80 |
if (is_numeric($cycle_day) && $cycle_day >= 0) {
|
81 |
$params['dayOfCycle'] = $cycle_day;
|
82 |
}
|
83 |
|
|
|
|
|
84 |
$contact = $this->getContact($email, $campaign);
|
85 |
|
86 |
// If contact already exists in gr account.
|
153 |
}
|
154 |
|
155 |
foreach ($user_customs as $name => $value) {
|
156 |
+
$customs = (array) $this->grapi()->get_custom_fields(array('query[name]' => $name));
|
157 |
+
$custom = reset($customs);
|
158 |
+
|
159 |
+
// custom field not found - create new
|
160 |
+
if (empty($custom) || empty($custom->customFieldId)) {
|
161 |
+
$custom = $this->grapi()->add_custom_field(array(
|
162 |
+
'name' => $name,
|
163 |
+
'type' => is_array($value) ? "checkbox" : "text",
|
164 |
+
'hidden' => "false",
|
165 |
+
'values' => is_array($value) ? $value : array($value),
|
166 |
+
));
|
167 |
+
}
|
168 |
+
|
169 |
+
$custom_fields[] = array(
|
170 |
+
'customFieldId' => $custom->customFieldId,
|
171 |
+
'value' => is_array($value) ? $value : array($value)
|
172 |
+
);
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
return $custom_fields;
|
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);
|
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);
|
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/controllers/IndexController.php
CHANGED
@@ -807,7 +807,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 +824,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 +844,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,
|
807 |
}
|
808 |
|
809 |
$custom_fields = !empty($params['gr_custom_field']) ? $params['gr_custom_field'] : array();
|
|
|
810 |
|
811 |
if ( !empty($params['gr_custom_field'])) {
|
812 |
foreach ($params['gr_custom_field'] as $field_key => $field_value) {
|
824 |
'error' => 0,
|
825 |
];
|
826 |
|
|
|
827 |
if ( !empty($subscribers)) {
|
828 |
foreach ($subscribers as $subscriber) {
|
829 |
$customer = Mage::getResourceModel('customer/customer_collection')
|
844 |
if (!empty($customer)) {
|
845 |
$name = $customer->getName();
|
846 |
} else {
|
847 |
+
$name = null;
|
848 |
}
|
849 |
$result = Mage::helper('getresponse/api')->addContact(
|
850 |
$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 |
|
1 |
<config>
|
2 |
<modules>
|
3 |
<GetresponseIntegration_Getresponse>
|
4 |
+
<version>1.0.5</version>
|
5 |
</GetresponseIntegration_Getresponse>
|
6 |
</modules>
|
7 |
|
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>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>GetResponse integration</description>
|
11 |
<notes>GetResponse Integration</notes>
|
12 |
<authors><author><name>GetResponse</name><user>gstruczynski</user><email>gstruczynski@getresponse.com</email></author></authors>
|
13 |
-
<date>2017-05-
|
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.2.0</min><max>5.6.50</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>GetResponse</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
10 |
<description>GetResponse integration</description>
|
11 |
<notes>GetResponse Integration</notes>
|
12 |
<authors><author><name>GetResponse</name><user>gstruczynski</user><email>gstruczynski@getresponse.com</email></author></authors>
|
13 |
+
<date>2017-05-23</date>
|
14 |
+
<time>12:07:21</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="9d344b6a616d0cb5faaf9d2790b1d6a4"/><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="e9a66d6f03d7bf18600a7f7cf537f819"/><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="d2b1ab6d8a99c6db554de7d3b9abaaba"/><file name="ShopController.php" hash="0c42d97a689c6d4957233128929d917d"/></dir><dir name="etc"><file name="config.xml" hash="82760cd406f2283154988b8debfe5f45"/></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"/></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="487e39383d3b92034a5d089a25c44dbc"/><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="fb10f2de00eb86b15d5ddc1299214b51"/><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.2.0</min><max>5.6.50</max></php></required></dependencies>
|
18 |
</package>
|