invitebox_plugin - Version 1.0.0

Version Notes

first stable version

Download this release

Release Info

Developer Magento Core Team
Extension invitebox_plugin
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (36) hide show
  1. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Campaign.php +19 -0
  2. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Campaign.php~ +19 -0
  3. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Coupon.php +23 -0
  4. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Coupon.php~ +19 -0
  5. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Ibsettings.php +23 -0
  6. app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Statistic.php +19 -0
  7. app/code/community/Invitebox/Ibwidget/Block/Ibsettings.php +17 -0
  8. app/code/community/Invitebox/Ibwidget/Block/Ibtracking.php +27 -0
  9. app/code/community/Invitebox/Ibwidget/Block/Ibtracking.php~ +27 -0
  10. app/code/community/Invitebox/Ibwidget/Block/Ibwidget.php +28 -0
  11. app/code/community/Invitebox/Ibwidget/Helper/Data.php +5 -0
  12. app/code/community/Invitebox/Ibwidget/Helper/Ibsettings.php +4 -0
  13. app/code/community/Invitebox/Ibwidget/Model/Ibwidget.php +317 -0
  14. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CampaignController.php +19 -0
  15. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CampaignController.php~ +19 -0
  16. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CouponController.php +46 -0
  17. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CouponController.php~ +19 -0
  18. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/IbsettingsController.php +67 -0
  19. app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/StatisticController.php +19 -0
  20. app/code/community/Invitebox/Ibwidget/controllers/IndexController.php +53 -0
  21. app/code/community/Invitebox/Ibwidget/etc/adminhtml.xml +21 -0
  22. app/code/community/Invitebox/Ibwidget/etc/config.xml +152 -0
  23. app/code/community/Invitebox/Ibwidget/etc/system.xml_ +42 -0
  24. app/code/community/Invitebox/Ibwidget/etc/widget.xml +20 -0
  25. app/code/community/Invitebox/Ibwidget/index.php +2 -0
  26. app/code/community/Invitebox/Ibwidget/sql/ibwidget_setup/mysql4-install-0.1.0.php +29 -0
  27. app/code/community/Invitebox/Ibwidget/test.php +2 -0
  28. app/design/adminhtml/default/default/layout/ibwidget.xml +25 -0
  29. app/design/adminhtml/default/default/template/ibwidget/campaigns.phtml +41 -0
  30. app/design/adminhtml/default/default/template/ibwidget/coupons.phtml +94 -0
  31. app/design/adminhtml/default/default/template/ibwidget/settings.phtml +72 -0
  32. app/design/adminhtml/default/default/template/ibwidget/statistic.phtml +41 -0
  33. app/design/adminhtml/default/default/template/ibwidget/statistic.phtml~ +43 -0
  34. app/design/frontend/default/default/layout/ibwidget.xml +9 -0
  35. app/etc/modules/Invitebox_Ibwidget.xml +9 -0
  36. package.xml +76 -0
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Campaign.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Campaign extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_campaign';
7
+ $this->_blockGroup = 'ibwidget';
8
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
9
+ parent::__construct();
10
+ }
11
+ protected function _toHtml()
12
+ {
13
+ $url = Mage::getModel('ibwidget/ibwidget')->get_settings_url();
14
+ $this->iframe_url = $url;
15
+ $html = parent::_toHtml();
16
+ return $html;
17
+ }
18
+
19
+ }
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Campaign.php~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Campaign extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_ibsettings';
7
+ $this->_blockGroup = 'ibwidget';
8
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
9
+ parent::__construct();
10
+ }
11
+ protected function _toHtml()
12
+ {
13
+ $url = Mage::getModel('ibwidget/ibwidget')->get_settings_url();
14
+ $this->iframe_url = $url;
15
+ $html = parent::_toHtml();
16
+ return $html;
17
+ }
18
+
19
+ }
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Coupon.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Coupon extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_coupon';
7
+ $this->_blockGroup = 'ibwidget';
8
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
9
+ parent::__construct();
10
+ }
11
+ protected function _toHtml()
12
+ {
13
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
14
+ ->select()
15
+ ->from('invitebox_coupon_email')
16
+ ->order('created DESC')
17
+ ->limit(100);
18
+ $this->coupons = Mage::getSingleton('core/resource')->getConnection('core_read')
19
+ ->fetchAll($select);
20
+ $html = parent::_toHtml();
21
+ return $html;
22
+ }
23
+ }
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Coupon.php~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Campaign extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_coupon';
7
+ $this->_blockGroup = 'ibwidget';
8
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
9
+ parent::__construct();
10
+ }
11
+ protected function _toHtml()
12
+ {
13
+ $url = Mage::getModel('ibwidget/ibwidget')->get_settings_url();
14
+ $this->iframe_url = $url;
15
+ $html = parent::_toHtml();
16
+ return $html;
17
+ }
18
+
19
+ }
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Ibsettings.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Ibsettings extends Mage_Adminhtml_Block_Template
3
+ // Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = 'adminhtml_ibsettings';
8
+ $this->_blockGroup = 'ibwidget';
9
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
10
+ // $this->_addButtonLabel = Mage::helper('blog/article')->__('Add Article');
11
+ //$this->_template = 'ibwidget/settings.phtml';
12
+ parent::__construct();
13
+ }
14
+ protected function _toHtml()
15
+ {
16
+ $url = Mage::getModel('ibwidget/ibwidget')->get_settings_url();
17
+ $this->iframe_url = $url;
18
+ $this->campaign_settings = Mage::getModel('ibwidget/ibwidget')->get_settings();
19
+ $html = parent::_toHtml();
20
+ return $html;
21
+ }
22
+
23
+ }
app/code/community/Invitebox/Ibwidget/Block/Adminhtml/Statistic.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Block_Adminhtml_Statistic extends Mage_Adminhtml_Block_Template
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_campaign';
7
+ $this->_blockGroup = 'ibwidget';
8
+ $this->_headerText = Mage::helper('ibwidget/ibsettings')->__('Settings');
9
+ parent::__construct();
10
+ }
11
+ protected function _toHtml()
12
+ {
13
+ $url = Mage::getModel('ibwidget/ibwidget')->get_statistic_url();
14
+ $this->iframe_url = $url;
15
+ $html = parent::_toHtml();
16
+ return $html;
17
+ }
18
+
19
+ }
app/code/community/Invitebox/Ibwidget/Block/Ibsettings.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Invitebox_Ibwidget_Block_Ibsettings extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
4
+ {
5
+ protected $_serializer = null;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_serializer = new Varien_Object();
10
+ parent::_construct();
11
+ }
12
+
13
+ protected function _toHtml(){
14
+ return 'TEST';
15
+ }
16
+
17
+ }
app/code/community/Invitebox/Ibwidget/Block/Ibtracking.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Invitebox_Ibwidget_Block_Ibtracking extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
4
+ {
5
+ protected $_serializer = null;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_serializer = new Varien_Object();
10
+ parent::_construct();
11
+ }
12
+
13
+ protected function _toHtml()
14
+ {
15
+ $M = Mage::getModel('ibwidget/ibwidget');
16
+ $settings = $M->get_settings();
17
+ if($settings!=false){
18
+ $html ="<script type=\"text/javascript\">(function() { var ibl = document.createElement('script'); ibl.type = 'text/javascript'; ibl.async = true; ibl.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'invitebox.com/invitation-camp/". $settings['id']. "/invitebox-landing.js?hash='+escape(window.location.hash); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ibl, s);})();</script>";
19
+ }
20
+ else{
21
+ $html = '';
22
+ }
23
+
24
+ return $html;
25
+
26
+ }
27
+ }
app/code/community/Invitebox/Ibwidget/Block/Ibtracking.php~ ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Invitebox_Ibwidget_Block_Ibwidget extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
4
+ {
5
+ protected $_serializer = null;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_serializer = new Varien_Object();
10
+ parent::_construct();
11
+ }
12
+
13
+ protected function _toHtml()
14
+ {
15
+ $M = Mage::getModel('ibwidget/ibwidget');
16
+ $settings = $M->get_settings();
17
+ if($settings!=false){
18
+ $html ="<script type=\"text/javascript\">(function() { var ibl = document.createElement('script'); ibl.type = 'text/javascript'; ibl.async = true; ibl.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'invitebox.com/invitation-camp/". $settings['id']. "/invitebox-landing.js?hash='+escape(window.location.hash); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ibl, s);})();</script>";
19
+ }
20
+ else{
21
+ $html = '';
22
+ }
23
+
24
+ return $html;
25
+
26
+ }
27
+ }
app/code/community/Invitebox/Ibwidget/Block/Ibwidget.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Invitebox_Ibwidget_Block_Ibwidget extends Mage_Core_Block_Template implements Mage_Widget_Block_Interface
4
+ {
5
+ protected $_serializer = null;
6
+
7
+ protected function _construct()
8
+ {
9
+ $this->_serializer = new Varien_Object();
10
+ parent::_construct();
11
+ }
12
+
13
+ protected function _toHtml()
14
+ {
15
+ //$apikey = $this->getData('api_key');
16
+
17
+ $M = Mage::getModel('ibwidget/ibwidget');
18
+ $settings = $M->get_settings();
19
+
20
+ if($settings!=false){
21
+ $html ="<script id=\"invitebox-script\" type=\"text/javascript\">(function() { var ib = document.createElement('script'); ib.type = 'text/javascript'; ib.async = true; ib.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'invitebox.com/invitation-camp/". $settings['id']. "/invitebox.js?key=". $settings['key']. "&jquery='+(typeof(jQuery)=='undefined'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ib, s);})();</script>";
22
+ }
23
+ else{
24
+ $html = '';
25
+ }
26
+ return $html;
27
+ }
28
+ }
app/code/community/Invitebox/Ibwidget/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/community/Invitebox/Ibwidget/Helper/Ibsettings.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Helper_Ibsettings extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/community/Invitebox/Ibwidget/Model/Ibwidget.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Model_Ibwidget extends Mage_Core_Model_Abstract
3
+ {
4
+
5
+ protected $_invitebox_host = 'http://invitebox.com';
6
+
7
+ public function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->_init('ibwidget/ibwidget');
11
+ }
12
+
13
+ public function get_settings(){
14
+ $select = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
15
+ ->select()
16
+ ->from('invitebox_settings')
17
+ ->limit(1);
18
+ $value = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
19
+ ->fetchAll($select);
20
+ if($value != false){
21
+ $T = $value[0];
22
+ }
23
+ else{
24
+ $T = false;
25
+ }
26
+ $this->insert_tracking_script();
27
+ return $T;
28
+ }
29
+
30
+ public function get_settings_url()
31
+ {
32
+ $select = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
33
+ ->select()
34
+ ->from('invitebox_settings')
35
+ ->limit(1);
36
+ $value = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
37
+ ->fetchAll($select);
38
+ if($value != false){
39
+ $url = $this->_invitebox_host. '/api/'. $value[0]['api_key']. '/edit';
40
+ }
41
+ else{
42
+ $url = false;
43
+ }
44
+ return $url;
45
+ }
46
+
47
+ public function get_statistic_url()
48
+ {
49
+ $settings = $this->get_settings();
50
+ if($settings != false){
51
+ $url = $this->_invitebox_host. '/api/'. $settings['api_key']. '/statistic';
52
+ }
53
+ else{
54
+ $url = false;
55
+ }
56
+ return $url;
57
+ }
58
+
59
+
60
+ public function get_or_create_campaignid($api_key)
61
+ {
62
+ /*$select = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
63
+ ->select()
64
+ ->from('invitebox_settings')
65
+ ->where('api_key=?',$api_key)
66
+ ->limit(1);
67
+ $value = Mage::getSingleton('core/resource')->getConnection('ibwidget_read')
68
+ ->fetchAll($select);
69
+ if($value != false){
70
+ $T = $value[0];
71
+ }
72
+ else{*/
73
+ $ch = curl_init();
74
+ curl_setopt ($ch, CURLOPT_URL, $this->_invitebox_host. "/invitation-camp/wordpress/?skey=" . $api_key);
75
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
76
+ curl_setopt ($ch, CURLOPT_GET, true);
77
+ $result = curl_exec($ch);
78
+ $response = json_decode($result);
79
+ $error_code = curl_errno($ch);
80
+ if ($error_code == 0 && $response->success){
81
+ $sales_rule_id = $this->set_default_sales_rule();
82
+ $data = array('id' => $response->id,
83
+ 'api_key' => $api_key,
84
+ 'key' => $response->pkey,
85
+ 'salesrule_id' => $sales_rule_id);
86
+ curl_close($ch);
87
+ $s = $this->get_settings();
88
+ if($s!=false){
89
+ $query = "UPDATE invitebox_settings SET `api_key` = '". $api_key."',`key` = '". $response->pkey. "',`id` = ". $response->id. ",`salesrule_id` = ". $sales_rule_id. " WHERE ibsettings_id = ". $s['ibsettings_id'];
90
+ Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
91
+ }
92
+ else{
93
+ Mage::getSingleton('core/resource')->getConnection('ibwidget_write')
94
+ ->insert('invitebox_settings',$data);
95
+ }
96
+ $this->set_callback();
97
+ $T = $data;
98
+ }
99
+ else{
100
+ $T = false;
101
+ }
102
+ return $T;
103
+ }
104
+
105
+ public function insert_tracking_script(){
106
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
107
+ ->select()
108
+ ->from('widget_instance')
109
+ ->where('title=?','ib_tracking')
110
+ ->limit(1);
111
+ $value = Mage::getSingleton('core/resource')->getConnection('core_read')
112
+ ->fetchOne($select);
113
+ if($value == false ){
114
+ $widgetInstance = Mage::getModel('widget/widget_instance');
115
+ $widgetInstance->setType('ibwidget/ibtracking')
116
+ ->setPackageTheme('default/default')
117
+ ->setTitle('ib_tracking')
118
+ ->setPageGroups('pages')
119
+ ->save();
120
+
121
+ $handles = array('checkout_multishipping_success',
122
+ 'checkout_onepage_success');
123
+ foreach ($handles as &$handle){
124
+ $data = array('instance_id' => $widgetInstance->getId(),
125
+ //'page_group' => 'pages',
126
+ 'layout_handle' => $handle,
127
+ 'block_reference' => 'before_body_end',
128
+ //'page_for' => 'all',
129
+ );
130
+ $V = Mage::getVersionInfo();
131
+ if($V['major']>=1 && $V['minor']>=6){
132
+ $data['page_group']='pages';
133
+ $data['page_for']='all';
134
+ }
135
+ else{
136
+ $data['group']='pages';
137
+ $data['for']='all';
138
+ }
139
+
140
+ Mage::getSingleton('core/resource')->getConnection('core_write')
141
+ ->insert('widget_instance_page',$data);
142
+
143
+ $xml = $widgetInstance->generateLayoutUpdateXml('before_body_end');
144
+ $data = array('xml' => $xml,
145
+ 'handle' => $handle);
146
+ Mage::getSingleton('core/resource')->getConnection('core_write')
147
+ ->insert('core_layout_update',$data);
148
+
149
+
150
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
151
+ ->select()
152
+ ->from('core_layout_update')
153
+ ->where('xml=?',$xml);
154
+ $layouts = Mage::getSingleton('core/resource')->getConnection('core_read')
155
+ ->fetchAll($select);
156
+
157
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
158
+ ->select()
159
+ ->from('widget_instance_page')
160
+ ->where('instance_id=?',$widgetInstance->getId());
161
+ $pages = Mage::getSingleton('core/resource')->getConnection('core_read')
162
+ ->fetchAll($select);
163
+
164
+ if($pages!=false and $layouts!=false){
165
+ $data = array('page_id' => $pages[0]['page_id'],
166
+ 'layout_update_id' => $layouts[0]['layout_update_id']
167
+ );
168
+ Mage::getSingleton('core/resource')->getConnection('core_write')
169
+ ->insert('widget_instance_page_layout',$data);
170
+ Mage::getSingleton('core/resource')->getConnection('core_write')
171
+ ->insert('core_layout_link',array('area' => 'frontend',
172
+ 'package' => 'default',
173
+ 'theme' => 'default',
174
+ 'layout_update_id' => $layouts[0]['layout_update_id']));
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ public function check_exists_rule(){
181
+ $settings = $this->get_settings();
182
+
183
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
184
+ ->select()
185
+ ->from('salesrule')
186
+ ->where('rule_id=?',$settings['salesrule_id'])
187
+ ->limit(1);
188
+ $value = Mage::getSingleton('core/resource')->getConnection('core_read')
189
+ ->fetchOne($select);
190
+ return ($settings['salesrule_id']!=null && $value);
191
+ }
192
+
193
+ public function set_default_sales_rule(){
194
+ $rule = Mage::getModel('salesrule/rule');
195
+ $settings = $this->get_settings();
196
+
197
+ if($this->check_exists_rule()){
198
+ $rule->load($settings['salesrule_id'],'rule_id');
199
+ }
200
+ else{
201
+ $rule->setName('Invitebox reward rule.')
202
+ ->setDescription('It is default invitebox rule.')
203
+ ->setFromDate(date("Y-m-d"))
204
+ ->setToDate(null)
205
+ ->setUsesPerCoupon(1)
206
+ ->setUsesPerCustomer(1)
207
+ ->setCustomerGroupIds(getAllCustomerGroups())
208
+ ->setIsActive(1)
209
+
210
+ ->setConditionsSerialized('a:6:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}')
211
+ ->setActionsSerialized(':6:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";}')
212
+ ->setStopRulesProcessing(0)
213
+ ->setIsAdvanced(1)
214
+ ->setProductIds(null)
215
+ ->setSortOrder(0)
216
+ ->setSimpleAction('by_percent')
217
+ ->setDiscountAmount(10.0000)
218
+ ->setDiscountQty(null)
219
+ ->setDiscountStep(0)
220
+ ->setSimpleFreeShipping(0)
221
+ ->setApplyToShipping(0)
222
+ ->setIsRss(0)
223
+ ->setWebsiteIds(getAllWbsites())
224
+ ->setCouponType(3);
225
+ $rule->save();
226
+ }
227
+ return $rule->getId();
228
+ }
229
+
230
+ private function set_callback(){
231
+ $settings = $this->get_settings();
232
+ $ch = curl_init();
233
+ curl_setopt ($ch, CURLOPT_URL, $this->_invitebox_host. "/api/set-callback/". $settings['id']. "/?skey=" . $settings['api_key']. '&uri='. Mage::getUrl('ibwidget/index'));
234
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
235
+ curl_setopt ($ch, CURLOPT_GET, true);
236
+ $result = curl_exec($ch);
237
+ }
238
+
239
+ public function create_invitebox_account(){
240
+ $host = Mage::app()->getFrontController()->getRequest()->getHttpHost();
241
+ $email = Mage::getSingleton('admin/session')->getUser()->getEmail();
242
+ $ch = curl_init();
243
+ curl_setopt($ch, CURLOPT_URL, $this->_invitebox_host. "/api/generate-account/?email=". $email. '&hostname='. $host);
244
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
245
+ curl_setopt($ch, CURLOPT_GET, true);
246
+ $result = curl_exec($ch);
247
+ $response = json_decode($result);
248
+ $error_code = curl_errno($ch);
249
+ if ($error_code == 0 && $response->success){
250
+ $sales_rule_id = $this->set_default_sales_rule();
251
+ $data = array('id' => $response->campaign->id,
252
+ 'api_key' => $response->campaign->api_key,
253
+ 'key' => $response->campaign->key,
254
+ 'salesrule_id' => $sales_rule_id);
255
+ curl_close($ch);
256
+ Mage::getSingleton('core/resource')->getConnection('ibwidget_write')
257
+ ->insert('invitebox_settings',$data);
258
+ $this->set_callback();
259
+ }
260
+ return $response;
261
+ }
262
+
263
+ public function get_salesRule(){
264
+ $settings = $this->get_settings();
265
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
266
+ ->select()
267
+ ->from('salesrule');
268
+ $salesrule = Mage::getSingleton('core/resource')->getConnection('core_read')
269
+ ->fetchAll($select);
270
+ if($salesrule == false){
271
+ $salesrule = array();
272
+ }
273
+ return array('current_salesrule' => $settings['salesrule_id'],
274
+ 'salesrules' => $salesrule);
275
+ }
276
+
277
+ public function set_salesRule($salesrule_id){
278
+ $select = Mage::getSingleton('core/resource')->getConnection('core_read')
279
+ ->select()
280
+ ->from('salesrule')
281
+ ->where('rule_id=?',$salesrule_id)
282
+ ->limit(1);
283
+ $salesrule = Mage::getSingleton('core/resource')->getConnection('core_read')
284
+ ->fetchOne($select);
285
+ if($salesrule != false){
286
+ $settings = $this->get_settings();
287
+ $query = "UPDATE invitebox_settings SET `salesrule_id` = ". $salesrule_id." WHERE ibsettings_id = ". $settings['ibsettings_id'];
288
+ Mage::getSingleton('core/resource')->getConnection('core_write')->query($query);
289
+ return '';
290
+ }
291
+ else{
292
+ return 'Sales rule not exists!';
293
+ }
294
+ }
295
+
296
+ }
297
+
298
+ function getAllCustomerGroups(){
299
+ //get all customer groups
300
+ $customerGroupsCollection = Mage::getModel('customer/group')->getCollection();
301
+ $customerGroupsCollection->addFieldToFilter('customer_group_code',array('nlike'=>'%auto%'));
302
+ $groups = array();
303
+ foreach ($customerGroupsCollection as $group){
304
+ $groups[] = $group->getId();
305
+ }
306
+ return $groups;
307
+ }
308
+
309
+ function getAllWbsites(){
310
+ //get all wabsites
311
+ $websites = Mage::getModel('core/website')->getCollection();
312
+ $websiteIds = array();
313
+ foreach ($websites as $website){
314
+ $websiteIds[] = $website->getId();
315
+ }
316
+ return $websiteIds;
317
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CampaignController.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_CampaignController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/ibsettings')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ if(Mage::getModel('ibwidget/ibwidget')->get_settings() == False)
15
+ $this->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings'));
16
+ $this->_initAction()->renderLayout();
17
+
18
+ }
19
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CampaignController.php~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_CampaignController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/campaign')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ $this->loadLayout()->renderLayout();
15
+ //$this->_initAction()
16
+ // ->renderLayout();
17
+
18
+ }
19
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CouponController.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_CouponController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/ibsettings')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ if(Mage::getModel('ibwidget/ibwidget')->get_settings() == False)
15
+ $this->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings'));
16
+ $this->_initAction()->renderLayout();
17
+
18
+ }
19
+
20
+ public function postAction()
21
+ {
22
+ $post = $this->getRequest()->getPost();
23
+ $error = false;
24
+ try {
25
+ if (empty($post)) {
26
+ Mage::throwException($this->__('Invalid form data.'));
27
+ }
28
+ else{
29
+ $res = Mage::getModel('ibwidget/ibwidget')->set_salesRule($post['salesrule_id']);
30
+ if ($res != ''){
31
+ $error = True;
32
+ Mage::getSingleton('adminhtml/session')->addError($res);
33
+ }
34
+ if(!$error){
35
+ $message = $this->__('Your form has been submitted successfully.');
36
+ Mage::getSingleton('adminhtml/session')->addSuccess($message);
37
+ }
38
+ }
39
+ } catch (Exception $e) {
40
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
41
+ }
42
+ $this->_redirect('*/*');
43
+
44
+ }
45
+
46
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/CouponController.php~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_CouponController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/ibsettings')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ //$this->loadLayout()->renderLayout();
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+
18
+ }
19
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/IbsettingsController.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_IbsettingsController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/ibsettings')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ //$this->loadLayout()->renderLayout();
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+
18
+ }
19
+
20
+ public function postAction()
21
+ {
22
+ $post = $this->getRequest()->getPost();
23
+ $error = false;
24
+ try {
25
+ if (empty($post)) {
26
+ Mage::throwException($this->__('Invalid form data.'));
27
+ }
28
+ if ($post['api_key'] == '' && $post['create_account'] == ''){
29
+ Mage::getSingleton('adminhtml/session')->addError($this->__('"API key" is requred.'));
30
+ }
31
+ else{
32
+ if($post['api_key'] != ''){
33
+ $settings = Mage::getModel('ibwidget/ibwidget')->get_or_create_campaignid($post['api_key']);
34
+ if($settings==false){
35
+ Mage::getSingleton('adminhtml/session')->addError($this->__('"API key" is failed.'));
36
+ $error = true;
37
+ }
38
+ }
39
+
40
+ if($post['api_key'] == '' && $post['create_account'] == 'on'){
41
+ /* here's automatic create invitebox account */
42
+ $t = Mage::getModel('ibwidget/ibwidget')->create_invitebox_account();
43
+ if($t->errors){
44
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Account not created.'));
45
+ Mage::getSingleton('adminhtml/session')->addError($t->errors[0]);
46
+ $error = true;
47
+ }
48
+ else{
49
+ Mage::getSingleton('adminhtml/session')->addSuccess('Your Invitebox account created.<br/>login: '. $t->account->username. '<br/>password: '. $t->account->password);
50
+ }
51
+ }
52
+
53
+ if(!$error){
54
+ $message = $this->__('Your form has been submitted successfully.');
55
+ Mage::getSingleton('adminhtml/session')->addSuccess($message);
56
+ $this->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign'));
57
+ return;
58
+ }
59
+
60
+ }
61
+ } catch (Exception $e) {
62
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
63
+ }
64
+ $this->_redirect('*/*');
65
+ }
66
+
67
+ }
app/code/community/Invitebox/Ibwidget/controllers/Adminhtml/StatisticController.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_Adminhtml_StatisticController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ protected function _initAction()
5
+ {
6
+ $this->loadLayout()
7
+ ->_setActiveMenu('ibwidget/ibsettings')
8
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Settings'), Mage::helper('adminhtml')->__('Settings'));;
9
+ return $this;
10
+ }
11
+
12
+ public function indexAction()
13
+ {
14
+ if(Mage::getModel('ibwidget/ibwidget')->get_settings() == False)
15
+ $this->getResponse()->setRedirect(Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings'));
16
+ $this->_initAction()->renderLayout();
17
+
18
+ }
19
+ }
app/code/community/Invitebox/Ibwidget/controllers/IndexController.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Invitebox_Ibwidget_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function IndexAction()
5
+ {
6
+ $result = array();
7
+ $this->getResponse()->setHeader('Content-type', 'application/json');
8
+ $result["error"] = null;
9
+ $api_key = $this->getRequest()->getParam('secret');
10
+ $goal = $this->getRequest()->getParam('goal') == 'True';
11
+ $event = $this->getRequest()->getParam('event') == 'referral';
12
+ $email = $this->getRequest()->getParam('referrer_email');
13
+ $M = Mage::getModel('ibwidget/ibwidget');
14
+ if ($api_key != '' && $api_key != null ){
15
+ $settings = $M->get_settings();
16
+ if($settings['api_key'] == $api_key and $goal and $event){
17
+ }
18
+ else{
19
+ $result["error"]='api_key is invalid!';
20
+ }
21
+ }
22
+ else{
23
+ $result["error"]='api_key is required!';
24
+ }
25
+ if($result["error"] === null && $M->check_exists_rule()) {
26
+ $SalesRule = Mage::getModel('salesrule/rule')->load($settings['salesrule_id'],'rule_id');
27
+
28
+ $SalesRule->setCouponType(3);
29
+ $SalesRule->setUsesPerCoupon(1);
30
+ $SalesRule->save();
31
+
32
+ $coupon = $SalesRule->acquireCoupon();
33
+ $code = '';
34
+ if ($coupon != null){
35
+ $code = $coupon->getCode();
36
+ }
37
+ $result["magento_coupon"] = $code;
38
+ if($code){
39
+ $data = array('email' => $email,
40
+ 'coupon_code' => $code,
41
+ 'created' => date("Y-m-d H:i:s"));
42
+ Mage::getSingleton('core/resource')->getConnection('core_write')
43
+ ->insert('invitebox_coupon_email',$data);
44
+ }
45
+ }
46
+
47
+ //$result['url'] = Mage::getUrl('ibwidget/index');
48
+ unset($result["error"]);// = null;
49
+ $json = Mage::helper('core')->jsonEncode($result);
50
+ $this->getResponse()->setBody($json);
51
+ }
52
+ }
53
+
app/code/community/Invitebox/Ibwidget/etc/adminhtml.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <adminhtml>
3
+ <!--
4
+ <acl>
5
+ <resources>
6
+ <all>
7
+ <title>Allow Everything</title>
8
+ </all>
9
+ <admin>
10
+ <children>
11
+ <ibwidget>
12
+ <title>Invitebox Module</title>
13
+ <sort_order>200</sort_order>
14
+ </ibwidget>
15
+ </children>
16
+ </admin>
17
+ </resources>
18
+ </acl>
19
+ -->
20
+
21
+ </adminhtml>
app/code/community/Invitebox/Ibwidget/etc/config.xml ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Invitebox_Ibwidget>
5
+ <version>0.1.0</version>
6
+ </Invitebox_Ibwidget>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <ibwidget>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Invitebox_Ibwidget</module>
14
+ <frontName>invitebox</frontName>
15
+ </args>
16
+ </ibwidget>
17
+ </routers>
18
+ </frontend>
19
+
20
+ <admin>
21
+ <routers>
22
+ <ibwidget>
23
+ <use>admin</use>
24
+ <args>
25
+ <module>Invitebox_Ibwidget</module>
26
+ <frontName>invitebox</frontName>
27
+ </args>
28
+ </ibwidget>
29
+ </routers>
30
+ </admin>
31
+
32
+ <adminhtml>
33
+ <menu>
34
+ <ibwidget module="ibwidget">
35
+ <title>Invitebox</title>
36
+ <sort_order>77</sort_order>
37
+ <children>
38
+ <ibsettings module="ibwidget">
39
+ <title>Settings</title>
40
+ <action>ibwidget/adminhtml_ibsettings</action>
41
+ </ibsettings>
42
+ </children>
43
+ <!--
44
+ <children>
45
+ <campaign module="ibwidget">
46
+ <title>Campaign settings</title>
47
+ <action>ibwidget/adminhtml_campaign</action>
48
+ </campaign>
49
+ </children>
50
+ -->
51
+ </ibwidget>
52
+ </menu>
53
+ <acl>
54
+ <resources>
55
+ <all>
56
+ <title>Allow Everything</title>
57
+ </all>
58
+ <admin>
59
+ <children>
60
+ <system>
61
+ <children>
62
+ <config>
63
+ <children>
64
+ <ibwidget_adminform translate="title">
65
+ <title>Settings</title>
66
+ <sort_order>100</sort_order>
67
+ </ibwidget_adminform>
68
+ </children>
69
+ </config>
70
+ </children>
71
+ </system>
72
+ </children>
73
+ </admin>
74
+ </resources>
75
+ </acl>
76
+
77
+ <layout>
78
+ <updates>
79
+ <ibwidget>
80
+ <file>ibwidget.xml</file>
81
+ </ibwidget>
82
+ </updates>
83
+ </layout>
84
+ </adminhtml>
85
+
86
+ <global>
87
+ <models>
88
+ <ibwidget>
89
+ <class>Invitebox_Ibwidget_Model</class>
90
+ <!-- <resourceModel>ibsettings</resourceModel>-->
91
+ </ibwidget>
92
+ <!-- <ibwidget>
93
+ <class>Invitebox_Ibwidget_Model</class>
94
+ <entities>
95
+ <ibsettings>
96
+ <table>invitebox_settings</table>
97
+ </ibsettings>
98
+ </entities>
99
+ </ibwidget>
100
+ -->
101
+ </models>
102
+ <resources>
103
+ <ibwidget_setup>
104
+ <setup>
105
+ <module>Invitebox_Ibwidget</module>
106
+ </setup>
107
+ <connection>
108
+ <use>core_setup</use>
109
+ </connection>
110
+ </ibwidget_setup>
111
+ <ibwidget_write>
112
+ <connection>
113
+ <use>core_write</use>
114
+ </connection>
115
+ </ibwidget_write>
116
+ <ibwidget_read>
117
+ <connection>
118
+ <use>core_read</use>
119
+ </connection>
120
+ </ibwidget_read>
121
+ </resources>
122
+ <blocks>
123
+ <ibwidget>
124
+ <class>Invitebox_Ibwidget_Block</class>
125
+ </ibwidget>
126
+ </blocks>
127
+ <helpers>
128
+ <ibwidget>
129
+ <class>Invitebox_Ibwidget_Helper</class>
130
+ </ibwidget>
131
+ </helpers>
132
+
133
+ <frontend>
134
+ <routers>
135
+ <ibwidget>
136
+ <use>standard</use>
137
+ <args>
138
+ <module>Invitebox_Ibwidget</module>
139
+ <frontName>get_coupon</frontName>
140
+ </args>
141
+ </ibwidget>
142
+ </routers>
143
+ <layout>
144
+ <updates>
145
+ <ibwidget>
146
+ <file>ibvidget.xml</file>
147
+ </ibwidget>
148
+ </updates>
149
+ </layout>
150
+ </frontend>
151
+ </global>
152
+ </config>
app/code/community/Invitebox/Ibwidget/etc/system.xml_ ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <ibwidget translate="label" module="ibwidget">
5
+ <label>Invitebox</label>
6
+ <sort_order>300</sort_order>
7
+ </ibwidget>
8
+ </tabs>
9
+ <sections>
10
+ <ibwidget translate="label" module="ibwidget">
11
+ <label>Settings</label>
12
+ <tab>ibwidget</tab>
13
+ <sort_order>501</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+
19
+ <groups>
20
+ <module>
21
+ <label>Invitebox Integration</label>
22
+ <sort_order>1</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled>
28
+ <label>Enabled</label>
29
+ <comment>Set this to true to disable Invitebox Integration for the current scope</comment>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabled>
37
+ </fields>
38
+ </module>
39
+ </groups>
40
+ </ibwidget>
41
+ </sections>
42
+ </config>
app/code/community/Invitebox/Ibwidget/etc/widget.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Invitebox
5
+ * @package Invitebox_Widget
6
+ * @author invitebox.com
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open
8
+ Software License (OSL 3.0)
9
+ */
10
+ -->
11
+ <widgets>
12
+ <inviteboxwidget type="ibwidget/ibwidget" translate="name description" module="ibwidget">
13
+ <name>Invitebox Widget</name>
14
+ <description>Insert invitebox widget</description>
15
+ </inviteboxwidget>
16
+ <inviteboxtracking type="ibwidget/ibtracking" translate="name description" module="ibwidget">
17
+ <name>Invitebox Tracking</name>
18
+ <description>Insert invitebox tracking sctipt</description>
19
+ </inviteboxtracking>
20
+ </widgets>
app/code/community/Invitebox/Ibwidget/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ echo 'test'
app/code/community/Invitebox/Ibwidget/sql/ibwidget_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $this->startSetup();
3
+
4
+ $this->run("
5
+
6
+ CREATE TABLE IF NOT EXISTS {$this->getTable('invitebox_settings')} (
7
+ `ibsettings_id` int(10) unsigned NOT NULL auto_increment,
8
+ `api_key` varchar(64) NOT NULL,
9
+ `key` varchar(64) default NULL,
10
+ `id` int(9) unsigned default NULL,
11
+ `salesrule_id` int(10) unsigned default NULL,
12
+
13
+ PRIMARY KEY (`ibsettings_id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+
16
+ CREATE TABLE IF NOT EXISTS `invitebox_coupon_email` (
17
+ `coupon_email_id` int(10) unsigned NOT NULL auto_increment,
18
+ `email` varchar(128) character set utf8 NOT NULL default '',
19
+ `coupon_code` varchar(128) character set utf8 NOT NULL default '',
20
+ `created` date NOT NULL,
21
+
22
+ PRIMARY KEY (`coupon_email_id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+
25
+ ");
26
+
27
+
28
+
29
+ $this->endSetup();
app/code/community/Invitebox/Ibwidget/test.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ echo 'Invitebox'
app/design/adminhtml/default/default/layout/ibwidget.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- path : app/design/adminhtml/default/default/layout/-->
3
+ <layout>
4
+ <ibwidget_adminhtml_ibsettings_index>
5
+ <reference name="content">
6
+ <block type="ibwidget/adminhtml_ibsettings" name="ibsettings" template="ibwidget/settings.phtml"/>
7
+ </reference>
8
+ </ibwidget_adminhtml_ibsettings_index>
9
+ <ibwidget_adminhtml_campaign_index>
10
+ <reference name="content">
11
+ <block type="ibwidget/adminhtml_campaign" name="campaign" template="ibwidget/campaigns.phtml"/>
12
+ </reference>
13
+ </ibwidget_adminhtml_campaign_index>
14
+ <ibwidget_adminhtml_coupon_index>
15
+ <reference name="content">
16
+ <block type="ibwidget/adminhtml_coupon" name="coupon" template="ibwidget/coupons.phtml"/>
17
+ </reference>
18
+ </ibwidget_adminhtml_coupon_index>
19
+ <ibwidget_adminhtml_statistic_index>
20
+ <reference name="content">
21
+ <block type="ibwidget/adminhtml_statistic" name="coupon" template="ibwidget/statistic.phtml"/>
22
+ </reference>
23
+ </ibwidget_adminhtml_statistic_index>
24
+
25
+ </layout>
app/design/adminhtml/default/default/template/ibwidget/campaigns.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:left" class="side-col">
2
+ <h3>Invitebox Settings</h3>
3
+ <ul class="tabs" id="page_tabs">
4
+ <li>
5
+ <a class="tab-item-link" title="Connect settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings');?>">
6
+ <span>Connect settings</span>
7
+ </a>
8
+ </li>
9
+ <?php if(Mage::getModel('ibwidget/ibwidget')->get_settings() != False): ?>
10
+ <li>
11
+ <a class="tab-item-link active" title="Campaign settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign');?>">
12
+ <span>Campaign settings</span>
13
+ </a>
14
+ </li>
15
+ <li>
16
+ <a class="tab-item-link" title="Statistic" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_statistic');?>">
17
+ <span>Statistic</span>
18
+ </a>
19
+ </li>
20
+ <li>
21
+ <a class="tab-item-link" title="Generate coupons" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_coupon');?>">
22
+ <span>Coupons</span>
23
+ </a>
24
+ </li>
25
+ <?php endif; ?>
26
+ </ul>
27
+ </div>
28
+ <div id="content" class="main-col">
29
+ <div class="main-col-inner">
30
+ <div id="messages"></div>
31
+ <div class="content-header">
32
+ <h1>Campaign settings</h1>
33
+ </div>
34
+
35
+ <?php if(false): ?>
36
+ app/design/adminhtml/default/default/template/ibwidget/
37
+ <?php endif; ?>
38
+
39
+ <iframe style="height:auto;width:100%;border:none;min-height:1500px" src="<?php echo $this->iframe_url; ?>"></iframe>
40
+ </div>
41
+ </div>
app/design/adminhtml/default/default/template/ibwidget/coupons.phtml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:left" class="side-col">
2
+ <h3>Invitebox Settings</h3>
3
+ <ul class="tabs" id="page_tabs">
4
+ <li>
5
+ <a class="tab-item-link" title="Connect settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings');?>">
6
+ <span>Connect settings</span>
7
+ </a>
8
+ </li>
9
+ <?php if(Mage::getModel('ibwidget/ibwidget')->get_settings() != False): ?>
10
+ <li>
11
+ <a class="tab-item-link" title="Campaign settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign');?>">
12
+ <span>Campaign settings</span>
13
+ </a>
14
+ </li>
15
+ <li>
16
+ <a class="tab-item-link" title="Statistic" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_statistic');?>">
17
+ <span>Statistic</span>
18
+ </a>
19
+ </li>
20
+ <li>
21
+ <a class="tab-item-link active" title="Generate coupons" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_coupon');?>">
22
+ <span>Coupons</span>
23
+ </a>
24
+ </li>
25
+ <?php endif; ?>
26
+ </ul>
27
+ </div>
28
+ <div id="content" class="main-col">
29
+ <div class="main-col-inner">
30
+ <div id="messages"></div>
31
+ <div class="content-header">
32
+ <h1>Coupon settings</h1>
33
+ </div>
34
+
35
+ <?php if(false): ?>
36
+ app/design/adminhtml/default/default/template/ibwidget/
37
+ <?php endif; ?>
38
+
39
+ <form method="post" action="<?=$this->getUrl('*/*/post')?>">
40
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
41
+
42
+ <fieldset>
43
+ <table cellspacing="0" class="form-list">
44
+ <tr>
45
+ <td class="label">
46
+ Select rule for coupons.
47
+ </td>
48
+ <td class="input-ele">
49
+ <select name="salesrule_id" style="width:300px">
50
+ <?php
51
+ $t = Mage::getModel('ibwidget/ibwidget')->get_salesRule();
52
+ foreach ($t['salesrules'] as &$rule){
53
+ $selected = '';
54
+ if ($rule['rule_id'] == $t['current_salesrule']){
55
+ $selected = ' selected';
56
+ }
57
+ echo '<option'. $selected. ' value='. $rule['rule_id']. '>'. $rule['name']. '</option>';
58
+ }?>
59
+ </select>
60
+ </td>
61
+ </tr>
62
+ </table>
63
+ </fieldset>
64
+ <button>Save</button>
65
+ </form>
66
+
67
+ <?php if($this->coupons!=false): ?>
68
+
69
+ <h3 style="margin-top:20px"> Coupons generated by Invitebox </h3>
70
+ <div class="grid">
71
+ <div class="hor-scroll">
72
+ <table class="data" cellspacing="0">
73
+ <thead>
74
+ <tr class="headings">
75
+ <th>Email</th>
76
+ <th>Coupon code</th>
77
+ <th>Created</th>
78
+ </tr>
79
+ </thead>
80
+ <tbody>
81
+ <?php
82
+ /* echo sprintf('<tr>%s</tr>', print_r($this->coupons, true));*/
83
+ foreach ($this->coupons as &$coupon){
84
+ echo "<tr><td>". $coupon['email']. "</td><td>". $coupon['coupon_code']. "</td><td>". $coupon['created']. "</td></tr>";
85
+ }
86
+ ?>
87
+ </tbody>
88
+ </table>
89
+ </div>
90
+ </div>
91
+ <?php endif; ?>
92
+
93
+ </div>
94
+ </div>
app/design/adminhtml/default/default/template/ibwidget/settings.phtml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:left" class="side-col">
2
+ <h3>Invitebox Settings</h3>
3
+ <ul class="tabs" id="page_tabs">
4
+ <li>
5
+ <a class="tab-item-link active" title="Connect settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings');?>">
6
+ <span>Connect settings</span>
7
+ </a>
8
+ </li>
9
+
10
+ <?php if(Mage::getModel('ibwidget/ibwidget')->get_settings() != False): ?>
11
+ <li>
12
+ <a class="tab-item-link" title="Campaign settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign');?>">
13
+ <span>Campaign settings</span>
14
+ </a>
15
+ </li>
16
+ <li>
17
+ <a class="tab-item-link" title="Statistic" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_statistic');?>">
18
+ <span>Statistic</span>
19
+ </a>
20
+ </li>
21
+ <li>
22
+ <a class="tab-item-link" title="Generate coupons" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_coupon');?>">
23
+ <span>Coupons</span>
24
+ </a>
25
+ </li>
26
+ <?php endif; ?>
27
+ </ul>
28
+ </div>
29
+ <div id="content" class="main-col">
30
+ <div class="main-col-inner">
31
+ <div id="messages"></div>
32
+ <div class="content-header">
33
+ <h1>Settings invitebox</h1>
34
+ </div>
35
+
36
+ <?php
37
+ /*
38
+ app/design/adminhtml/default/default/template/ibwidget/
39
+ */
40
+ ?>
41
+
42
+ <form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/post')?>">
43
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
44
+ <fieldset>
45
+
46
+ <?php if ($this->iframe_url):?>
47
+ <?php else: ?>
48
+ <p>
49
+ Using InviteBox plugin requires an InviteBox account. You can either create one manually at invitebox.com or let the plugin create one automatically.
50
+ <br/>
51
+ <?php echo Mage::getSingleton('admin/session')->getUser()->getEmail();?>
52
+ <br/>
53
+ <?php echo Mage::app()->getFrontController()->getRequest()->getHttpHost();?>
54
+ </p>
55
+ <p>
56
+ <button name="create_account" value="on">Create an account automatically</button>
57
+ </p>
58
+ <?php endif; ?>
59
+
60
+ <p style="margin-top:20px">
61
+ If you wish to use an existing InviteBox account, enter your campaign secret key here. The key can be found under Campaign settings -> Integration -> Show API Settings in your InviteBox account.
62
+ </p>
63
+ <p>
64
+ <input style="width:250px;" class="input-text required-entry" name="api_key" value="<?=$this->campaign_settings['api_key']?>"/>
65
+ <button name="create_account" value="">Save</button>
66
+ </p>
67
+
68
+ </fieldset>
69
+ </form>
70
+
71
+ </div>
72
+ </div>
app/design/adminhtml/default/default/template/ibwidget/statistic.phtml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:left" class="side-col">
2
+ <h3>Invitebox Settings</h3>
3
+ <ul class="tabs" id="page_tabs">
4
+ <li>
5
+ <a class="tab-item-link" title="Connect settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings');?>">
6
+ <span>Connect settings</span>
7
+ </a>
8
+ </li>
9
+ <?php if(Mage::getModel('ibwidget/ibwidget')->get_settings() != False): ?>
10
+ <li>
11
+ <a class="tab-item-link" title="Campaign settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign');?>">
12
+ <span>Campaign settings</span>
13
+ </a>
14
+ </li>
15
+ <li>
16
+ <a class="tab-item-link active" title="Statistic" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_statistic');?>">
17
+ <span>Statistic</span>
18
+ </a>
19
+ </li>
20
+ <li>
21
+ <a class="tab-item-link" title="Generate coupons" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_coupon');?>">
22
+ <span>Coupons</span>
23
+ </a>
24
+ </li>
25
+ <?php endif; ?>
26
+ </ul>
27
+ </div>
28
+ <div id="content" class="main-col">
29
+ <div class="main-col-inner">
30
+ <div id="messages"></div>
31
+ <div class="content-header">
32
+ <h1>Campaign statistic</h1>
33
+ </div>
34
+
35
+ <?php if(false): ?>
36
+ app/design/adminhtml/default/default/template/ibwidget/
37
+ <?php endif; ?>
38
+
39
+ <iframe style="height:auto;width:100%;border:none;min-height:1500px" src="<?php echo $this->iframe_url; ?>"></iframe>
40
+ </div>
41
+ </div>
app/design/adminhtml/default/default/template/ibwidget/statistic.phtml~ ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="page:left" class="side-col">
2
+ <h3>Invitebox Settings</h3>
3
+ <ul class="tabs" id="page_tabs">
4
+ <li>
5
+ <a class="tab-item-link" title="Connect settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_ibsettings');?>">
6
+ <span>Connect settings</span>
7
+ </a>
8
+ </li>
9
+ <?php if(Mage::getModel('ibwidget/ibwidget')->get_settings() != False): ?>
10
+ <li>
11
+ <a class="tab-item-link" title="Campaign settings" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_campaign');?>">
12
+ <span>Campaign settings</span>
13
+ </a>
14
+ </li>
15
+
16
+ <li>
17
+ <a class="tab-item-link active" title="Statistic" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_statistic');?>">
18
+ <span>Statistic</span>
19
+ </a>
20
+ </li>
21
+
22
+ <li>
23
+ <a class="tab-item-link" title="Generate coupons" href="<?php echo Mage::helper("adminhtml")->getUrl('ibwidget/adminhtml_coupon');?>">
24
+ <span>Coupons</span>
25
+ </a>
26
+ </li>
27
+ <?php endif; ?>
28
+ </ul>
29
+ </div>
30
+ <div id="content" class="main-col">
31
+ <div class="main-col-inner">
32
+ <div id="messages"></div>
33
+ <div class="content-header">
34
+ <h1>Campaign statistic</h1>
35
+ </div>
36
+
37
+ <?php if(false): ?>
38
+ app/design/adminhtml/default/default/template/ibwidget/
39
+ <?php endif; ?>
40
+
41
+ <iframe style="height:auto;width:100%;border:none;min-height:1500px" src="<?php echo $this->iframe_url; ?>"></iframe>
42
+ </div>
43
+ </div>
app/design/frontend/default/default/layout/ibwidget.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- path : app/design/frontend/default/default/layout/-->
3
+ <layout>
4
+ <getcoupon>
5
+ <reference name="content">
6
+ <block type="ibwidget/index" name="ibwidget"/>
7
+ </reference>
8
+ </getcoupon>
9
+ </layout>
app/etc/modules/Invitebox_Ibwidget.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Invitebox_Ibwidget>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Invitebox_Ibwidget>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>invitebox_plugin</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Let your customers bring you more business with InviteBox referral rewards extension.</summary>
10
+ <description>&lt;h2&gt;Let your customers bring you more business&lt;/h2&gt;
11
+
12
+ &lt;p&gt;This magento extensiton incentivizes your existing customers to bring you more sales. Offer your happy shoppers a reward (discount, free shipping or any other incentive) for referring their peers to you and they'll become your most zealous promoters.&lt;/p&gt;
13
+
14
+ &lt;h2&gt;So how this extension works?&lt;/h2&gt;
15
+
16
+ &lt;p&gt;First of all you need to set rewards and rules of your referral program. For example offer 5% discount coupon to customers each time X of their friends make a purchase at your store.&lt;/p&gt;
17
+
18
+ &lt;h2&gt;And how it will look like?&lt;/h2&gt;
19
+
20
+ &lt;p&gt;By default this extension installs a special badge to your store. It will be displayed on all pages and look like this (note: text and colors can be changed):&lt;/p&gt;
21
+
22
+ &lt;p&gt;&lt;img src="http://static2.invitebox.com/static/77/magento/Badge%20example.png" /&gt;&lt;/p&gt;
23
+
24
+ &lt;p&gt;By clicking on it your customers will see pop-up windows similar to theese ones (here you need to describe your offer):&lt;/p&gt;
25
+
26
+ &lt;p&gt;&lt;img src="http://static2.invitebox.com/static/77/magento/Widget%20Example.png" alt="widget example 1" /&gt;&lt;/p&gt;
27
+
28
+ &lt;p&gt;&lt;img src="http://static2.invitebox.com/static/77/magento/Widget%20Example1.png" alt="widget example 2" /&gt;&lt;/p&gt;
29
+
30
+
31
+ &lt;p&gt;After entering an email people could easily share your promo message with their friends via the most popular social networks. Or just use their unique short urls (shortened links to your website) to spread the word about your store in any other way they like(via email, blog posts etc.).&lt;/p&gt;
32
+
33
+ &lt;p&gt;When their referral goal is completed and friends become your customers they will get their reward coupons by email.&lt;/p&gt;
34
+
35
+ &lt;h2&gt;Want more?&lt;/h2&gt;
36
+
37
+ &lt;p&gt;Additionally you can offer an incentive to referrals and increase conversion rates significally.&lt;/p&gt;
38
+
39
+ &lt;img src="http://static2.invitebox.com/static/77/magento/example%20from%20twitter.png" /&gt;
40
+
41
+ &lt;p&gt;By clicking this url people will see a screen where they can grab a coupon code and proceed to your shop.&lt;/p&gt;
42
+
43
+ &lt;p&gt;&lt;img src="https://d11sy8dnephw8a.cloudfront.net/static/77/cms_page_media/24/Goal-based%20rewards05.png" alt="Referral reward" /&gt;&lt;/p&gt;
44
+
45
+
46
+ &lt;h2&gt;Want to get even more?&lt;/h2&gt;
47
+
48
+ &lt;p&gt;InviteBox powerful analytics will help you not only to track the results in real time, but to discover bottlenecks in your refer a friend program instantly and to get the most of word of mouth.&lt;/p&gt;
49
+
50
+ &lt;p&gt;&lt;img src="https://d11sy8dnephw8a.cloudfront.net/static/77/img/shots/actionable%20analytics.png" /&gt;&lt;/p&gt;
51
+
52
+ &lt;p&gt;You could also download or export your participant data for further marketing purposes.&lt;/p&gt;
53
+
54
+
55
+ &lt;p&gt;&lt;img src="https://d11sy8dnephw8a.cloudfront.net/static/77/img/shots/participants.png" /&gt;&lt;/p&gt;
56
+
57
+ &lt;h2&gt;Is this extension free?&lt;/h2&gt;
58
+
59
+
60
+ &lt;p&gt;Extension is free to download and you could use it without any commitment for 14 days. After your trial ends up you'll need to subscribe to one of the plans which start from 19$ per month (&lt;a href="http://invitebox.com/account/pricing/"&gt;Check available plans&lt;/a&gt;).&lt;/p&gt;
61
+
62
+
63
+ &lt;p&gt;&lt;b&gt;Get more info about &lt;a href="http://invitebox.com"&gt;referral programs&lt;/a&gt;.&lt;/b&gt;&lt;/p&gt;
64
+
65
+ &lt;p&gt;&lt;b&gt;Support:&lt;/b&gt; &lt;a href="support@invitebox.com" title="InviteBox Support"&gt;support@invitebox.com &lt;/a&gt; &lt;/p&gt;
66
+
67
+
68
+ &lt;p&gt;&#xA9;2012 Catappult BV. All rights reserved.&lt;/p&gt;</description>
69
+ <notes>first stable version</notes>
70
+ <authors><author><name>invitebox</name><user>auto-converted</user><email>support@invitebox.com</email></author></authors>
71
+ <date>2012-10-26</date>
72
+ <time>15:38:11</time>
73
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ibwidget.xml" hash="7018987e7c80b51908b306134678e03a"/></dir><dir name="template"><dir name="ibwidget"><file name="campaigns.phtml" hash="c74892bc2a80e1683b55e39d94dfee01"/><file name="coupons.phtml" hash="38a93acfb850eb4c7385381cab0ffdad"/><file name="settings.phtml" hash="6777bf92ca020b3753e1b7d1b18452ca"/><file name="statistic.phtml" hash="72ac20e03c417772e05343b24c743399"/><file name="statistic.phtml~" hash="bd1bea43a2a234ae8a411f6c1387dc54"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ibwidget.xml" hash="4b9ae4e105ad567e1c0e8f42419efed3"/></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Invitebox"><dir name="Ibwidget"><dir name="Block"><dir name="Adminhtml"><file name="Campaign.php" hash="6e6fda749f9e6ede0e936d044c6ce6d6"/><file name="Campaign.php~" hash="950e8184a78fd53487ba03850ac6f829"/><file name="Coupon.php" hash="988328df6642cc88356c0f41aa2a4868"/><file name="Coupon.php~" hash="70742af1ab18287fee91ef5d258c00d8"/><file name="Ibsettings.php" hash="1650fa8f77fae15f222e7f6fe4594eec"/><file name="Statistic.php" hash="234f0e5d31c3f16e8215e58a9f4816a4"/></dir><file name="Ibsettings.php" hash="480a97c90e8046380e8d39d56e3d5d60"/><file name="Ibtracking.php" hash="ec56c8e7172c0a8411ed587fbc2f5a4a"/><file name="Ibtracking.php~" hash="2e62b7f5b99e174e4cc55bb9dacb59a1"/><file name="Ibwidget.php" hash="d314985ad3be24e59efd5f353efc0383"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CampaignController.php" hash="2783c14ed0ab8af8c121219e7389a16c"/><file name="CampaignController.php~" hash="390b46fa5cb2a0c971c25ec96774fd9d"/><file name="CouponController.php" hash="16809f1f7f4b5166a57b6da32ed53d79"/><file name="CouponController.php~" hash="d434aac787ee48fadb967cd96181db81"/><file name="IbsettingsController.php" hash="97f9170afe5284a09f546b729b01c044"/><file name="StatisticController.php" hash="42075d9065f6dc4f7affdc19294fee93"/></dir><file name="IndexController.php" hash="e41c4335ad69fc911425f46ce7edc824"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4e77cc4738af7500f6244cd152b2386b"/><file name="config.xml" hash="4de5d85ae69816944b5dfd05a9d82ce9"/><file name="system.xml_" hash="cf3c7a6347a0809fa7649c296996bf8e"/><file name="widget.xml" hash="267593a6fddb0024dd3dafadda942ab6"/></dir><dir name="Helper"><file name="Data.php" hash="f819196799921e9e08c41dc4e6b93244"/><file name="Ibsettings.php" hash="8d30548d25b7ca033618d26231dd9f21"/></dir><dir name="Model"><file name="Ibwidget.php" hash="dc582887d3a65b01cc827003fe2191d7"/></dir><dir name="sql"><dir name="ibwidget_setup"><file name="mysql4-install-0.1.0.php" hash="873b8d524b874254ad0ee870ec9b3d0e"/></dir></dir><file name="index.php" hash="316e0cd88a8a6d7190d54f9b84c775f1"/><file name="test.php" hash="ea6d7831e3b533041047342595defe37"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Invitebox_Ibwidget.xml" hash="e4b7fa445d31515d19f95b3e02364f78"/></dir></target></contents>
74
+ <compatible/>
75
+ <dependencies/>
76
+ </package>