Version Notes
Bugfix: Customer registration as newsletter subscriber
Download this release
Release Info
Developer | Conlabz GmbH |
Extension | Conlabz_CrConnect |
Version | 3.1.6 |
Comparing to | |
See all releases |
Code changes from version 3.1.5 to 3.1.6
app/code/community/Conlabz/CrConnect/Model/Api.php
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
|
4 |
{
|
|
|
5 |
|
6 |
const SUCCESS_STATUS = "SUCCESS";
|
7 |
|
@@ -386,8 +387,8 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
|
|
386 |
|
387 |
/**
|
388 |
*
|
389 |
-
* @param
|
390 |
-
* @param
|
391 |
* @return boolean
|
392 |
*/
|
393 |
public function formsSendActivationMail($customer, $groupId = 0)
|
@@ -534,26 +535,30 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
|
|
534 |
return $syncedUsers;
|
535 |
}
|
536 |
|
537 |
-
public function
|
538 |
{
|
539 |
//Check if we connected to Cr account
|
540 |
if (!$this->isConnected()) {
|
541 |
return false;
|
542 |
}
|
543 |
|
544 |
-
$
|
|
|
|
|
|
|
545 |
|
546 |
try {
|
547 |
-
$
|
548 |
-
$groups = $this->_helper->getGroupsIds();
|
549 |
foreach ($groups as $groupId) {
|
550 |
-
$
|
|
|
|
|
551 |
}
|
|
|
552 |
} catch (Exception $e) {
|
553 |
Mage::logException($e);
|
554 |
-
return false;
|
555 |
}
|
556 |
-
return
|
557 |
}
|
558 |
|
559 |
public function setupGroupFields($listId)
|
@@ -577,17 +582,21 @@ class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
|
|
577 |
"store" => "store"
|
578 |
);
|
579 |
|
580 |
-
$
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
|
|
589 |
}
|
590 |
}
|
|
|
|
|
|
|
591 |
return $return;
|
592 |
|
593 |
}
|
2 |
|
3 |
class Conlabz_CrConnect_Model_Api extends Mage_Core_Model_Abstract
|
4 |
{
|
5 |
+
private $_apiKey;
|
6 |
|
7 |
const SUCCESS_STATUS = "SUCCESS";
|
8 |
|
387 |
|
388 |
/**
|
389 |
*
|
390 |
+
* @param Mage_Customer_Model_Customer $customer
|
391 |
+
* @param int $groupId
|
392 |
* @return boolean
|
393 |
*/
|
394 |
public function formsSendActivationMail($customer, $groupId = 0)
|
535 |
return $syncedUsers;
|
536 |
}
|
537 |
|
538 |
+
public function setupDefaultCleverReachList()
|
539 |
{
|
540 |
//Check if we connected to Cr account
|
541 |
if (!$this->isConnected()) {
|
542 |
return false;
|
543 |
}
|
544 |
|
545 |
+
if (empty($this->_apiKey))
|
546 |
+
{
|
547 |
+
return false;
|
548 |
+
}
|
549 |
|
550 |
try {
|
551 |
+
$groups = array($this->_helper->getDefaultListId()) + $this->_helper->getGroupsIds();
|
|
|
552 |
foreach ($groups as $groupId) {
|
553 |
+
if ( ! ($groupFields = $this->setupGroupFields($groupId))) {
|
554 |
+
return false;
|
555 |
+
}
|
556 |
}
|
557 |
+
return true;
|
558 |
} catch (Exception $e) {
|
559 |
Mage::logException($e);
|
|
|
560 |
}
|
561 |
+
return false;
|
562 |
}
|
563 |
|
564 |
public function setupGroupFields($listId)
|
582 |
"store" => "store"
|
583 |
);
|
584 |
|
585 |
+
$groupDetails = $this->_client->groupGetDetails($this->_apiKey, $listId);
|
586 |
+
|
587 |
+
if ($groupDetails->status !== self::SUCCESS_STATUS) {
|
588 |
+
$this->_helper->log("CleverReach Connection Error: " . $groupDetails);
|
589 |
+
return $groupDetails;
|
590 |
+
}
|
591 |
+
|
592 |
+
foreach ($groupDetails->data->attributes as $a) {
|
593 |
+
if (in_array($a->key, $fields)) {
|
594 |
+
unset($fields[$a->key]);
|
595 |
}
|
596 |
}
|
597 |
+
foreach ($fields as $field) {
|
598 |
+
$return = $this->_client->groupAttributeAdd($this->_apiKey, $listId, $field, "text", "");
|
599 |
+
}
|
600 |
return $return;
|
601 |
|
602 |
}
|
app/code/community/Conlabz/CrConnect/Model/Observer.php
CHANGED
@@ -213,7 +213,7 @@ class Conlabz_CrConnect_Model_Observer
|
|
213 |
$allow = false;
|
214 |
}
|
215 |
if (!$allow) {
|
216 |
-
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Double Opt-In enabled, please select
|
217 |
}
|
218 |
}
|
219 |
}
|
@@ -222,11 +222,9 @@ class Conlabz_CrConnect_Model_Observer
|
|
222 |
{
|
223 |
$session = Mage::getSingleton('adminhtml/session');
|
224 |
|
225 |
-
$setupResult = Mage::getModel('crconnect/api')->
|
226 |
if (!$setupResult) {
|
227 |
-
$session->addError("Could not connect to CleverReach. Please check your API
|
228 |
-
} elseif ($setupResult->status == "ERROR" && $setupResult->statuscode != 50) {
|
229 |
-
$session->addError("Cleverreach connection Error: " . $setupResult->message);
|
230 |
}
|
231 |
}
|
232 |
}
|
213 |
$allow = false;
|
214 |
}
|
215 |
if (!$allow) {
|
216 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('Double Opt-In is enabled, please select form(s) and group(s) for your customer groups.'));
|
217 |
}
|
218 |
}
|
219 |
}
|
222 |
{
|
223 |
$session = Mage::getSingleton('adminhtml/session');
|
224 |
|
225 |
+
$setupResult = Mage::getModel('crconnect/api')->setupDefaultCleverReachList();
|
226 |
if (!$setupResult) {
|
227 |
+
$session->addError("Could not connect to or receive any data from CleverReach. Please check your API key, selected group(s) and form(s).");
|
|
|
|
|
228 |
}
|
229 |
}
|
230 |
}
|
app/code/community/Conlabz/CrConnect/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Conlabz_CrConnect>
|
5 |
-
<version>3.1.
|
6 |
</Conlabz_CrConnect>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Conlabz_CrConnect>
|
5 |
+
<version>3.1.6</version>
|
6 |
</Conlabz_CrConnect>
|
7 |
</modules>
|
8 |
<global>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Conlabz_CrConnect</name>
|
4 |
-
<version>3.1.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>With CleverReach (http://www.cleverreach.de) you can create professional emails online, dispatch them reliably, track their success and manage receivers. CleverReach is equipped with a particularly user-friendly interface, which you can use intuitively and without special knowledge.</description>
|
11 |
<notes>Bugfix: Customer registration as newsletter subscriber</notes>
|
12 |
<authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
|
13 |
-
<date>2016-04-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="Conlabz"><dir name="CrConnect"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Newsletter.php" hash="ff47d3028a8e766077ee78affd52eea6"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="e1b516bc593a41bcc6d00b259776c8b8"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="da3907dba74081f724f23b7a6b6df255"/><file name="Key.php" hash="44c2fc49a5b97cdacec1cada7a256a88"/><file name="Url.php" hash="becf4140ce0997e95548b758d8b7ed68"/></dir><dir name="Customer"><file name="Newsletter.php" hash="1acc2f35d1c67e8e15640c3117a00dfd"/></dir><file name="Groupsapis.php" hash="f20a158b439469cdd498b16cc459ab4a"/></dir><dir name="Helper"><file name="Data.php" hash="9e9584f6771982ee8eba5a59155d02dd"/></dir><dir name="Model"><file name="Api.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Conlabz_CrConnect</name>
|
4 |
+
<version>3.1.6</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU General Public License</license>
|
7 |
<channel>community</channel>
|
10 |
<description>With CleverReach (http://www.cleverreach.de) you can create professional emails online, dispatch them reliably, track their success and manage receivers. CleverReach is equipped with a particularly user-friendly interface, which you can use intuitively and without special knowledge.</description>
|
11 |
<notes>Bugfix: Customer registration as newsletter subscriber</notes>
|
12 |
<authors><author><name>conlabz GmbH</name><user>conlabz</user><email>info@conlabz.de</email></author></authors>
|
13 |
+
<date>2016-04-11</date>
|
14 |
+
<time>13:29:36</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Conlabz"><dir name="CrConnect"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Newsletter.php" hash="ff47d3028a8e766077ee78affd52eea6"/></dir></dir></dir><dir name="Newsletter"><file name="Subscriber.php" hash="e1b516bc593a41bcc6d00b259776c8b8"/></dir></dir><dir name="Config"><file name="GroupsApis.php" hash="da3907dba74081f724f23b7a6b6df255"/><file name="Key.php" hash="44c2fc49a5b97cdacec1cada7a256a88"/><file name="Url.php" hash="becf4140ce0997e95548b758d8b7ed68"/></dir><dir name="Customer"><file name="Newsletter.php" hash="1acc2f35d1c67e8e15640c3117a00dfd"/></dir><file name="Groupsapis.php" hash="f20a158b439469cdd498b16cc459ab4a"/></dir><dir name="Helper"><file name="Data.php" hash="9e9584f6771982ee8eba5a59155d02dd"/></dir><dir name="Model"><file name="Api.php" hash="c1085f6baf13328cbe78034b65f481fc"/><dir name="Checkout"><file name="Observer.php" hash="8fd916c7332ce6ebfa9197666c2987a9"/></dir><dir name="Customer"><file name="Observer.php" hash="878370bd5958b3813f0b90f395b27ecf"/></dir><dir name="Newsletter"><file name="Subscriber.php" hash="96e4b452bf916d5afa209cb80192eba0"/></dir><file name="Observer.php" hash="92c2338e8e4223deefaa494f46955013"/><file name="Search.php" hash="5419d8b49f901e2d28eff3d57ae9de4f"/><file name="Subscriber.php" hash="3e3698a40f540a038ad4dc56e1975070"/><dir name="System"><dir name="Config"><dir name="Source"><file name="EmptyForms.php" hash="910b9588b11edf73be1fc0103e49b997"/><file name="EmptyList.php" hash="6fe676d12ff5fa9231c3b0869b1ec750"/></dir></dir></dir><dir name="Website"><file name="Observer.php" hash="6c068fc61ae6ed512cbdce2a28f48cb7"/></dir></dir><dir name="Test"><dir name="Config"><file name="ActivationXml.php" hash="0270720ffc36ea493b9c976377bdfdcd"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CrconfigController.php" hash="5d60907f68efc7722e8c3ca1426ef2f3"/><file name="CrconnectController.php" hash="fa3cb1d4f515cabd0e378715258db203"/></dir><file name="HookController.php" hash="2c81dd3ebd9310ca86afc732b2e2d1c6"/><file name="ManageController.php" hash="12ff08a154cb21dc0fe4fed3cd718d1c"/><file name="SearchController.php" hash="0141ec8a414c86619ff63c6a856af470"/><file name="SubscriberController.php" hash="3bbf81a698e630d4a04f638a53ecd3e9"/><file name="UnsubscribeController.php" hash="eaba3ee3bef995d4bb6f7e17b1709585"/></dir><dir name="etc"><file name="adminhtml.xml" hash="05f8a5b43c8abe877f05e09eec5d8c65"/><file name="config.xml" hash="9c656ab90305b292dbc1b5a5f03fbe85"/><file name="jstranslator.xml" hash="040e5e790dcae18ddf223d54e38e45b0"/><file name="system.xml" hash="634952e319523e7640152ddaeedeaef9"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Conlabz_CrConnect.xml" hash="dd6482e7f0daedb3387e80bdff66f321"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="dd115195559fe2058fbd6fbdceabdddc"/></dir><dir name="template"><dir name="crconnect"><dir name="customer"><dir name="account"><dir name="dashboard"><file name="info.phtml" hash="a533451e27b90284d3414e391b460231"/></dir></dir><dir name="form"><file name="newsletter.phtml" hash="4a1309d0d6d2587c8534dd4a1ccdf235"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="crconnect.xml" hash="fac2e1194c8c007a54abfe3e82fd6834"/></dir><dir name="template"><dir name="crconnect"><file name="config.phtml" hash="9f2232c8311fa439434d8023181a7ab5"/><dir name="newsletter"><dir name="subscriber"><file name="list.phtml" hash="2d7dd105e2c543d19746ada03fa54ff8"/></dir></dir><dir name="system"><dir name="config"><dir name="form"><dir name="field"><file name="array_groups.phtml" hash="ac84db9b1e8b342337a478ecba62e0b1"/><file name="cr_array_groups.phtml" hash="c924ef81c5699817327580eb7b8a2e86"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Conlabz_CleverReach.csv" hash="4cb844c7288d9995d21d39eb4015fa44"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="images"><dir name="cleverreach"><file name="cleverreach-logo.png" hash="bff60f831ca9e1dc9bcbdb2e3f5a5805"/></dir></dir><dir name="js"><file name="crconnect.js" hash="72c951b0b46862253c7159255d82b2e0"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|