RetentionScience_Waves - Version 2.2.0

Version Notes

Upgraded waves JS

Download this release

Release Info

Developer Magento Core Team
Extension RetentionScience_Waves
Version 2.2.0
Comparing to
See all releases


Code changes from version 2.1.9 to 2.2.0

app/code/community/RetentionScience/Waves/.DS_Store ADDED
Binary file
app/code/community/RetentionScience/Waves/Block/.DS_Store ADDED
Binary file
app/code/community/RetentionScience/Waves/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <RetentionScience_Waves>
5
- <version>2.1.9</version>
6
  </RetentionScience_Waves>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <RetentionScience_Waves>
5
+ <version>2.2.0</version>
6
  </RetentionScience_Waves>
7
  </modules>
8
  <global>
app/design/frontend/base/default/template/waves/waves.phtml CHANGED
@@ -1,79 +1,67 @@
1
  <?php
2
  $status = $this->isEnable();
3
- if($status && $this->getSiteid()){
4
- $loggedIn = $this->customerLoggedIn();
5
- $moduleName = $this->getRequest()->getModuleName();
6
- $controllerName = $this->getRequest()->getControllerName();
7
- $actionName = $this->getRequest()->getActionName();
8
-
9
- ?>
10
- <!-- lmca <?php echo $loggedIn ?> | <?php echo $moduleName ?> | <?php echo $controllerName ?> | <?php echo $actionName ?> -->
11
-
12
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- <script type='text/javascript'> (function() { var iBx = document.createElement('script'); iBx.type = 'text/javascript'; iBx.async =
15
- true; iBx.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'waves.retentionscience.com/w.js';
16
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(iBx); })();
17
- </script>
18
- <script type="text/javascript">
19
- var rsci_init = function(){
20
- rsci_wave.set_site_id('<?php echo $this->getSiteid();?>');
21
- <?php if($loggedIn) { ?>
22
- <?php $user_id_set = $this->customerId(); ?>
23
- rsci_wave.set_user_id('<?php echo $this->customerId();?>');
24
- <?php }
25
-
26
- if($moduleName=="catalog" && $controllerName=="product" && $actionName=="view"){
27
- $productId['id'] = $this->getRequest()->getParam('id');
28
- ?>
29
- rsci_wave.add_item(<?php echo json_encode($productId)?>);
30
- <?php }
31
- if(($moduleName=="checkout" && $controllerName=="cart" && $actionName=="index") || ($moduleName=="rangepricing" && $controllerName=="checkout_cart" && $actionName=="index" ) ){ ?>
32
- rsci_wave.set_action('shopping_cart');
33
- // has 1 or more items in shopping cart
34
- <?php
35
- $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
36
- foreach ($allItems as $item){
37
- $itemArr['id'] = $item->getProductId();
38
- $itemArr['name'] = $item->getName();
39
- $itemArr['price'] = $item->getPrice();
40
- ?>
41
- rsci_wave.add_item(<?php echo json_encode($itemArr) ?>);
42
- <?php }
43
- }
44
-
45
 
46
- if(($moduleName=="checkout" && $controllerName=="onepage" && $actionName=="success") || ($moduleName=="onestepcheckout" && $controllerName=="index" && $actionName=="success")){
47
- $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
48
- $order = $this->getOrder(); ?>
49
-
50
- rsci_wave.set_action('checkout_success');
51
- // Order info consists of order_id, and total_price
52
- rsci_wave.add_order_info('<?php echo $this->getOrderId();?>', '<?php echo $order->getBaseGrandTotal();?>');
53
- // purchased and checked out successfully with 1 or more items
54
- <?php
55
- if (empty($user_id_set)) {
56
- $user_record_id = md5(trim(strtolower($order->getCustomerEmail())));
57
- echo "\n // guest \n";
58
- echo "\n rsci_wave.set_user_id('" . $user_record_id . "'); \n";
59
- }
60
- $allitems = $order->getAllItems();
61
- foreach($allitems as $item){
62
- $itemArr['id'] = $item->getProductId();
63
- $itemArr['name'] = $item->getName();
64
- $itemArr['price'] = $item->getPrice();
65
- ?>
66
- rsci_wave.add_item(<?php echo json_encode($itemArr) ?>);
67
- <?php }
68
- }
69
-
70
- ?> } // rsci_init end
71
- </script>
72
- <?php if($this->isAjaxAddToCartEnable()) { ?>
73
- <script src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)."RetentionScience/retention_science_wave.js";?>"></script>
74
- <script type="text/javascript">
75
- setAjaxSendCartUrl('<?php echo Mage::getUrl('waves/index/scriptRun') ?>');
76
- </script>
77
- <?php }
78
- }
79
- ?>
1
  <?php
2
  $status = $this->isEnable();
3
+ if ($status && $this->getSiteid()) {
4
+ $loggedIn = $this->customerLoggedIn();
5
+ $moduleName = $this->getRequest()->getModuleName();
6
+ $controllerName = $this->getRequest()->getControllerName();
7
+ $actionName = $this->getRequest()->getActionName(); ?>
8
+
9
+ <!-- lmca <?php echo $loggedIn ?> | <?php echo $moduleName ?> | <?php echo $controllerName ?> | <?php echo $actionName ?> -->
10
+
11
+ <script type="text/javascript">
12
+ var _rsq = _rsq || [];
13
+ _rsq.push(['_setSiteId', '<?php echo $this->getSiteid();?>']);
14
+
15
+ <?php if($loggedIn) {
16
+ $user_id_set = $this->customerId(); ?>
17
+ _rsq.push(['_setUserId', '<?php echo $user_id_set; ?>']);
18
+ <?php }
19
+
20
+ if ($moduleName == "catalog" && $controllerName == "product" && $actionName == "view") {
21
+ $productId['id'] = $this->getRequest()->getParam('id'); ?>
22
+
23
+ _rsq.push(['_addItem', <?php echo json_encode($productId)?>]);
24
+ <?php }
25
+
26
+ if (($moduleName == "checkout" && $controllerName == "cart" && $actionName == "index") || ($moduleName == "rangepricing" && $controllerName == "checkout_cart" && $actionName == "index")) {
27
+ $allItems = Mage::getModel('checkout/cart')->getQuote()->getAllItems();
28
+ foreach ($allItems as $item) {
29
+ $itemArr['id'] = $item->getProductId();
30
+ $itemArr['name'] = $item->getName();
31
+ $itemArr['price'] = $item->getPrice(); ?>
32
+ _rsq.push(['_addItem', <?php echo json_encode($itemArr) ?>]);
33
+ <?php } ?>
34
+ _rsq.push(['_setAction', 'shopping_cart']);
35
+ <?php }
36
 
37
+ if (($moduleName == "checkout" && $controllerName == "onepage" && $actionName == "success") || ($moduleName == "onestepcheckout" && $controllerName == "index" && $actionName == "success")) {
38
+ $order = $this->getOrder();
39
+ if (empty($user_id_set)) {
40
+ $user_record_id = md5(trim(strtolower($order->getCustomerEmail()))); ?>
41
+ // guest
42
+ _rsq.push(['_setUserId', '<?php echo $user_record_id; ?>']);
43
+ <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ $allitems = $order->getAllItems();
46
+ foreach($allitems as $item){
47
+ $itemArr['id'] = $item->getProductId();
48
+ $itemArr['name'] = $item->getName();
49
+ $itemArr['price'] = $item->getPrice(); ?>
50
+
51
+ _rsq.push(['_addItem', <?php echo json_encode($itemArr); ?>]);
52
+ <?php } ?>
53
+
54
+ _rsq.push(['_addOrder', {id: '<?php echo $this->getOrderId();?>', total: '<?php echo $order->getBaseGrandTotal();?>'}]);
55
+ _rsq.push(['_setAction', 'checkout_success']);
56
+ <?php } ?>
57
+
58
+ _rsq.push(['_track']);
59
+ (function() { var rScix = document.createElement('script');; rScix.type = 'text/javascript';; rScix.async = true;; rScix.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'd1stxfv94hrhia.cloudfront.net/waves/v2/w.js';; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(rScix);; })();
60
+ </script>
61
+ <?php if ($this->isAjaxAddToCartEnable()) { ?>
62
+ <script src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)."RetentionScience/retention_science_wave.js";?>"></script>
63
+ <script type="text/javascript">
64
+ setAjaxSendCartUrl('<?php echo Mage::getUrl('waves/index/scriptRun') ?>');
65
+ </script>
66
+ <?php }
67
+ }
 
 
 
 
 
 
 
 
 
 
 
js/RetentionScience/retention_science_wave.js CHANGED
@@ -1,37 +1,27 @@
1
  var rSciUrl = "";
2
  function setAjaxSendCartUrl(ajax_send_cart_url){
3
- rSciUrl = ajax_send_cart_url;
4
  }
5
 
6
  function retention_science_send_cart(){
7
- if(rSciUrl!=""){
8
- new Ajax.Request(rSciUrl, {
9
- onSuccess: function(transport) {
10
-
11
- var json = transport.responseText.evalJSON();
12
- siteID = json.siteID;
13
-
14
- rsci_init = function(){
15
- rsci_wave.set_site_id(siteID);
16
- rsci_wave.set_action('shopping_cart');
17
-
18
- if(json.customerId!=""){
19
- rsci_wave.set_user_id(json.customerId);
20
- }
21
-
22
- items = json.items.evalJSON();
23
- items.each(function(item){
24
- var data = {id:item.id, name:item.name, price:item.price };
25
- rsci_wave.add_item(data);
26
- });
27
- };
28
-
29
- (function() { var iBx = document.createElement('script'); iBx.type = 'text/javascript'; iBx.async =
30
- true; iBx.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'waves.retentionscience.com/w.js';
31
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(iBx); })();
32
-
33
- //rsci_init();
34
- }, method: "get"
35
  });
36
- }
 
 
 
 
 
 
37
  }
1
  var rSciUrl = "";
2
  function setAjaxSendCartUrl(ajax_send_cart_url){
3
+ rSciUrl = ajax_send_cart_url;
4
  }
5
 
6
  function retention_science_send_cart(){
7
+ if (rSciUrl != "") {
8
+ new Ajax.Request(rSciUrl, {
9
+ onSuccess: function(transport) {
10
+ var json = transport.responseText.evalJSON();
11
+
12
+ if (json.customerId != "") {
13
+ _rsq.push(['_setUserId', json.customerId]);
14
+ }
15
+
16
+ items = json.items.evalJSON();
17
+ items.each(function(item){
18
+ _rsq.push(['_addItem', {id: item.id, name: item.name, price: item.price}]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  });
20
+
21
+ _rsq.push(['_setAction', 'shopping_cart']);
22
+ _rsq.push(['_track']);
23
+ },
24
+ method: "get"
25
+ });
26
+ }
27
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RetentionScience_Waves</name>
4
- <version>2.1.9</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</license>
7
  <channel>community</channel>
@@ -16,11 +16,11 @@ We leverage big data analytics and machine learning to optimize retention strate
16
  Our technology enables your store to leverage massive social media, demographic, and behavioral datasets - powerful information sources to help you drive sales. &#xD;
17
  &#xD;
18
  Notes: This extension interfaces with Retention Science, and communicates through the Retention Science API. For more information, and to sign up for API access, please see http://retentionscience.com.</description>
19
- <notes>Magento re-upload</notes>
20
  <authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
21
- <date>2013-06-09</date>
22
- <time>06:36:54</time>
23
- <contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="ddaa6fcc9b7c7448ca4546e28ded58f3"/><file name="Syncbutton.php" hash="f0e364d31e12bffd40a13e88bce3bc97"/></dir><file name="Waves.php" hash="e40dffc0ab52847e560182196a252291"/></dir><dir name="Helper"><file name="Data.php" hash="90490af254a670d4795b744c1ef4319e"/><file name="Storeselect.php" hash="dbfeb7a4e9e1f5c52fdbc2eac9370fcf"/></dir><dir name="Model"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="027feb7796f79b7cf811c4236ad7b87a"/><file name="Hours.php" hash="0ab9157003d5e7efed402ed401a46134"/></dir><file name="Categorytree.php" hash="8911fb34a76fed31b9e20a6a9fea0712"/><file name="Cronconfig.php" hash="f2dd3dcd572bd7407663576e250f9d23"/><file name="Rscoredata.php" hash="178f70a1f05415c86b6c5e959fb2fe50"/></dir><file name="Observer.php" hash="bdf08ae6ff20ba85878ca8e368cd9c1a"/><file name="retention_science_api.php" hash="d9d5197492408502cf6084f19def5aa0"/><file name="rs_get_save_config.php" hash="9ff13acecc3cc89066e1476ee48459fb"/><file name="rs_send_categories.php" hash="1633b1c1b01a9c3666c0687586693102"/><file name="rs_send_orders.php" hash="1b4f0260e74fbe11436af16238ecd61b"/><file name="rs_send_products.php" hash="c54656d728ad1c91185be35dd27f86d2"/><file name="rs_send_users.php" hash="0e27f4293d666c35e90ebb852ae83fb7"/><file name="rs_sync_data.php" hash="5b7ed9f5e50e26b343cae9578bf053bd"/></dir><dir name="controllers"><file name="AdminController.php" hash="25905c7233adde08763a74d8792e722f"/><file name="IndexController.php" hash="281b3223e4b71858ec0b43739bcdf97d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1378650fdb7ecc596f9881d7eefca868"/><file name="config.xml" hash="ba7346fa6b5ed0c5f4a14a26f166a9b7"/><file name="system.xml" hash="b2d00b02e576c1ee4049951577d74610"/></dir></dir><file name=".DS_Store" hash="128e595394427daa0503e6d824d6b4ef"/></dir></target><target name="mageweb"><dir name="js"><dir name="RetentionScience"><file name="retention_science_wave.js" hash="10bb411288770c07290c693ac03700b6"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="waves.xml" hash="7f62bec7d87da48c0e554fc1cf3a9802"/></dir><dir name="template"><dir name="waves"><file name="waves.phtml" hash="c68251968b899428356f743a92b0ce9f"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="waves"><file name="rscore.phtml" hash="4f6af3dd918b23a009bb559e12f23c05"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RetentionScience_Waves.xml" hash="9dc27ff12e5834f576b22a72a60d02e7"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies/>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>RetentionScience_Waves</name>
4
+ <version>2.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</license>
7
  <channel>community</channel>
16
  Our technology enables your store to leverage massive social media, demographic, and behavioral datasets - powerful information sources to help you drive sales. &#xD;
17
  &#xD;
18
  Notes: This extension interfaces with Retention Science, and communicates through the Retention Science API. For more information, and to sign up for API access, please see http://retentionscience.com.</description>
19
+ <notes>Upgraded waves JS</notes>
20
  <authors><author><name>Retention Science</name><user>auto-converted</user><email>support@retentionscience.com</email></author></authors>
21
+ <date>2013-07-15</date>
22
+ <time>19:19:54</time>
23
+ <contents><target name="magecommunity"><dir name="RetentionScience"><dir name="Waves"><dir name="Block"><dir name="Adminhtml"><file name="Rscore.php" hash="ddaa6fcc9b7c7448ca4546e28ded58f3"/><file name="Syncbutton.php" hash="f0e364d31e12bffd40a13e88bce3bc97"/></dir><file name="Waves.php" hash="e40dffc0ab52847e560182196a252291"/><file name=".DS_Store" hash="9d0f8114c9a54f73944ba316a2c47467"/></dir><dir name="Helper"><file name="Data.php" hash="90490af254a670d4795b744c1ef4319e"/><file name="Storeselect.php" hash="dbfeb7a4e9e1f5c52fdbc2eac9370fcf"/></dir><dir name="Model"><dir name="Source"><dir name="Cron"><file name="Frequency.php" hash="027feb7796f79b7cf811c4236ad7b87a"/><file name="Hours.php" hash="0ab9157003d5e7efed402ed401a46134"/></dir><file name="Categorytree.php" hash="8911fb34a76fed31b9e20a6a9fea0712"/><file name="Cronconfig.php" hash="f2dd3dcd572bd7407663576e250f9d23"/><file name="Rscoredata.php" hash="178f70a1f05415c86b6c5e959fb2fe50"/></dir><file name="Observer.php" hash="bdf08ae6ff20ba85878ca8e368cd9c1a"/><file name="retention_science_api.php" hash="d9d5197492408502cf6084f19def5aa0"/><file name="rs_get_save_config.php" hash="9ff13acecc3cc89066e1476ee48459fb"/><file name="rs_send_categories.php" hash="1633b1c1b01a9c3666c0687586693102"/><file name="rs_send_orders.php" hash="1b4f0260e74fbe11436af16238ecd61b"/><file name="rs_send_products.php" hash="c54656d728ad1c91185be35dd27f86d2"/><file name="rs_send_users.php" hash="0e27f4293d666c35e90ebb852ae83fb7"/><file name="rs_sync_data.php" hash="5b7ed9f5e50e26b343cae9578bf053bd"/></dir><dir name="controllers"><file name="AdminController.php" hash="25905c7233adde08763a74d8792e722f"/><file name="IndexController.php" hash="281b3223e4b71858ec0b43739bcdf97d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1378650fdb7ecc596f9881d7eefca868"/><file name="config.xml" hash="5aa9dd1c7cbb187089dc4a971ec35621"/><file name="system.xml" hash="b2d00b02e576c1ee4049951577d74610"/></dir><file name=".DS_Store" hash="23698de108708cadf80a5a90b7b2b05a"/></dir><file name=".DS_Store" hash="128e595394427daa0503e6d824d6b4ef"/></dir></target><target name="mageweb"><dir name="js"><dir name="RetentionScience"><file name="retention_science_wave.js" hash="bbb32a179f6b6f7f8a19ee3e200b8178"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="waves.xml" hash="7f62bec7d87da48c0e554fc1cf3a9802"/></dir><dir name="template"><dir name="waves"><file name="waves.phtml" hash="d41683122fc4b8704d9bd1bda7e371ab"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="waves"><file name="rscore.phtml" hash="4f6af3dd918b23a009bb559e12f23c05"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="RetentionScience_Waves.xml" hash="9dc27ff12e5834f576b22a72a60d02e7"/></dir></target></contents>
24
  <compatible/>
25
  <dependencies/>
26
  </package>