Iterable_Plugin - Version 1.2.0

Version Notes

Added feature to choose which events get pushed to Iterable.
Stability enhancements.

Download this release

Release Info

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


Code changes from version 1.1.0 to 1.2.0

app/code/community/Iterable/TrackOrderPlaced/Helper/Data.php CHANGED
@@ -137,16 +137,20 @@ 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, $campaignId=NULL, $dataFields=array()) {
141
  $endpoint = '/api/commerce/trackPurchase';
142
  $params = array(
143
  'user' => array(
144
  'email' => $email
145
  ),
146
- 'items' => $items
 
147
  );
148
  if (!empty($dataFields)) {
149
- $params['user']['dataFields'] = $dataFields;
 
 
 
150
  }
151
  if ($campaignId != NULL) {
152
  $params['campaignId'] = $campaignId;
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(
144
  'email' => $email
145
  ),
146
+ 'items' => $items,
147
+ 'total' => $total
148
  );
149
  if (!empty($dataFields)) {
150
+ $params['dataFields'] = $dataFields;
151
+ }
152
+ if (!empty($customerDataFields)) {
153
+ $params['user']['dataFields'] = $customerDataFields;
154
  }
155
  if ($campaignId != NULL) {
156
  $params['campaignId'] = $campaignId;
app/code/community/Iterable/TrackOrderPlaced/Model/Observer.php CHANGED
@@ -204,24 +204,25 @@ class Iterable_TrackOrderPlaced_Model_Observer
204
  $orderItems = $this->getItemsFromQuote($order, FALSE);
205
  $items = array_values($orderItems);
206
  $email = $order->getCustomerEmail();
207
- /*
208
- $dataFields = array(
209
- 'firstName' => $order->getCustomerFirstname(),
210
- 'lastName' => $order->getCustomerLastname(),
211
- 'subtotal' => $order->getSubtotal(),
212
- 'grandTotal' => $order->getGrandTotal(),
213
- 'taxAmount' => $order->getTaxAmount(),
214
- 'shippingAmount' => $order->getShippingAmount(),
215
- 'items' => $items
216
- );
217
- */
218
  $cookieModel = Mage::getModel('core/cookie');
219
  // $iterableUid = $cookieModel->get('iterable_uid');
220
  $campaignId = $cookieModel->get('iterable_cid');
221
  $campaignId = empty($campaignId) ? NULL: intval($campaignId);
222
- // $dataFields["campaignId"] = $iterableCid;
 
 
 
 
 
 
 
 
 
 
 
223
  $helper = Mage::helper('trackorderplaced');
224
- $helper->trackPurchase($email, $items, $campaignId);
225
 
226
  // don't need to clear cart, server does it automatically
227
  }
@@ -244,8 +245,8 @@ class Iterable_TrackOrderPlaced_Model_Observer
244
  // set billing address
245
  $defaultBilling = $customer->getDefaultBillingAddress();
246
  if ($defaultBilling) { $dataFields['defaultBilling'] = $defaultBilling->getData(); }
247
- // unset password/conf
248
- $fieldsToUnset = array('password', 'password_hash', 'confirmation');
249
  foreach ($fieldsToUnset as $fieldToUnset) {
250
  if (array_key_exists($fieldToUnset, $dataFields)) {
251
  unset($dataFields[$fieldToUnset]);
204
  $orderItems = $this->getItemsFromQuote($order, FALSE);
205
  $items = array_values($orderItems);
206
  $email = $order->getCustomerEmail();
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(
215
+ 'subtotal' => $subtotal,
216
+ 'grandTotal' => $order->getGrandTotal(),
217
+ 'taxAmount' => $order->getTaxAmount(),
218
+ 'shippingAmount' => $order->getShippingAmount()
219
+ );
220
+ $customerDataFields = array(
221
+ 'firstName' => $order->getCustomerFirstname(),
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
  }
245
  // set billing address
246
  $defaultBilling = $customer->getDefaultBillingAddress();
247
  if ($defaultBilling) { $dataFields['defaultBilling'] = $defaultBilling->getData(); }
248
+ // unset password/conf... unset created_at because that never changes, and it's in a bad format to boot
249
+ $fieldsToUnset = array('password', 'password_hash', 'confirmation', 'subscriber_confirm_code', 'created_at');
250
  foreach ($fieldsToUnset as $fieldToUnset) {
251
  if (array_key_exists($fieldToUnset, $dataFields)) {
252
  unset($dataFields[$fieldToUnset]);
package.xml CHANGED
@@ -1,18 +1,26 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Iterable_Plugin</name>
4
- <version>1.1.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>
8
  <extends/>
9
- <summary>Automatically tie together your commerce platform and email marketing with this plugin from Iterable!</summary>
10
- <description>After installing this plugin, you will be able to immediately view and take action in the Iterable platform whenever your Magento users make important decisions, such as signing up or making a purchase! Easily integrate and set up abandoned cart emails, handle newsletter subscriptions, or reach out to customers whenever they make a purchase. </description>
11
- <notes>Added feature to choose which events get pushed to Iterable.</notes>
 
 
 
 
 
 
 
 
12
  <authors><author><name>Ilya Brin</name><user>Iterable</user><email>ilya@iterable.com</email></author></authors>
13
- <date>2014-04-30</date>
14
- <time>03:23:26</time>
15
- <contents><target name="magecommunity"><dir name="Iterable"><dir name="TrackOrderPlaced"><dir name="Helper"><file name="Data.php" hash="661ec5234fee78ffeae3d77011a2dde1"/></dir><dir name="Model"><file name="Observer.php" hash="d110ed71f94f2bff983e88ca1551ae2d"/><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>
16
  <compatible/>
17
  <dependencies><required><php><min>5.4.1</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
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>
8
  <extends/>
9
+ <summary>The official extension for easily integrating the Iterable all-in-one email optimization solution with your Magento store. </summary>
10
+ <description>Iterable is an all-in-on email optimization solution that sends triggered, promotional and lifecycle marketing automation emails. Designed for both engineers and marketers, the robust platform includes subscriber segmentation, A/B testing, real-time analytics, mobile previews and much more.&#xD;
11
+ &#xD;
12
+ The Iterable extension allows you to send Magento store events (newsletter subscribe/unsubscribe, registrations, user info events, cart updates, order/purchases) to Iterable. You can then use these events to trigger Iterable email sends or multi-step &#xD;
13
+ drip marketing campaigns.&#xD;
14
+ &#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>