Hellodialog_Tracker - Version 2.0.4

Version Notes

Dev

Download this release

Release Info

Developer Maarten van Schalkwijk
Extension Hellodialog_Tracker
Version 2.0.4
Comparing to
See all releases


Code changes from version 2.0.3 to 2.0.4

app/code/community/Hellodialog/Tracker/Model/Cron.php CHANGED
@@ -4,8 +4,11 @@
4
  // 2.400 per day (job every 15 minutes), this ensures we stay within Google's gecode limits (2500/24hrs)
5
  private static $orders_per_job = 25;
6
 
 
 
 
7
  public static function orders_per_job() {
8
- return self::$orders_per_job;
9
  }
10
 
11
  public static function current_page() {
@@ -27,7 +30,6 @@
27
  }
28
 
29
  // configuration
30
- $orders_per_job = self::orders_per_job();
31
  $current_page = self::current_page();
32
  $hd_observer = new HelloDialog_Tracker_Model_Observer();
33
  $total = $orders = Mage::getModel('sales/order')->getCollection()
@@ -59,7 +61,9 @@
59
 
60
  foreach ($orders as $order) {
61
  self::log("- processing order ".$order->getIncrementId()." (".$order->getCustomerName().")");
 
62
  $hd_observer->sync_order($order);
 
63
  }
64
 
65
  // update current page in config
4
  // 2.400 per day (job every 15 minutes), this ensures we stay within Google's gecode limits (2500/24hrs)
5
  private static $orders_per_job = 25;
6
 
7
+ // 9600 per day (job every 15 minutes) if we're not using Google's geocode
8
+ private static $orders_per_job_sans_geocoding = 100;
9
+
10
  public static function orders_per_job() {
11
+ return Mage::getStoreConfig('hellodialog/general/geocode') ? self::$orders_per_job : self::$orders_per_job_sans_geocoding;
12
  }
13
 
14
  public static function current_page() {
30
  }
31
 
32
  // configuration
 
33
  $current_page = self::current_page();
34
  $hd_observer = new HelloDialog_Tracker_Model_Observer();
35
  $total = $orders = Mage::getModel('sales/order')->getCollection()
61
 
62
  foreach ($orders as $order) {
63
  self::log("- processing order ".$order->getIncrementId()." (".$order->getCustomerName().")");
64
+ $start = microtime(true);
65
  $hd_observer->sync_order($order);
66
+ self::log("- order #{$order->getIncrementId()} processed in " . round(((microtime(true) - $start) * 1000), 2).'ms');
67
  }
68
 
69
  // update current page in config
app/code/community/Hellodialog/Tracker/Model/Observer.php CHANGED
@@ -227,17 +227,19 @@
227
  Mage::log("Asserting existance of contact with email: ".$this->_value('email'), null, 'hellodialog.log');
228
  $contact = $this->_createHellodialogContact();
229
  $api = new HDApi('contacts');
230
- $result = $api->data($contact)->post();
 
 
 
231
 
232
- // if duplicate, update:
233
- if ($result->result->code == 612) {
234
- $result = $api->data($contact)->put($result->result->data->id_of_duplicate);
235
  Mage::log("... UPDATED (Contact already existed, updated information)", null, 'hellodialog.log');
236
  } else {
 
237
  Mage::log("... OK (Contact created)", null, 'hellodialog.log');
238
  }
239
 
240
-
241
  // eCommerce plugin
242
  // ---------------------------------
243
  // Only synch the actual order when
@@ -282,7 +284,7 @@
282
  if ($ordersResult->result->code == '200') {
283
  Mage::log("... OK (Orders created)", null, 'hellodialog.log');
284
  } else {
285
- Mage::log("... FAILED (".$ordersResult->result->data->errors[0]->message.")", null, 'hellodialog.log');
286
  }
287
  } else {
288
  Mage::log("... FAILED (unexpected response)", null, 'hellodialog.log');
227
  Mage::log("Asserting existance of contact with email: ".$this->_value('email'), null, 'hellodialog.log');
228
  $contact = $this->_createHellodialogContact();
229
  $api = new HDApi('contacts');
230
+ $result = json_decode(
231
+ json_encode((new HDApi('contacts'))->condition('email', $contact['email'])->get()),
232
+ true
233
+ );
234
 
235
+ if ($existingContact = array_shift($result)) {
236
+ $api->data($contact)->put($existingContact['id']);
 
237
  Mage::log("... UPDATED (Contact already existed, updated information)", null, 'hellodialog.log');
238
  } else {
239
+ $api->data($contact)->post();
240
  Mage::log("... OK (Contact created)", null, 'hellodialog.log');
241
  }
242
 
 
243
  // eCommerce plugin
244
  // ---------------------------------
245
  // Only synch the actual order when
284
  if ($ordersResult->result->code == '200') {
285
  Mage::log("... OK (Orders created)", null, 'hellodialog.log');
286
  } else {
287
+ Mage::log("... FAILED (".$ordersResult->result->data->errors[0]->message.") -- Errors: " . json_encode($ordersResult->data->errors), null, 'hellodialog.log');
288
  }
289
  } else {
290
  Mage::log("... FAILED (unexpected response)", null, 'hellodialog.log');
app/code/community/Hellodialog/Tracker/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
 
4
  <modules>
5
  <Hellodialog_Tracker>
6
- <version>2.0.3</version>
7
  </Hellodialog_Tracker>
8
  </modules>
9
 
3
 
4
  <modules>
5
  <Hellodialog_Tracker>
6
+ <version>2.0.4</version>
7
  </Hellodialog_Tracker>
8
  </modules>
9
 
app/code/community/Hellodialog/Tracker/etc/system.xml CHANGED
@@ -17,7 +17,7 @@
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
  <general>
20
- <label>Hellodialog Magento plugin v2.0.3</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
23
  <show_in_default>1</show_in_default>
@@ -28,7 +28,7 @@
28
  <![CDATA[
29
  <img src='http://www.hellodialog.com/img/magento_plugin_assets/logo.png' style='float: left; width: 100px;'/>
30
  <div style='margin-left: 130px; padding-top: 6px; line-height: 25px;'>
31
- <strong>Hellodialog Magento Plugin v2.0.3</strong><br/>
32
  This plugin connects your Magento shop to Hellodialog. Your customers will automatically be subscribed to your Hellodialog account.
33
  <br/>
34
  Optionally use the Hellodialog eCommerce Plugin to target groups of customers based on their purchase history.
17
  <show_in_store>1</show_in_store>
18
  <groups>
19
  <general>
20
+ <label>Hellodialog Magento plugin v2.0.4</label>
21
  <frontend_type>text</frontend_type>
22
  <sort_order>1</sort_order>
23
  <show_in_default>1</show_in_default>
28
  <![CDATA[
29
  <img src='http://www.hellodialog.com/img/magento_plugin_assets/logo.png' style='float: left; width: 100px;'/>
30
  <div style='margin-left: 130px; padding-top: 6px; line-height: 25px;'>
31
+ <strong>Hellodialog Magento Plugin v2.0.4</strong><br/>
32
  This plugin connects your Magento shop to Hellodialog. Your customers will automatically be subscribed to your Hellodialog account.
33
  <br/>
34
  Optionally use the Hellodialog eCommerce Plugin to target groups of customers based on their purchase history.
package.xml CHANGED
@@ -1,34 +1,35 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Hellodialog_Tracker</name>
4
- <version>2.0.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://www.gnu.org/copyleft/gpl.html">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connect your Magento shop to Hellodialog.</summary>
10
- <description>This plugin connects your Magento shop to Hellodialog. Your customers will automatically be subscribed to your Hellodialog account.&#xD;
11
  &#xD;
12
- Optionally use the Hellodialog eCommerce Plugin to target groups of customers based on their purchase history.</description>
13
- <notes>This plugin connects your Magento shop to Hellodialog. Your customers will automatically be subscribed to your Hellodialog account.&#xD;
14
- Optionally use the Hellodialog eCommerce Plugin to target groups of customers based on their purchase history.&#xD;
15
  &#xD;
 
16
  Release 2.0.3 fixes the plugin blocking access to System &gt; Permissions &gt; Roles.&#xD;
17
- &#xD;
18
  Release 2.0.2 contains a number of memory fixes for large order-sets.&#xD;
19
- &#xD;
20
  Release 2.0.1 contains a number of fixes, as well as an update to the underlying API domain used.&#xD;
 
21
  &#xD;
22
  Release 2.0.0 was completely rebuilt from scratch. The most important changes:&#xD;
23
- - Made the importing of orders with customers optional&#xD;
 
24
  - Fieldmapping: specify which Magento fields to import into Hellodialog&#xD;
25
- - Synchronize history of all completed orders&#xD;
26
  &#xD;
27
- For any questions or when you need help installing our extension, please contact us at support@hellodialog.com or call us at +31 23 53 22 608.</notes>
 
28
  <authors><author><name>Maarten van Schalkwijk</name><user>Hellodialog</user><email>maarten@hellodialog.com</email></author></authors>
29
- <date>2016-02-18</date>
30
- <time>13:16:12</time>
31
- <contents><target name="magecommunity"><dir name="Hellodialog"><dir name="Tracker"><dir name="Block"><file name="Cronprogress.php" hash="28c5b0e2b0eb23d2b9c14c9de55d92a1"/><file name="Fieldmapping.php" hash="1cd6e6e1b7e473cf8649f567f5e04f90"/><file name="Syncstatus.php" hash="1b561e42a18cde10c39949b86adc8e7b"/><file name="Validator.php" hash="beb1c17c3817b44e1078b1bec0d8ceef"/></dir><dir name="Helper"><file name="Data.php" hash="f295bfc5659e6e0cb5b123a3d6a62703"/></dir><dir name="Model"><file name="APIKeyValidator.php" hash="ef82d2001f97ce4203d5717c770ddd82"/><file name="Cron.php" hash="f078ebe1eea3305291a1899d6d959291"/><file name="HDApi.php" hash="29b9432cb6fcb9ea9cf4a4244aef569f"/><file name="HDEcommerce.php" hash="9673b1656e1a716000e7a49dd2be43f4"/><file name="Observer.php" hash="b853135ae79d2a3c92eebc45cd23d359"/><file name="SubscribeOptions.php" hash="dc700ecb157f1ead9300eb441e0d190d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="74e25b46ad18817d305550bb82aacc26"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="12c5102eab80f7c17d0032a50cf96478"/><file name="config.xml" hash="edbc12bbea137155b3d5460d619f4512"/><file name="system.xml" hash="bab4c4b0a280c280480bdbdabcd7d540"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hellodialog_Tracker.xml" hash="7d32b9c31228e1c1709f05642bed18d2"/></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
34
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Hellodialog_Tracker</name>
4
+ <version>2.0.4</version>
5
  <stability>stable</stability>
6
+ <license>GPL (GNU General Public License)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connect your Magento shop to Hellodialog.</summary>
10
+ <description>This plugin connects your Magento shop to Hellodialog. All your customers will automatically be subscribed to your Hellodialog email-marketing account. The extension allows you to configure which data (firstname, lastname, address, etc.) to import into Hellodialog by a configurable fieldmapping.&#xD;
11
  &#xD;
12
+ Optionally use the Hellodialog eCommerce Plugin to target groups of customers based on their purchase history. You can enable the eCommerce plugin from the Magento Admin configuration page. When enabled, your customers will be enriched with their orders automatically. This allows you to target groups of customers with your Hellodialog marketing campaigns, based &#xD;
13
+ on customer purchase history.&#xD;
 
14
  &#xD;
15
+ Release 2.0.4 fixes several small bugs&#xD;
16
  Release 2.0.3 fixes the plugin blocking access to System &gt; Permissions &gt; Roles.&#xD;
 
17
  Release 2.0.2 contains a number of memory fixes for large order-sets.&#xD;
 
18
  Release 2.0.1 contains a number of fixes, as well as an update to the underlying API domain used.&#xD;
19
+ In release 2.0.0 we introduced the synchronization of historical orders. Simply enable this from the Magento Admin configuration page, and all existing orders from your Magento store will be be imported into Hellodialog (at a speed of 2.500 / 24hrs). This synchronization requires your Magento installation to run Magento Cron (documentation).You can keep track of the progress in your Magento Admin configuration page.&#xD;
20
  &#xD;
21
  Release 2.0.0 was completely rebuilt from scratch. The most important changes:&#xD;
22
+ - Improved API-Key validation feedback&#xD;
23
+ - Importing orders with customers (eCommerce plugin) now optional&#xD;
24
  - Fieldmapping: specify which Magento fields to import into Hellodialog&#xD;
25
+ Synchronize history of all completed orders&#xD;
26
  &#xD;
27
+ For any questions or when you need help installing our extension, please contact us at support@hellodialog.com or call us at +31 23 53 22 608.</description>
28
+ <notes>Dev</notes>
29
  <authors><author><name>Maarten van Schalkwijk</name><user>Hellodialog</user><email>maarten@hellodialog.com</email></author></authors>
30
+ <date>2016-10-11</date>
31
+ <time>13:30:04</time>
32
+ <contents><target name="magecommunity"><dir name="Hellodialog"><dir name="Tracker"><dir name="Block"><file name="Cronprogress.php" hash="28c5b0e2b0eb23d2b9c14c9de55d92a1"/><file name="Fieldmapping.php" hash="1cd6e6e1b7e473cf8649f567f5e04f90"/><file name="Syncstatus.php" hash="1b561e42a18cde10c39949b86adc8e7b"/><file name="Validator.php" hash="beb1c17c3817b44e1078b1bec0d8ceef"/></dir><dir name="Helper"><file name="Data.php" hash="f295bfc5659e6e0cb5b123a3d6a62703"/></dir><dir name="Model"><file name="APIKeyValidator.php" hash="ef82d2001f97ce4203d5717c770ddd82"/><file name="Cron.php" hash="21ad32333b4bff74c7a47ae9c7cb108c"/><file name="HDApi.php" hash="29b9432cb6fcb9ea9cf4a4244aef569f"/><file name="HDEcommerce.php" hash="9673b1656e1a716000e7a49dd2be43f4"/><file name="Observer.php" hash="1a27764be34241abcdba5501376647a5"/><file name="SubscribeOptions.php" hash="dc700ecb157f1ead9300eb441e0d190d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormController.php" hash="74e25b46ad18817d305550bb82aacc26"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="12c5102eab80f7c17d0032a50cf96478"/><file name="config.xml" hash="586eb0b16d8095c9f412331a0697796c"/><file name="system.xml" hash="5bef7e9271815dd6696ee6cbc8cb1539"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hellodialog_Tracker.xml" hash="7d32b9c31228e1c1709f05642bed18d2"/></dir></target></contents>
33
  <compatible/>
34
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
35
  </package>