Rejoiner - Version 1.1.5

Version Notes

Automated Webhook conversion tracking was added to extend the standard tracking functionality

Download this release

Release Info

Developer Magento Core Team
Extension Rejoiner
Version 1.1.5
Comparing to
See all releases


Code changes from version 1.1.4 to 1.1.5

app/code/community/Rejoiner/Acr/Model/Observer.php CHANGED
@@ -1,6 +1,14 @@
1
<?php
2
class Rejoiner_Acr_Model_Observer
3
{
4
public function orderSuccess(Varien_Event_Observer $observer)
5
{
6
@@ -25,5 +33,51 @@ class Rejoiner_Acr_Model_Observer
25
Mage::log('Error while sending email to remove@rejoiner.com');
26
}
27
}
28
}
29
}
1
<?php
2
class Rejoiner_Acr_Model_Observer
3
{
4
+ const REJOINER_API_URL = 'https://app.rejoiner.com';
5
+ const REJOINER_API_REQUEST_PATH = '/api/1.0/site/%s/lead/convert';
6
+ const REJOINER_API_LOG_FILE = 'rejoiner_api.log';
7
+
8
+ const XML_PATH_REJOINER_API_KEY = 'checkout/rejoiner_acr/api_key';
9
+ const XML_PATH_REJOINER_API_SECRET = 'checkout/rejoiner_acr/api_secret';
10
+ const XML_PATH_REJOINER_API_SITE_ID = 'checkout/rejoiner_acr/site_id';
11
+
12
public function orderSuccess(Varien_Event_Observer $observer)
13
{
14
33
Mage::log('Error while sending email to remove@rejoiner.com');
34
}
35
}
36
+ $this->_trackOrderSuccessConversion($observer);
37
+ }
38
+
39
+ protected function _trackOrderSuccessConversion(Varien_Event_Observer $observer)
40
+ {
41
+ /** @var Mage_Checkout_Model_Session $session */
42
+ $lastOrderId = $observer->getEvent()->getData('order_ids');
43
+ /** @var Mage_Sales_Model_Order $order */
44
+ $order = Mage::getModel('sales/order')->load($lastOrderId[0]);
45
+ $customerEmail = $order->getBillingAddress()->getEmail();
46
+ $apiKey = Mage::getStoreConfig(self::XML_PATH_REJOINER_API_KEY);
47
+ $apiSecret = utf8_encode(Mage::getStoreConfig(self::XML_PATH_REJOINER_API_SECRET));
48
+ $siteId = Mage::getStoreConfig(self::XML_PATH_REJOINER_API_SITE_ID);
49
+ $requestPath = sprintf(self::REJOINER_API_REQUEST_PATH, $siteId);
50
+ $requestBody = utf8_encode(sprintf('{"email": "%s"}', $customerEmail));
51
+ $hmacData = utf8_encode(implode("\n", array(Varien_Http_Client::POST, $requestPath, $requestBody)));
52
+
53
+ if ($apiKey && $apiSecret) {
54
+ $codedApiSecret = base64_encode(hash_hmac('sha1', $hmacData, $apiSecret, true));
55
+ $authorization = sprintf('Rejoiner %s:%s', $apiKey , $codedApiSecret);
56
+ $client = new Varien_Http_Client(self::REJOINER_API_URL . $requestPath);
57
+ $client->setRawData($requestBody);
58
+ $client->setHeaders(array('Authorization' => $authorization, 'Content-type' => 'application/json;' ));
59
+ try{
60
+ $response = $client->request(Varien_Http_Client::POST);
61
+ switch ($response->getStatus()) {
62
+ case '200':
63
+ Mage::log(print_r($response->getStatus(), true) . ' Everything is alright.', null, self::REJOINER_API_LOG_FILE);
64
+ break;
65
+ case '400':
66
+ Mage::log(print_r($response->getStatus(), true) . ' required params were not specified and/or the body was malformed', null, self::REJOINER_API_LOG_FILE);
67
+ break;
68
+ case '403':
69
+ Mage::log(print_r($response->getStatus(), true) . ' failed authentication and/or incorrect signature', null, self::REJOINER_API_LOG_FILE);
70
+ break;
71
+ case '500':
72
+ Mage::log(print_r($response->getStatus(), true) . ' internal error, contact us for details', null, self::REJOINER_API_LOG_FILE);
73
+ break;
74
+ default:
75
+ Mage::log(print_r($response->getStatus(), true) . ' unexpected response code', null, self::REJOINER_API_LOG_FILE);
76
+ break;
77
+ }
78
+ } catch (Exception $e) {
79
+ Mage::log($e->getMessage(), null, 'exception.log');
80
+ }
81
+ }
82
}
83
}
app/code/community/Rejoiner/Acr/etc/system.xml CHANGED
@@ -21,19 +21,35 @@
21
<show_in_store>1</show_in_store>
22
</enabled>
23
<site_id translate="label">
24
- <label>Rejoined site-id</label>
25
<frontend_type>text</frontend_type>
26
<sort_order>20</sort_order>
27
<show_in_default>1</show_in_default>
28
<show_in_website>1</show_in_website>
29
<show_in_store>1</show_in_store>
30
</site_id>
31
<domain translate="label">
32
<label>Store Domain *</label>
33
<!--<comment>Required field</comment>-->
34
<validate>required-entry</validate>
35
<frontend_type>text</frontend_type>
36
- <sort_order>20</sort_order>
37
<show_in_default>1</show_in_default>
38
<show_in_website>1</show_in_website>
39
<show_in_store>1</show_in_store>
@@ -43,7 +59,7 @@
43
<frontend_type>select</frontend_type>
44
<source_model>adminhtml/system_config_source_yesno</source_model>
45
<comment>Email Rejoiner when a successful order occurs</comment>
46
- <sort_order>40</sort_order>
47
<show_in_default>1</show_in_default>
48
<show_in_website>1</show_in_website>
49
<show_in_store>1</show_in_store>
@@ -53,7 +69,7 @@
53
<frontend_type>select</frontend_type>
54
<comment>Enable this parameter if you want to track phone numbers.</comment>
55
<source_model>adminhtml/system_config_source_yesno</source_model>
56
- <sort_order>30</sort_order>
57
<show_in_default>1</show_in_default>
58
<show_in_website>1</show_in_website>
59
<show_in_store>1</show_in_store>
@@ -63,7 +79,7 @@
63
<frontend_type>select</frontend_type>
64
<comment>If a user returns to the cart, the form fields will repopulate with the data they previously entered (excludes credit card numbers).</comment>
65
<source_model>adminhtml/system_config_source_yesno</source_model>
66
- <sort_order>30</sort_order>
67
<show_in_default>1</show_in_default>
68
<show_in_website>1</show_in_website>
69
<show_in_store>1</show_in_store>
@@ -72,7 +88,7 @@
72
<label>Generate Coupon Code</label>
73
<frontend_type>select</frontend_type>
74
<source_model>adminhtml/system_config_source_yesno</source_model>
75
- <sort_order>50</sort_order>
76
<show_in_default>1</show_in_default>
77
<show_in_website>1</show_in_website>
78
<show_in_store>1</show_in_store>
@@ -81,7 +97,7 @@
81
<label>Select Shopping Cart Price Rule</label>
82
<frontend_type>select</frontend_type>
83
<source_model>rejoiner_acr/system_config_source_salesrule</source_model>
84
- <sort_order>60</sort_order>
85
<show_in_default>1</show_in_default>
86
<show_in_website>1</show_in_website>
87
<show_in_store>1</show_in_store>
21
<show_in_store>1</show_in_store>
22
</enabled>
23
<site_id translate="label">
24
+ <label>Rejoiner site-id</label>
25
<frontend_type>text</frontend_type>
26
<sort_order>20</sort_order>
27
<show_in_default>1</show_in_default>
28
<show_in_website>1</show_in_website>
29
<show_in_store>1</show_in_store>
30
</site_id>
31
+ <api_key translate="label">
32
+ <label>Rejoiner API key</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>30</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </api_key>
39
+ <api_secret translate="label">
40
+ <label>Rejoiner API secret</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>40</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </api_secret>
47
<domain translate="label">
48
<label>Store Domain *</label>
49
<!--<comment>Required field</comment>-->
50
<validate>required-entry</validate>
51
<frontend_type>text</frontend_type>
52
+ <sort_order>50</sort_order>
53
<show_in_default>1</show_in_default>
54
<show_in_website>1</show_in_website>
55
<show_in_store>1</show_in_store>
59
<frontend_type>select</frontend_type>
60
<source_model>adminhtml/system_config_source_yesno</source_model>
61
<comment>Email Rejoiner when a successful order occurs</comment>
62
+ <sort_order>60</sort_order>
63
<show_in_default>1</show_in_default>
64
<show_in_website>1</show_in_website>
65
<show_in_store>1</show_in_store>
69
<frontend_type>select</frontend_type>
70
<comment>Enable this parameter if you want to track phone numbers.</comment>
71
<source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>70</sort_order>
73
<show_in_default>1</show_in_default>
74
<show_in_website>1</show_in_website>
75
<show_in_store>1</show_in_store>
79
<frontend_type>select</frontend_type>
80
<comment>If a user returns to the cart, the form fields will repopulate with the data they previously entered (excludes credit card numbers).</comment>
81
<source_model>adminhtml/system_config_source_yesno</source_model>
82
+ <sort_order>80</sort_order>
83
<show_in_default>1</show_in_default>
84
<show_in_website>1</show_in_website>
85
<show_in_store>1</show_in_store>
88
<label>Generate Coupon Code</label>
89
<frontend_type>select</frontend_type>
90
<source_model>adminhtml/system_config_source_yesno</source_model>
91
+ <sort_order>90</sort_order>
92
<show_in_default>1</show_in_default>
93
<show_in_website>1</show_in_website>
94
<show_in_store>1</show_in_store>
97
<label>Select Shopping Cart Price Rule</label>
98
<frontend_type>select</frontend_type>
99
<source_model>rejoiner_acr/system_config_source_salesrule</source_model>
100
+ <sort_order>100</sort_order>
101
<show_in_default>1</show_in_default>
102
<show_in_website>1</show_in_website>
103
<show_in_store>1</show_in_store>
app/locale/en_US/Rejoiner_Acr.csv CHANGED
@@ -1,5 +1,7 @@
1
"Rejoiner Abandoned Cart Recovery","Rejoiner Abandoned Cart Recovery"
2
- "Rejoined site-id","Rejoined site-id"
3
"It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email","It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email"
4
"to verify that your Rejoiner tags are injecting properly", "to verify that your Rejoiner tags are injecting properly"
5
"Never show this message again", "Never show this message again"
1
"Rejoiner Abandoned Cart Recovery","Rejoiner Abandoned Cart Recovery"
2
+ "Rejoiner site-id","Rejoiner site-id"
3
+ "Rejoiner API key","Rejoiner API key"
4
+ "Rejoiner API secret","Rejoiner API secret"
5
"It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email","It looks like your checkout configuration has been modified by another extension. This is not always an issue, but please email"
6
"to verify that your Rejoiner tags are injecting properly", "to verify that your Rejoiner tags are injecting properly"
7
"Never show this message again", "Never show this message again"
package.xml CHANGED
@@ -1,18 +1,18 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Rejoiner</name>
4
- <version>1.1.4</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Rejoiner Cart Abandonment Remarketing</summary>
10
<description>Minor changes in rejoiner notifications functionality.</description>
11
- <notes>Improved functionality that fetches product images and placeholders.</notes>
12
<authors><author><name>Mike</name><user>auto-converted</user><email>mike@rejoiner.com</email></author></authors>
13
- <date>2014-07-16</date>
14
- <time>09:12:48</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash="1aad3601804cead81b6e687dfcb5b83f"/></dir></target><target name="magecommunity"><dir name="Rejoiner"><dir name="Acr"><dir name="Block"><dir name="Adminhtml"><file name="Notification.php" hash="4b4837b59ab85fa886e65be49d511490"/></dir><file name="Snippets.php" hash="01213375204319c257a3b11e8a04e735"/></dir><dir name="Helper"><file name="Data.php" hash="6bf5f57f4e0c5f394432749d2bafa158"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="1b6a8d728b5fa308b18a222c5981ed52"/></dir></dir></dir><file name="Notification.php" hash="a03d68e9bbaa820ce87557fca9f8f811"/><file name="Observer.php" hash="df2d853ad73acab825dcae806c1e23e1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RejoinerController.php" hash="c2e5fea12a2fc23905d86f119c2baa39"/></dir><file name="AddtocartController.php" hash="9a11506f06aa714dc520ee8cf7a87696"/></dir><dir name="etc"><file name="config.xml" hash="7599dc7571149cb04bc66061590d9207"/><file name="system.xml" hash="7e3be6d652a90327fbb5c6d3d198f5a2"/></dir><dir name="sql"><dir name="rejoiner_setup"><file name="mysql4-install-1.0.0.0.php" hash="8d9a21c9c09fe44c6fe51ddd2106e3e0"/><file name="mysql4-upgrade-1.0.0.0-1.0.1.0.php" hash="36cc70cc6dd37aab7f3c460e0af58d59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="ac5de6f021a440fe3bc1359133406ba7"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="conversion.phtml" hash="13a53b2f28e5f5fa6e0644ea9cf5a6a4"/><file name="email.phtml" hash="05e54d0999953acf865b6a439c4bb6b5"/><file name="tracking.phtml" hash="1fb47f23cd14449a3978c12bb320fdd4"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="3181cf1ca63813a9ce633ed3268659f4"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="3a3872e6434bf7d2ca7fa0edfe6f9726"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="ca059e55cd2380cd1d7af351fa00d9cf"/></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Rejoiner</name>
4
+ <version>1.1.5</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Rejoiner Cart Abandonment Remarketing</summary>
10
<description>Minor changes in rejoiner notifications functionality.</description>
11
+ <notes>Automated Webhook conversion tracking was added to extend the standard tracking functionality</notes>
12
<authors><author><name>Mike</name><user>auto-converted</user><email>mike@rejoiner.com</email></author></authors>
13
+ <date>2014-07-21</date>
14
+ <time>14:10:50</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Rejoiner_Acr.xml" hash="1aad3601804cead81b6e687dfcb5b83f"/></dir></target><target name="magecommunity"><dir name="Rejoiner"><dir name="Acr"><dir name="Block"><dir name="Adminhtml"><file name="Notification.php" hash="4b4837b59ab85fa886e65be49d511490"/></dir><file name="Snippets.php" hash="01213375204319c257a3b11e8a04e735"/></dir><dir name="Helper"><file name="Data.php" hash="6bf5f57f4e0c5f394432749d2bafa158"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="48f66ad159e3d10a21cc04a980ca923e"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Salesrule.php" hash="1b6a8d728b5fa308b18a222c5981ed52"/></dir></dir></dir><file name="Notification.php" hash="a03d68e9bbaa820ce87557fca9f8f811"/><file name="Observer.php" hash="4709c0114a9f95c455eccc3ef731f2ec"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RejoinerController.php" hash="c2e5fea12a2fc23905d86f119c2baa39"/></dir><file name="AddtocartController.php" hash="9a11506f06aa714dc520ee8cf7a87696"/></dir><dir name="etc"><file name="config.xml" hash="7599dc7571149cb04bc66061590d9207"/><file name="system.xml" hash="2a128aff548ea844225e7d7eb7cd814b"/></dir><dir name="sql"><dir name="rejoiner_setup"><file name="mysql4-install-1.0.0.0.php" hash="8d9a21c9c09fe44c6fe51ddd2106e3e0"/><file name="mysql4-upgrade-1.0.0.0-1.0.1.0.php" hash="36cc70cc6dd37aab7f3c460e0af58d59"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="ac5de6f021a440fe3bc1359133406ba7"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="conversion.phtml" hash="13a53b2f28e5f5fa6e0644ea9cf5a6a4"/><file name="email.phtml" hash="05e54d0999953acf865b6a439c4bb6b5"/><file name="tracking.phtml" hash="1fb47f23cd14449a3978c12bb320fdd4"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="rejoiner_acr.xml" hash="3181cf1ca63813a9ce633ed3268659f4"/></dir><dir name="template"><dir name="rejoiner_acr"><file name="notification.phtml" hash="3a3872e6434bf7d2ca7fa0edfe6f9726"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Rejoiner_Acr.csv" hash="9015e31d97b9bc4746bc0a5241f8013b"/></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>