Refiral - Version 1.0.7

Version Notes

Stable version of Refiral extension.

Download this release

Release Info

Developer Refiral
Extension Refiral
Version 1.0.7
Comparing to
See all releases


Code changes from version 1.0.6 to 1.0.7

app/code/community/Refiral/Campaign/Helper/Data.php CHANGED
@@ -30,6 +30,15 @@ class Refiral_Campaign_Helper_Data extends Mage_Core_Helper_Abstract {
30
  else
31
  return false;
32
  }
 
 
 
 
 
 
 
 
 
33
 
34
  public function getKey()
35
  {
@@ -42,7 +51,8 @@ class Refiral_Campaign_Helper_Data extends Mage_Core_Helper_Abstract {
42
  $module = $request->getModuleName();
43
  $controller = $request->getControllerName();
44
  $action = $request->getActionName();
45
- $script = "<script>var apiKey = '".$this->getKey()."';</script>"."\n";
 
46
  if ($module == 'checkout' && $controller == 'onepage' && $action == 'success')
47
  {
48
  $order = new Mage_Sales_Model_Order();
@@ -65,11 +75,20 @@ class Refiral_Campaign_Helper_Data extends Mage_Core_Helper_Abstract {
65
 
66
  // Call invoiceRefiral function
67
  $scriptAppend = "<script>whenAvailable('invoiceRefiral',function(){invoiceRefiral('$order_total','$order_total','$order_coupon','$cartInfoString','$order_name','$order_email','$orderId')});</script>"."\n";
 
 
 
 
 
 
68
  $script .= '<script>var showButton = false;</script>'."\n";
69
  }
70
  else
71
  {
72
- $scriptAppend = '';
 
 
 
73
  $script .= '<script>var showButton = true;</script>'."\n";
74
  }
75
  $script .= '<script type="text/javascript">(function e(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//rfer.co/api/v1/js/all.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>'."\n";
30
  else
31
  return false;
32
  }
33
+
34
+ public function debug()
35
+ {
36
+ $debug = Mage::getStoreConfig('general/refiral_campaign/debug');
37
+ if(!empty($debug))
38
+ return true;
39
+ else
40
+ return false;
41
+ }
42
 
43
  public function getKey()
44
  {
51
  $module = $request->getModuleName();
52
  $controller = $request->getControllerName();
53
  $action = $request->getActionName();
54
+ $flag = false;
55
+ $script = "<script>var apiKey = '".$this->getKey()."';</script>"."\n";
56
  if ($module == 'checkout' && $controller == 'onepage' && $action == 'success')
57
  {
58
  $order = new Mage_Sales_Model_Order();
75
 
76
  // Call invoiceRefiral function
77
  $scriptAppend = "<script>whenAvailable('invoiceRefiral',function(){invoiceRefiral('$order_total','$order_total','$order_coupon','$cartInfoString','$order_name','$order_email','$orderId')});</script>"."\n";
78
+
79
+ if($this->debug())
80
+ {
81
+ $scriptAppend .= "<script>console.log('Module: ".$module.", Controller: ".$controller.", Action: ".$action."');</script>";
82
+ $scriptAppend .= "<script>console.log('Total: ".$order_total.", Coupon: ".$order_coupon.", Cart: ".$cartInfoString.", Name: ".$order_name.", Email: ".$order_email.", Id: ".$orderId."');</script>";
83
+ }
84
  $script .= '<script>var showButton = false;</script>'."\n";
85
  }
86
  else
87
  {
88
+ if($this->debug())
89
+ $scriptAppend = "<script>console.log('Module: ".$module.", Controller: ".$controller.", Action: ".$action."');</script>";
90
+ else
91
+ $scriptAppend = '';
92
  $script .= '<script>var showButton = true;</script>'."\n";
93
  }
94
  $script .= '<script type="text/javascript">(function e(){var e=document.createElement("script");e.type="text/javascript",e.async=true,e.src="//rfer.co/api/v1/js/all.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();</script>'."\n";
app/code/community/Refiral/Campaign/etc/system.xml CHANGED
@@ -46,6 +46,15 @@
46
  <show_in_store>1</show_in_store>
47
  <comment><![CDATA[You first need to create an account on <a href="http://www.refiral.com" target="_blank">Refiral.com</a> and set-up your campaign to get API key.]]></comment>
48
  </apikey>
 
 
 
 
 
 
 
 
 
49
  </fields>
50
  </refiral_campaign>
51
  </groups>
46
  <show_in_store>1</show_in_store>
47
  <comment><![CDATA[You first need to create an account on <a href="http://www.refiral.com" target="_blank">Refiral.com</a> and set-up your campaign to get API key.]]></comment>
48
  </apikey>
49
+ <debug translate="label">
50
+ <label>Debug</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>30</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </debug>
58
  </fields>
59
  </refiral_campaign>
60
  </groups>
app/design/frontend/base/default/template/refiral_campaign/campaign.phtml CHANGED
@@ -2,7 +2,6 @@
2
  <script type="text/javascript">
3
  function whenAvailable(n,e){var i=10;window.setTimeout(function(){window[n]?e(window[n]):window.setTimeout(arguments.callee,i)},i)}
4
  </script>
5
- <script>var $j = jQuery.noConflict();</script>
6
  <?php
7
  $_helper = Mage::helper('campaign');
8
  if($_helper->isActive())
2
  <script type="text/javascript">
3
  function whenAvailable(n,e){var i=10;window.setTimeout(function(){window[n]?e(window[n]):window.setTimeout(arguments.callee,i)},i)}
4
  </script>
 
5
  <?php
6
  $_helper = Mage::helper('campaign');
7
  if($_helper->isActive())
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Refiral</name>
4
- <version>1.0.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GPLv3</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Boost your sales up to 3X with our new hybrid marketing channel. Run your personalized, easy to integrate fully automated referral program.</description>
11
  <notes>Stable version of Refiral extension.</notes>
12
  <authors><author><name>Refiral</name><user>refiral</user><email>support@refiral.com</email></author></authors>
13
- <date>2014-11-18</date>
14
- <time>14:08:33</time>
15
- <contents><target name="magecommunity"><dir name="Refiral"><dir name="Campaign"><dir name="Block"><file name="default.php" hash="39f687630fe10bbed1d15c069a7f1817"/></dir><dir name="Helper"><file name="Data.php" hash="08925e1b7982ffb0dc262741173acebd"/></dir><dir name="etc"><file name="config.xml" hash="9850240b5844d7ef003c1690225d787e"/><file name="system.xml" hash="06279a67e93961ea78c5c2cfa207c00d"/></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="refiral_campaign"><file name="campaign.phtml" hash="1a244408b1203e7a8f4f6f62208fd71d"/></dir></dir><dir name="layout"><file name="refiral_campaign.xml" hash="273dfeba936c497c90679a1c94225278"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Refiral_Campaign.xml" hash="5cfba36effdd31e490eca65ae5086925"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Refiral</name>
4
+ <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl-3.0-standalone.html">GPLv3</license>
7
  <channel>community</channel>
10
  <description>Boost your sales up to 3X with our new hybrid marketing channel. Run your personalized, easy to integrate fully automated referral program.</description>
11
  <notes>Stable version of Refiral extension.</notes>
12
  <authors><author><name>Refiral</name><user>refiral</user><email>support@refiral.com</email></author></authors>
13
+ <date>2014-12-09</date>
14
+ <time>09:05:15</time>
15
+ <contents><target name="magecommunity"><dir name="Refiral"><dir name="Campaign"><dir name="Block"><file name="default.php" hash="39f687630fe10bbed1d15c069a7f1817"/></dir><dir name="Helper"><file name="Data.php" hash="29d8d3998af26268fbc1b4fbde1d4f18"/></dir><dir name="etc"><file name="config.xml" hash="9850240b5844d7ef003c1690225d787e"/><file name="system.xml" hash="7a7f1be925b4e63a822fb9101bb2ecdc"/></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="refiral_campaign"><file name="campaign.phtml" hash="bf9240c0ad7f5337fc29fb3e0b7b72ad"/></dir></dir><dir name="layout"><file name="refiral_campaign.xml" hash="273dfeba936c497c90679a1c94225278"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Refiral_Campaign.xml" hash="5cfba36effdd31e490eca65ae5086925"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>