Iterable_Plugin - Version 1.3.0

Version Notes

Enable template tracking for A/B tests
Other fixes

Download this release

Release Info

Developer Ilya Brin
Extension Iterable_Plugin
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.0 to 1.3.0

app/code/community/Iterable/TrackOrderPlaced/Helper/Data.php CHANGED
@@ -67,14 +67,23 @@ class Iterable_TrackOrderPlaced_Helper_Data extends Mage_Core_Helper_Abstract {
67
  }
68
  }
69
 
70
- public function updateUser($email, $dataFields) {
 
 
 
 
 
 
 
 
 
 
71
  $endpoint = '/api/users/update';
72
  $params = array(
73
  'email' => $email
74
  );
75
- if (!empty($dataFields)) {
76
- $params['dataFields'] = $dataFields;
77
- }
78
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_USER, $endpoint, $params);
79
  }
80
 
@@ -137,7 +146,7 @@ class Iterable_TrackOrderPlaced_Helper_Data extends Mage_Core_Helper_Abstract {
137
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_CART_UPDATED, $endpoint, $params);
138
  }
139
 
140
- public function trackPurchase($email, $items, $total, $campaignId=NULL, $dataFields=array(), $customerDataFields=array()) {
141
  $endpoint = '/api/commerce/trackPurchase';
142
  $params = array(
143
  'user' => array(
@@ -155,6 +164,9 @@ class Iterable_TrackOrderPlaced_Helper_Data extends Mage_Core_Helper_Abstract {
155
  if ($campaignId != NULL) {
156
  $params['campaignId'] = $campaignId;
157
  }
 
 
 
158
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_ORDER, $endpoint, $params);
159
  }
160
 
67
  }
68
  }
69
 
70
+ public function getIp() {
71
+ return Mage::helper('core/http')->getRemoteAddr(false);
72
+ }
73
+
74
+ public function setCurrentIp(&$dataFields) {
75
+ if (!array_key_exists('ip', $dataFields)) {
76
+ $dataFields['ip'] = $this->getIp();
77
+ }
78
+ }
79
+
80
+ public function updateUser($email, $dataFields=array()) {
81
  $endpoint = '/api/users/update';
82
  $params = array(
83
  'email' => $email
84
  );
85
+ $this->setCurrentIp($dataFields);
86
+ $params['dataFields'] = $dataFields;
 
87
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_USER, $endpoint, $params);
88
  }
89
 
146
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_CART_UPDATED, $endpoint, $params);
147
  }
148
 
149
+ public function trackPurchase($email, $items, $total, $campaignId=NULL, $templateId=NULL, $dataFields=array(), $customerDataFields=array()) {
150
  $endpoint = '/api/commerce/trackPurchase';
151
  $params = array(
152
  'user' => array(
164
  if ($campaignId != NULL) {
165
  $params['campaignId'] = $campaignId;
166
  }
167
+ if ($templateId != NULL) {
168
+ $params['templateId'] = $templateId;
169
+ }
170
  $this->callIterableApi(Iterable_TrackOrderPlaced_Model_TrackingEventTypes::EVENT_TYPE_ORDER, $endpoint, $params);
171
  }
172
 
app/code/community/Iterable/TrackOrderPlaced/Model/Observer.php CHANGED
@@ -207,8 +207,10 @@ class Iterable_TrackOrderPlaced_Model_Observer
207
 
208
  $cookieModel = Mage::getModel('core/cookie');
209
  // $iterableUid = $cookieModel->get('iterable_uid');
210
- $campaignId = $cookieModel->get('iterable_cid');
211
  $campaignId = empty($campaignId) ? NULL: intval($campaignId);
 
 
212
 
213
  $subtotal = $order->getSubtotal();
214
  $dataFields = array(
@@ -222,7 +224,7 @@ class Iterable_TrackOrderPlaced_Model_Observer
222
  'lastName' => $order->getCustomerLastname()
223
  );
224
  $helper = Mage::helper('trackorderplaced');
225
- $helper->trackPurchase($email, $items, $subtotal, $campaignId, $dataFields, $customerDataFields);
226
 
227
  // don't need to clear cart, server does it automatically
228
  }
207
 
208
  $cookieModel = Mage::getModel('core/cookie');
209
  // $iterableUid = $cookieModel->get('iterable_uid');
210
+ $campaignId = $cookieModel->get('iterableEmailCampaignId');
211
  $campaignId = empty($campaignId) ? NULL: intval($campaignId);
212
+ $templateId = $cookieModel->get('iterableTemplateId');
213
+ $templateId = empty($templateId) ? NULL: intval($templateId);
214
 
215
  $subtotal = $order->getSubtotal();
216
  $dataFields = array(
224
  'lastName' => $order->getCustomerLastname()
225
  );
226
  $helper = Mage::helper('trackorderplaced');
227
+ $helper->trackPurchase($email, $items, $subtotal, $campaignId, $templateId, $dataFields, $customerDataFields);
228
 
229
  // don't need to clear cart, server does it automatically
230
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iterable_Plugin</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL) </license>
7
  <channel>community</channel>
@@ -15,12 +15,12 @@ drip marketing campaigns.&#xD;
15
  To install, click the 'Install Now' button above and paste the link into your Magento Connect Manager. You will then see an Iterable section in your Magento Admin view. In the 'Advanced' section, select the events you would like to be sent to Iterable. Then, in the API section, enter your Magento API key from Iterable (located in the API Config section on the left side menu).&#xD;
16
  &#xD;
17
  Questions? Comments? Feel free to contact us at support@iterable.com. Also, for more info or a free demo, please visit us at Iterable.com.</description>
18
- <notes>Added feature to choose which events get pushed to Iterable.&#xD;
19
- Stability enhancements.</notes>
20
  <authors><author><name>Ilya Brin</name><user>Iterable</user><email>ilya@iterable.com</email></author></authors>
21
- <date>2014-05-15</date>
22
- <time>01:19:17</time>
23
- <contents><target name="magecommunity"><dir name="Iterable"><dir name="TrackOrderPlaced"><dir name="Helper"><file name="Data.php" hash="320b6609795c8000b76983c055d450a2"/></dir><dir name="Model"><file name="Observer.php" hash="eee019d5f89488c9903bd9a9f47811a3"/><file name="TrackingEventTypes.php" hash="f0592c7a7506a0e606275dd422a57bb8"/></dir><dir name="etc"><file name="config.xml" hash="d9e0eae78379f3c6238d70023b110276"/><file name="system.xml" hash="e4ad1b58022f8969e64dff80971c4cfb"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="iterable"><file name="common.xml" hash="d90fbb22fb34fa29deb6b0e131f9e767"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iterable_TrackOrderPlaced.xml" hash="0d4506dadf95eecb54e215ed03b2c6a7"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="iterable"><dir name="images"><file name="section_logo.png" hash="fe5090ba955a890c1efe2c09cb260342"/></dir><file name="iterable.css" hash="4d928c5a4ed76d62e246a57ee868ec23"/><file name="iterable.css~" hash="2c3ee0498f159bc59bee37cd3c508f27"/></dir></dir></dir></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.4.1</min><max>6.0.0</max></php></required></dependencies>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iterable_Plugin</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License (OSL) </license>
7
  <channel>community</channel>
15
  To install, click the 'Install Now' button above and paste the link into your Magento Connect Manager. You will then see an Iterable section in your Magento Admin view. In the 'Advanced' section, select the events you would like to be sent to Iterable. Then, in the API section, enter your Magento API key from Iterable (located in the API Config section on the left side menu).&#xD;
16
  &#xD;
17
  Questions? Comments? Feel free to contact us at support@iterable.com. Also, for more info or a free demo, please visit us at Iterable.com.</description>
18
+ <notes>Enable template tracking for A/B tests&#xD;
19
+ Other fixes</notes>
20
  <authors><author><name>Ilya Brin</name><user>Iterable</user><email>ilya@iterable.com</email></author></authors>
21
+ <date>2014-07-26</date>
22
+ <time>00:47:17</time>
23
+ <contents><target name="magecommunity"><dir name="Iterable"><dir name="TrackOrderPlaced"><dir name="Helper"><file name="Data.php" hash="f890759b1875bfde311cf40ed01aae67"/></dir><dir name="Model"><file name="Observer.php" hash="07fc03a2086562b26c751bd1146f07ba"/><file name="TrackingEventTypes.php" hash="f0592c7a7506a0e606275dd422a57bb8"/></dir><dir name="etc"><file name="config.xml" hash="d9e0eae78379f3c6238d70023b110276"/><file name="system.xml" hash="e4ad1b58022f8969e64dff80971c4cfb"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="iterable"><file name="common.xml" hash="d90fbb22fb34fa29deb6b0e131f9e767"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iterable_TrackOrderPlaced.xml" hash="0d4506dadf95eecb54e215ed03b2c6a7"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="iterable"><dir name="images"><file name="section_logo.png" hash="fe5090ba955a890c1efe2c09cb260342"/></dir><file name="iterable.css" hash="4d928c5a4ed76d62e246a57ee868ec23"/><file name="iterable.css~" hash="2c3ee0498f159bc59bee37cd3c508f27"/></dir></dir></dir></dir></target></contents>
24
  <compatible/>
25
  <dependencies><required><php><min>5.4.1</min><max>6.0.0</max></php></required></dependencies>
26
  </package>