cartdefender_actions - Version 2.0.0

Version Notes

Minor adjustments for Varnish caching, though backwards incompatible.

Download this release

Release Info

Developer Radoslaw Gliniecki
Extension cartdefender_actions
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.1.3 to 2.0.0

app/code/community/CartDefender/Actions/Block/Script.php CHANGED
@@ -84,10 +84,12 @@ class CartDefender_Actions_Block_Script extends Mage_Core_Block_Template
84
  ->ensureCorrelationIdSet();
85
 
86
  $cdsvarData = array(
 
87
  'website_url' =>
88
  Mage::getStoreConfig('web/unsecure/base_url', 0),
89
  'app_software_name' => 'Magento ' . Mage::getEdition(),
90
  'app_software_version' => Mage::getVersion(),
 
91
  'website_code' => $website->getCode(),
92
  'website_name' => $website->getName(),
93
  'website_default_shop_id' => $website->getDefaultGroupId(),
84
  ->ensureCorrelationIdSet();
85
 
86
  $cdsvarData = array(
87
+ 'api' => Mage::helper('actions')->getApi(),
88
  'website_url' =>
89
  Mage::getStoreConfig('web/unsecure/base_url', 0),
90
  'app_software_name' => 'Magento ' . Mage::getEdition(),
91
  'app_software_version' => Mage::getVersion(),
92
+ 'website_id' => $website->getId(),
93
  'website_code' => $website->getCode(),
94
  'website_name' => $website->getName(),
95
  'website_default_shop_id' => $website->getDefaultGroupId(),
app/code/community/CartDefender/Actions/Model/CorrelationIdManager.php CHANGED
@@ -18,7 +18,12 @@ class CartDefender_Actions_Model_CorrelationIdManager extends Varien_Object
18
  * The name of the cookie storing the CartDefender correlation id.
19
  */
20
  const CD_CORRELATION_COOKIE_NAME = "__cd_732655870348746856";
21
-
 
 
 
 
 
22
  /**
23
  * @var string|null $correlationId The CartDefender id used for correlating
24
  * web and business events.
@@ -101,9 +106,15 @@ class CartDefender_Actions_Model_CorrelationIdManager extends Varien_Object
101
  }
102
 
103
  $cookie = Mage::getSingleton('core/cookie');
104
- $corrCookie = $cookie->get(self::CD_CORRELATION_COOKIE_NAME);
105
- $this->correlationId = $corrCookie ?: $this->generateCorrelationId();
106
- if (!$corrCookie) {
 
 
 
 
 
 
107
  $this->setCorrelationIdCookie();
108
  // Notify CD servers of new correlation id.
109
  $this->sender->sendEvent(
@@ -112,11 +123,13 @@ class CartDefender_Actions_Model_CorrelationIdManager extends Varien_Object
112
  );
113
  }
114
 
115
- $this->logger->log(
116
- 'CorrelationIdManager->ensureCorrelationIdSet',
117
- 'Correlation id [' . $this->correlationId . '] '
118
- . ($corrCookie ? 'taken from' : 'created, set on new') . ' cookie.'
119
- );
 
 
120
 
121
  return $this->correlationId;
122
  }
18
  * The name of the cookie storing the CartDefender correlation id.
19
  */
20
  const CD_CORRELATION_COOKIE_NAME = "__cd_732655870348746856";
21
+
22
+ /**
23
+ * The name of the request header storing the CartDefender correlation id.
24
+ */
25
+ const CD_CORRELATION_HEADER_NAME = "X_CD_732655870348746856";
26
+
27
  /**
28
  * @var string|null $correlationId The CartDefender id used for correlating
29
  * web and business events.
106
  }
107
 
108
  $cookie = Mage::getSingleton('core/cookie');
109
+ $corrIdExternal = $cookie->get(self::CD_CORRELATION_COOKIE_NAME);
110
+ if (!$corrIdExternal) {
111
+ // Take id from header if not present on cookie
112
+ $corrIdExternal = Mage::app()->getRequest()->getHeader(self::CD_CORRELATION_HEADER_NAME);
113
+ }
114
+ // If Correlation ID was not provided, generate it.
115
+ $this->correlationId = $corrIdExternal ?: $this->generateCorrelationId();
116
+ $phpSessionId = session_id();
117
+ if (!$corrIdExternal && !empty($phpSessionId)) {
118
  $this->setCorrelationIdCookie();
119
  // Notify CD servers of new correlation id.
120
  $this->sender->sendEvent(
123
  );
124
  }
125
 
126
+ if ($this->correlationId) {
127
+ $this->logger->log(
128
+ 'CorrelationIdManager->ensureCorrelationIdSet',
129
+ 'Correlation id [' . $this->correlationId . '] '
130
+ . ($corrIdExternal ? 'taken from' : 'created, set on new') . ' cookie or header.'
131
+ );
132
+ }
133
 
134
  return $this->correlationId;
135
  }
app/code/community/CartDefender/Actions/Model/Observer.php CHANGED
@@ -59,7 +59,9 @@ class CartDefender_Actions_Model_Observer extends Varien_Event_Observer
59
  */
60
  public function captureEvent($observer)
61
  {
62
- if (!Mage::helper('actions')->isCDEnabledAndRequestNonLocalNonAdmin()) {
 
 
63
  return;
64
  }
65
  $this->logger->log('Observer->captureEvent');
59
  */
60
  public function captureEvent($observer)
61
  {
62
+ $phpSessionId = session_id();
63
+ if (!Mage::helper('actions')->isCDEnabledAndRequestNonLocalNonAdmin()
64
+ || empty($phpSessionId)) {
65
  return;
66
  }
67
  $this->logger->log('Observer->captureEvent');
app/code/community/CartDefender/Actions/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <CartDefender_Actions>
15
- <version>1.1.3</version>
16
  </CartDefender_Actions>
17
  </modules>
18
 
12
  <config>
13
  <modules>
14
  <CartDefender_Actions>
15
+ <version>2.0.0</version>
16
  </CartDefender_Actions>
17
  </modules>
18
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cartdefender_actions</name>
4
- <version>1.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Increase sales with smart targeted popups and offers delivered to your visitors in real time.</summary>
10
  <description>You can instantly use messages and offers which convert your visitors into customers. You focus on your business needs without A/B tests, as Cart Defender learns which popups convert the best and adjusts itself automatically.</description>
11
- <notes>No-op refactors and minor bugfixes.</notes>
12
  <authors><author><name>Radoslaw Gliniecki</name><user>Cart_Defender</user><email>radek@cartdefender.com</email></author><author><name>Jan Zankowski</name><user>janzankowski</user><email>jan@cartdefender.com</email></author><author><name>Przemyslaw Gliniecki</name><user>psgliniecki</user><email>psg@cartdefender.com</email></author></authors>
13
- <date>2016-10-27</date>
14
- <time>20:04:27</time>
15
- <contents><target name="magecommunity"><dir name="CartDefender"><dir name="Actions"><dir name="Block"><file name="Script.php" hash="b234814d8cd363bcb22c3f9ed33bb80b"/></dir><dir name="Helper"><file name="Data.php" hash="dd4057deaaa8b0bdcfcc3e6f7c31091c"/><file name="Logger.php" hash="f21b3aed521b3761a890b22ba0f247a9"/></dir><dir name="Model"><file name="AsyncLocalSender.php" hash="f4df465d8bba0799a5381b50e7fe244f"/><file name="CorrelationIdManager.php" hash="427b1999971c28ee4a5dc39d6c158be1"/><file name="EventAsyncLocalSender.php" hash="cd9a25e21225cb1966da47fbbc8f9854"/><file name="EventBuilder.php" hash="d814e3b3c947e5a4815b43ba268a9b87"/><file name="Observer.php" hash="b6e3237c696a417557fa7a3a98b75358"/></dir><dir name="controllers"><file name="CartDefenderSenderController.php" hash="2932402af887cac75255758c7fd4da34"/></dir><dir name="etc"><file name="config.xml" hash="b6332ca2c6038b906edb525d1cf4df71"/><file name="system.xml" hash="3a0ef9f8ca4414d7714e717a64816a33"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CartDefender_Actions.xml" hash="f9e77235e41f79ac086160ef2e494837"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="actions"><file name="script.phtml" hash="aa322fad9cd04ae7c910936e043fa8f1"/></dir></dir><dir name="layout"><file name="actions.xml" hash="e6a4b2f6d8132a833a1b5f8b9fce7166"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.2</min><max>1.9.2.4</max></package><extension><name>openssl</name><min>0.9.6</min><max>1.0.1</max></extension></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>cartdefender_actions</name>
4
+ <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Increase sales with smart targeted popups and offers delivered to your visitors in real time.</summary>
10
  <description>You can instantly use messages and offers which convert your visitors into customers. You focus on your business needs without A/B tests, as Cart Defender learns which popups convert the best and adjusts itself automatically.</description>
11
+ <notes>Minor adjustments for Varnish caching, though backwards incompatible.</notes>
12
  <authors><author><name>Radoslaw Gliniecki</name><user>Cart_Defender</user><email>radek@cartdefender.com</email></author><author><name>Jan Zankowski</name><user>janzankowski</user><email>jan@cartdefender.com</email></author><author><name>Przemyslaw Gliniecki</name><user>psgliniecki</user><email>psg@cartdefender.com</email></author></authors>
13
+ <date>2016-11-08</date>
14
+ <time>11:31:47</time>
15
+ <contents><target name="magecommunity"><dir name="CartDefender"><dir name="Actions"><dir name="Block"><file name="Script.php" hash="3b1ca143e8b9209ce3e9df6dce1621ac"/></dir><dir name="Helper"><file name="Data.php" hash="dd4057deaaa8b0bdcfcc3e6f7c31091c"/><file name="Logger.php" hash="f21b3aed521b3761a890b22ba0f247a9"/></dir><dir name="Model"><file name="AsyncLocalSender.php" hash="f4df465d8bba0799a5381b50e7fe244f"/><file name="CorrelationIdManager.php" hash="7215fd45ca052d5bde16e93d278565be"/><file name="EventAsyncLocalSender.php" hash="cd9a25e21225cb1966da47fbbc8f9854"/><file name="EventBuilder.php" hash="d814e3b3c947e5a4815b43ba268a9b87"/><file name="Observer.php" hash="f34856aad9bf7aeb870317f6548eb349"/></dir><dir name="controllers"><file name="CartDefenderSenderController.php" hash="2932402af887cac75255758c7fd4da34"/></dir><dir name="etc"><file name="config.xml" hash="a98f35a697800c7eff52a11f9448f72b"/><file name="system.xml" hash="3a0ef9f8ca4414d7714e717a64816a33"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="CartDefender_Actions.xml" hash="f9e77235e41f79ac086160ef2e494837"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="actions"><file name="script.phtml" hash="aa322fad9cd04ae7c910936e043fa8f1"/></dir></dir><dir name="layout"><file name="actions.xml" hash="e6a4b2f6d8132a833a1b5f8b9fce7166"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.7.0.2</min><max>1.9.2.4</max></package><extension><name>openssl</name><min>0.9.6</min><max>1.0.1</max></extension></required></dependencies>
18
  </package>