Ometria_Magento_Extension - Version 1.1.5

Version Notes

Fix potential issue with long cookies being dropped by nginx in the case of many model saves per request.

Download this release

Release Info

Developer Alastair James
Extension Ometria_Magento_Extension
Version 1.1.5
Comparing to
See all releases


Code changes from version 1.1.4 to 1.1.5

app/code/community/Ometria/Api/Model/Api.php CHANGED
@@ -217,6 +217,7 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
217
  $info['product_id'] = $info['sku'];
218
  } else {
219
  $info = $m->info($id);
 
220
  }
221
 
222
  // Additional code to return parent information if available
217
  $info['product_id'] = $info['sku'];
218
  } else {
219
  $info = $m->info($id);
220
+ $info['product_id'] = $id;
221
  }
222
 
223
  // Additional code to return parent information if available
app/code/community/Ometria/Api/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ometria_Api>
5
- <version>1.1.4</version>
6
  </Ometria_Api>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Ometria_Api>
5
+ <version>1.1.5</version>
6
  </Ometria_Api>
7
  </modules>
8
 
app/code/community/Ometria/Core/Helper/Cookiechannel.php CHANGED
@@ -11,7 +11,8 @@ class Ometria_Core_Helper_Cookiechannel extends Mage_Core_Helper_Abstract {
11
 
12
  // Return if admin area or API call
13
  if (Mage::app()->getStore()->isAdmin()) return;
14
- if (Mage::getSingleton('api/server')->getAdapter() != null) return;
 
15
 
16
  $ometria_config_helper = Mage::helper('ometria/config');
17
  if (!$ometria_config_helper->isConfigured()) return;
@@ -24,28 +25,28 @@ class Ometria_Core_Helper_Cookiechannel extends Mage_Core_Helper_Abstract {
24
 
25
  private function appendCookieCommand($command_name, $str, $replace_if_exists=false){
26
  $existing_cookie = isset($_COOKIE[self::COOKIE_NAME]) ? $_COOKIE[self::COOKIE_NAME] : '';
27
- $new_cookie = '';
28
 
29
- if ($replace_if_exists && $existing_cookie) {
30
- $_commands = explode(self::SEPERATOR_BETWEEN_COMMANDS, $existing_cookie);
31
- $commands = array();
32
- foreach($_commands as $command){
33
  if (strpos($command, $command_name.self::SEPERATOR_IN_COMMANDS)!==0) {
34
- $commands[] = $command;
35
  }
36
  }
37
- $commands = array_filter($commands);
38
- $existing_cookie = implode(self::SEPERATOR_BETWEEN_COMMANDS, $commands);
39
  }
40
 
41
- if ($existing_cookie){
 
42
 
43
- $new_cookie = $existing_cookie.self::SEPERATOR_BETWEEN_COMMANDS.$str;
44
- } else {
45
- $new_cookie = $str;
46
- }
 
47
 
48
  $_COOKIE[self::COOKIE_NAME] = $new_cookie;
49
- setcookie(self::COOKIE_NAME, $new_cookie, 0, '/');
50
  }
51
  }
11
 
12
  // Return if admin area or API call
13
  if (Mage::app()->getStore()->isAdmin()) return;
14
+ //if (Mage::getSingleton('api/server')->getAdapter() != null) return;
15
+ if (isset($_SERVER['REQUEST_URI']) && stripos($_SERVER['REQUEST_URI'], "/api")) return;
16
 
17
  $ometria_config_helper = Mage::helper('ometria/config');
18
  if (!$ometria_config_helper->isConfigured()) return;
25
 
26
  private function appendCookieCommand($command_name, $str, $replace_if_exists=false){
27
  $existing_cookie = isset($_COOKIE[self::COOKIE_NAME]) ? $_COOKIE[self::COOKIE_NAME] : '';
28
+ $commands = explode(self::SEPERATOR_BETWEEN_COMMANDS, $existing_cookie);
29
 
30
+ if ($replace_if_exists && $commands) {
31
+ $commands_filtered = array();
32
+ foreach($commands as $command){
 
33
  if (strpos($command, $command_name.self::SEPERATOR_IN_COMMANDS)!==0) {
34
+ $commands_filtered[] = $command;
35
  }
36
  }
37
+ $commands = $commands_filtered;
 
38
  }
39
 
40
+ $commands[] = $str;
41
+ if (count($commands)>6) $commands = array_slice($commands, 0, 6);
42
 
43
+ $commands = array_unique($commands);
44
+ $commands = array_filter($commands);
45
+ $commands = array_values($commands);
46
+ $new_cookie = implode(self::SEPERATOR_BETWEEN_COMMANDS, $commands);
47
+ if (strlen($new_cookie)>1000) $new_cookie = '';
48
 
49
  $_COOKIE[self::COOKIE_NAME] = $new_cookie;
50
+ if (!headers_sent()) setcookie(self::COOKIE_NAME, $new_cookie, 0, '/');
51
  }
52
  }
app/code/community/Ometria/Core/Helper/Ping.php CHANGED
@@ -7,6 +7,8 @@ class Ometria_Core_Helper_Ping extends Mage_Core_Helper_Abstract {
7
  const API_PATH = '/ping.php';
8
  const API_SOCKET_TIMEOUT = 2;
9
 
 
 
10
  public function sendPing($type, $ids, $extra=array(), $store_id=null){
11
  $ometriaConfigHelper = Mage::helper('ometria/config');
12
 
@@ -33,6 +35,7 @@ class Ometria_Core_Helper_Ping extends Mage_Core_Helper_Abstract {
33
  return $this->_ping($extra);
34
  }
35
 
 
36
  /**
37
  * Helper function to ping ometria. Manually doing an fsockopen
38
  * so that we don't have to wait for a response. Unless debugging
@@ -42,10 +45,14 @@ class Ometria_Core_Helper_Ping extends Mage_Core_Helper_Abstract {
42
  *
43
  * @return bool
44
  */
 
45
  protected function _ping($parameters = array()) {
46
 
47
- //file_put_contents('/tmp/ping', json_encode($parameters)."\n", FILE_APPEND);
48
- //return true;
 
 
 
49
 
50
  $ometriaConfigHelper = Mage::helper('ometria/config');
51
 
7
  const API_PATH = '/ping.php';
8
  const API_SOCKET_TIMEOUT = 2;
9
 
10
+ private static $_PING_CACHE=array();
11
+
12
  public function sendPing($type, $ids, $extra=array(), $store_id=null){
13
  $ometriaConfigHelper = Mage::helper('ometria/config');
14
 
35
  return $this->_ping($extra);
36
  }
37
 
38
+
39
  /**
40
  * Helper function to ping ometria. Manually doing an fsockopen
41
  * so that we don't have to wait for a response. Unless debugging
45
  *
46
  * @return bool
47
  */
48
+
49
  protected function _ping($parameters = array()) {
50
 
51
+ // Check cache
52
+ $ping_signature = json_encode(array($parameters['type'], $parameters['id']));
53
+ if (isset(self::$_PING_CACHE[$ping_signature])) return;
54
+ self::$_PING_CACHE[$ping_signature] = true;
55
+ //
56
 
57
  $ometriaConfigHelper = Mage::helper('ometria/config');
58
 
app/code/community/Ometria/Core/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ometria_Core>
5
- <version>1.1.4</version>
6
  </Ometria_Core>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Ometria_Core>
5
+ <version>1.1.5</version>
6
  </Ometria_Core>
7
  </modules>
8
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ometria_Magento_Extension</name>
4
- <version>1.1.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL)</license>
7
  <channel>community</channel>
@@ -21,11 +21,11 @@ Enough Data already. Tell me what to do!&#xD;
21
  We don't just pull the right data together in one place, we also create insights. Our team of data scientists have created a set of algorithms to spot weaknesses, under-performance and opportunities, so every time a retailer logs into their dashboards we present a short list of top revenue wins.&#xD;
22
  &#xD;
23
  Whether it's with our multi-dimension funnel analysis which flags up specific channels that may be under-performing, or our customer dashboard which spots channels that deliver customers with the best CLV, our 'actionable insights' come ready to go.</description>
24
- <notes>Prevent abandoned cart redirect stripping tracking query string parameters</notes>
25
  <authors><author><name>Alastair James</name><user>aljames1981</user><email>al.james@gmail.com</email></author></authors>
26
- <date>2016-01-20</date>
27
- <time>15:29:19</time>
28
- <contents><target name="magecommunity"><dir name="Ometria"><dir name="AbandonedCarts"><dir name="Helper"><file name="Config.php" hash="4ea2f9de193a510a1438a1911f6e9a8d"/><file name="Data.php" hash="1348c35f00b49b2b30034f0d9a819ae8"/></dir><dir name="controllers"><file name="CartlinkController.php" hash="e46a511a87ca264a8df96829905545dc"/></dir><dir name="etc"><file name="config.xml" hash="7e296832bbf7db6a8f1891675c57c4d3"/><file name="system.xml" hash="11db59f5c2f864525e4c1cdd06283ac1"/></dir></dir><dir name="Api"><dir name="Helper"><file name="Data.php" hash="8a19a3bf39de93fab7d2e1333c3c0806"/></dir><dir name="Model"><file name="Api.php" hash="8a57255471874c4f962bda00a258780e"/><file name="Api2.php" hash="e34e5530d8e828fcdb2ce09f6abef01d"/><file name="FixedCouponGenerator.php" hash="b37f5df7471dca9437a7aed70b4c53c0"/></dir><dir name="etc"><file name="api.xml" hash="51d02f0154ac396ef90f4ff484253af3"/><file name="config.xml" hash="a409c4ea8e8fe31426c878c47b8fced8"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Startwizard.php" hash="48c0cc3736f8a7fbd871d92d1aed9a81"/></dir></dir><dir name="Wizard"><file name="Finished.php" hash="3325319ce22b23c3661a15b7ab6cbb83"/><dir name="Start"><file name="Form.php" hash="e5d6f86a9718da044104245b46230674"/></dir><file name="Start.php" hash="befc4575e361b7a9916f929e2fc58c45"/></dir></dir><file name="Head.php" hash="1b00336f0bd24d46c56b6ced4c0515a6"/></dir><dir name="Helper"><file name="Config.php" hash="2d9a42f28c768aac826a590aaf571488"/><file name="Cookiechannel.php" hash="c3751e4e855b6612e2c4c99feeab4c5e"/><file name="Data.php" hash="26c20107047db9e3911118efbf083135"/><file name="Ping.php" hash="3bec467a79d2f28722f941ff92e397ef"/><file name="Product.php" hash="60e3b6bcb43884af7e4a4ed48c3e3411"/><file name="Session.php" hash="798245d7d20c523b3c386c8bf25979d2"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Productmode.php" hash="3b37b999e8d49fc23af6229bcae86bb9"/></dir></dir><dir name="Observer"><file name="Cart.php" hash="674264fb7825a8867cdf5b1a63bd64ca"/><file name="Customer.php" hash="9da9e4c69b631c08066e7461d9786113"/><file name="Newsletter.php" hash="263acdd139355f562fec961cbbbda633"/><file name="Order.php" hash="673a50e7674277fea9e774857d01c431"/><file name="Product.php" hash="e988fbf3dcf5ef6ea898b2668f2c4f55"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="997583679f0981fbd2f0560cf40855d1"/></dir><dir name="Model"><dir name="Observer"><file name="Order.php" hash="d4655e7789a87b3fe8093355e862bfc4"/><file name="Product.php" hash="b9d3920d0d489c39245f747f15187085"/></dir></dir></dir><dir name="controllers"><file name="WizardController.php" hash="558e829a66e2ad9a7b7c1ad9d7d4a530"/></dir><dir name="etc"><file name="config.xml" hash="22cd4a27deb7c77515e00eab08488436"/><file name="system.xml" hash="f494e9ed2da1f2554196847753629cb4"/></dir><file name=".DS_Store" hash="d8b910e9c4677fce43c430c2bb123061"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="d8d696fec5b40262b9307a0bb89bcede"/></dir></dir><dir name="template"><dir name="ometria"><file name="head.phtml" hash="1ef17e826431c85e14532d7660b38ee8"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="4fd702d8159187002eebb40c9b3ebe1b"/></dir></dir><dir name="template"><dir name="ometria"><dir name="system"><dir name="config"><file name="start_wizard.phtml" hash="d4a4e6d6ab16048f1e436793cb24a668"/></dir></dir><dir name="wizard"><file name="finished.phtml" hash="e475e0a7fb28b2b054a1b26cae5fd9b8"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ometria_Core.xml" hash="f8ec0ef46b669bf0070d9064300fc0fd"/><file name="Ometria_Api.xml" hash="e9309a378992b51f710a9fca17a3055e"/><file name="Ometria_AbandonedCarts.xml" hash="a69a03804840e784362410c2596c0a08"/></dir></target><target name="mageweb"><dir name="js"><dir name="ometria"><file name="checkout.js" hash="78b5fed53276d65a42c5cad4bf92a35f"/></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ometria_Magento_Extension</name>
4
+ <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL)</license>
7
  <channel>community</channel>
21
  We don't just pull the right data together in one place, we also create insights. Our team of data scientists have created a set of algorithms to spot weaknesses, under-performance and opportunities, so every time a retailer logs into their dashboards we present a short list of top revenue wins.&#xD;
22
  &#xD;
23
  Whether it's with our multi-dimension funnel analysis which flags up specific channels that may be under-performing, or our customer dashboard which spots channels that deliver customers with the best CLV, our 'actionable insights' come ready to go.</description>
24
+ <notes>Fix potential issue with long cookies being dropped by nginx in the case of many model saves per request. </notes>
25
  <authors><author><name>Alastair James</name><user>aljames1981</user><email>al.james@gmail.com</email></author></authors>
26
+ <date>2016-02-16</date>
27
+ <time>11:03:40</time>
28
+ <contents><target name="magecommunity"><dir name="Ometria"><dir name="AbandonedCarts"><dir name="Helper"><file name="Config.php" hash="4ea2f9de193a510a1438a1911f6e9a8d"/><file name="Data.php" hash="1348c35f00b49b2b30034f0d9a819ae8"/></dir><dir name="controllers"><file name="CartlinkController.php" hash="e46a511a87ca264a8df96829905545dc"/></dir><dir name="etc"><file name="config.xml" hash="7e296832bbf7db6a8f1891675c57c4d3"/><file name="system.xml" hash="11db59f5c2f864525e4c1cdd06283ac1"/></dir></dir><dir name="Api"><dir name="Helper"><file name="Data.php" hash="8a19a3bf39de93fab7d2e1333c3c0806"/></dir><dir name="Model"><file name="Api.php" hash="792413443cc6f22152904fb58873c27c"/><file name="Api2.php" hash="e34e5530d8e828fcdb2ce09f6abef01d"/><file name="FixedCouponGenerator.php" hash="b37f5df7471dca9437a7aed70b4c53c0"/></dir><dir name="etc"><file name="api.xml" hash="51d02f0154ac396ef90f4ff484253af3"/><file name="config.xml" hash="461fe8010f21c3e28ee78feb9a99eb3d"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Startwizard.php" hash="48c0cc3736f8a7fbd871d92d1aed9a81"/></dir></dir><dir name="Wizard"><file name="Finished.php" hash="3325319ce22b23c3661a15b7ab6cbb83"/><dir name="Start"><file name="Form.php" hash="e5d6f86a9718da044104245b46230674"/></dir><file name="Start.php" hash="befc4575e361b7a9916f929e2fc58c45"/></dir></dir><file name="Head.php" hash="1b00336f0bd24d46c56b6ced4c0515a6"/></dir><dir name="Helper"><file name="Config.php" hash="2d9a42f28c768aac826a590aaf571488"/><file name="Cookiechannel.php" hash="70ede1f794faeb43412445172b791beb"/><file name="Data.php" hash="26c20107047db9e3911118efbf083135"/><file name="Ping.php" hash="d81761aa5908e3683918fac5d27742fe"/><file name="Product.php" hash="60e3b6bcb43884af7e4a4ed48c3e3411"/><file name="Session.php" hash="798245d7d20c523b3c386c8bf25979d2"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Productmode.php" hash="3b37b999e8d49fc23af6229bcae86bb9"/></dir></dir><dir name="Observer"><file name="Cart.php" hash="674264fb7825a8867cdf5b1a63bd64ca"/><file name="Customer.php" hash="9da9e4c69b631c08066e7461d9786113"/><file name="Newsletter.php" hash="263acdd139355f562fec961cbbbda633"/><file name="Order.php" hash="673a50e7674277fea9e774857d01c431"/><file name="Product.php" hash="e988fbf3dcf5ef6ea898b2668f2c4f55"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="997583679f0981fbd2f0560cf40855d1"/></dir><dir name="Model"><dir name="Observer"><file name="Order.php" hash="d4655e7789a87b3fe8093355e862bfc4"/><file name="Product.php" hash="b9d3920d0d489c39245f747f15187085"/></dir></dir></dir><dir name="controllers"><file name="WizardController.php" hash="558e829a66e2ad9a7b7c1ad9d7d4a530"/></dir><dir name="etc"><file name="config.xml" hash="9c7b5164d4eb83c3e0fbe7a7621615d3"/><file name="system.xml" hash="f494e9ed2da1f2554196847753629cb4"/></dir><file name=".DS_Store" hash="d8b910e9c4677fce43c430c2bb123061"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="d8d696fec5b40262b9307a0bb89bcede"/></dir></dir><dir name="template"><dir name="ometria"><file name="head.phtml" hash="1ef17e826431c85e14532d7660b38ee8"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="4fd702d8159187002eebb40c9b3ebe1b"/></dir></dir><dir name="template"><dir name="ometria"><dir name="system"><dir name="config"><file name="start_wizard.phtml" hash="d4a4e6d6ab16048f1e436793cb24a668"/></dir></dir><dir name="wizard"><file name="finished.phtml" hash="e475e0a7fb28b2b054a1b26cae5fd9b8"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ometria_Core.xml" hash="f8ec0ef46b669bf0070d9064300fc0fd"/><file name="Ometria_Api.xml" hash="e9309a378992b51f710a9fca17a3055e"/><file name="Ometria_AbandonedCarts.xml" hash="a69a03804840e784362410c2596c0a08"/></dir></target><target name="mageweb"><dir name="js"><dir name="ometria"><file name="checkout.js" hash="78b5fed53276d65a42c5cad4bf92a35f"/></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
31
  </package>