Version Notes
Update to 1.0.5 to get extension working on MagentoCommerce
Download this release
Release Info
Developer | Magento Core Team |
Extension | IncentiBox_Communityrewards |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- app/code/community/IncentiBox/Communityrewards/Block/Communityrewards.php +15 -0
- app/code/community/IncentiBox/Communityrewards/Block/Communityrewards/Grid.php +59 -0
- app/code/community/IncentiBox/Communityrewards/Helper/Data.php +6 -0
- app/code/community/IncentiBox/Communityrewards/Model/Listener.php +8 -0
- app/code/community/IncentiBox/Communityrewards/Model/Mysql4/Listener.php +8 -0
- app/code/community/IncentiBox/Communityrewards/Model/Mysql4/Listener/Collection.php +16 -0
- app/code/community/IncentiBox/Communityrewards/controllers/CommunityrewardsController.php +35 -0
- app/code/community/IncentiBox/Communityrewards/controllers/ListenerController.php +192 -0
- app/code/community/IncentiBox/Communityrewards/etc/adminhtml.xml +35 -0
- app/code/community/IncentiBox/Communityrewards/etc/config.xml +130 -0
- app/code/community/IncentiBox/Communityrewards/etc/system.xml +73 -0
- app/code/community/IncentiBox/Communityrewards/sql/communityrewards_setup/mysql4-install-1.0.1.php +23 -0
- app/etc/modules/IncentiBox_Communityrewards.xml +2 -2
- lib/{Incentibox → IncentiBox}/incentibox_api.php +0 -0
- package.xml +4 -4
app/code/community/IncentiBox/Communityrewards/Block/Communityrewards.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class IncentiBox_Communityrewards_Block_Communityrewards extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
$this->_controller = 'communityrewards';
|
9 |
+
$this->_blockGroup = 'communityrewards';
|
10 |
+
//$this->_controller = 'cmsgallery_cmsgallery';
|
11 |
+
$this->_headerText = Mage::helper('communityrewards')->__('incentiBox Coupons');
|
12 |
+
parent::__construct();
|
13 |
+
$this->_removeButton('add');
|
14 |
+
}
|
15 |
+
}
|
app/code/community/IncentiBox/Communityrewards/Block/Communityrewards/Grid.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class IncentiBox_Communityrewards_Block_Communityrewards_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('communityrewardsGrid');
|
10 |
+
$this->setDefaultSort('unique_id');
|
11 |
+
$this->setDefaultDir('ASC');
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('communityrewards/listener')->getCollection();
|
17 |
+
/* @var $collection Mage_Cms_Model_Mysql4_Block_Collection */
|
18 |
+
$this->setCollection($collection);
|
19 |
+
return parent::_prepareCollection();
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function _prepareColumns()
|
23 |
+
{
|
24 |
+
$baseUrl = $this->getUrl();
|
25 |
+
|
26 |
+
$this->addColumn('unique_id', array(
|
27 |
+
'header' => Mage::helper('communityrewards')->__('ID'),
|
28 |
+
'align' => 'left',
|
29 |
+
'index' => 'unique_id'
|
30 |
+
));
|
31 |
+
$this->addColumn('incentibox_coupon_id', array(
|
32 |
+
'header' => Mage::helper('communityrewards')->__('Incentibox Coupon Id'),
|
33 |
+
'align' => 'left',
|
34 |
+
'index' => 'incentibox_coupon_id'
|
35 |
+
));
|
36 |
+
$this->addColumn('coupon_code', array(
|
37 |
+
'header' => Mage::helper('communityrewards')->__('Coupon Code'),
|
38 |
+
'align' => 'left',
|
39 |
+
'index' => 'coupon_code'
|
40 |
+
));
|
41 |
+
$this->addColumn('emailed_to', array(
|
42 |
+
'header' => Mage::helper('communityrewards')->__('Emailed To'),
|
43 |
+
'align' => 'left',
|
44 |
+
'index' => 'emailed_to'
|
45 |
+
));
|
46 |
+
|
47 |
+
return parent::_prepareColumns();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Row click url
|
52 |
+
*
|
53 |
+
* @return string
|
54 |
+
*/
|
55 |
+
public function getRowUrl($row)
|
56 |
+
{
|
57 |
+
return "#";
|
58 |
+
}
|
59 |
+
}
|
app/code/community/IncentiBox/Communityrewards/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class IncentiBox_Communityrewards_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/IncentiBox/Communityrewards/Model/Listener.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class IncentiBox_Communityrewards_Model_Listener extends Mage_Core_Model_Abstract
|
3 |
+
{
|
4 |
+
function _construct(){
|
5 |
+
$this->_init('communityrewards/listener');
|
6 |
+
}
|
7 |
+
}
|
8 |
+
?>
|
app/code/community/IncentiBox/Communityrewards/Model/Mysql4/Listener.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class IncentiBox_Communityrewards_Model_Mysql4_Listener extends Mage_Core_Model_Mysql4_Abstract
|
3 |
+
{
|
4 |
+
function _construct(){
|
5 |
+
$this->_init('communityrewards/listener','unique_id');
|
6 |
+
}
|
7 |
+
}
|
8 |
+
?>
|
app/code/community/IncentiBox/Communityrewards/Model/Mysql4/Listener/Collection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class IncentiBox_Communityrewards_Model_Mysql4_Listener_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Declare base table and mapping of some fields
|
7 |
+
*/
|
8 |
+
protected function _construct(){
|
9 |
+
$this->_init('communityrewards/listener');
|
10 |
+
//$this->_map['fields']['store'] = 'store_table.store_id';
|
11 |
+
}
|
12 |
+
|
13 |
+
public function toOptionArray(){
|
14 |
+
return $this->_toOptionArray('unique_id', 'unique_id');
|
15 |
+
}
|
16 |
+
}
|
app/code/community/IncentiBox/Communityrewards/controllers/CommunityrewardsController.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class IncentiBox_Communityrewards_CommunityrewardsController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction()
|
7 |
+
{
|
8 |
+
// load layout, set active menu and breadcrumbs
|
9 |
+
$this->loadLayout()
|
10 |
+
->_setActiveMenu('promo/communityrewards')
|
11 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Promo'), Mage::helper('adminhtml')->__('Promo'))
|
12 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Incentobox Coupons'), Mage::helper('adminhtml')->__('incentiBox Coupons'))
|
13 |
+
;
|
14 |
+
return $this;
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function isIncentoboxCouponActive(){
|
18 |
+
return Mage::getStoreConfig("communityrewards/communityrewards_settings/active");
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Index action
|
23 |
+
*/
|
24 |
+
public function indexAction()
|
25 |
+
{
|
26 |
+
if(!$this->isIncentoboxCouponActive()){
|
27 |
+
Mage::getSingleton('core/session')->addError($this->__("EXTENSION DISABLED - Please enable the extension by going to the <a href='%s'>System > incentiBox Coupons</a> configuration page.", $this->getUrl('adminhtml/system_config/edit', array('section'=>'communityrewards'))));
|
28 |
+
}
|
29 |
+
|
30 |
+
$this->_title($this->__('Promo'))->_title($this->__('incentiBox Coupons'));
|
31 |
+
|
32 |
+
$this->_initAction();
|
33 |
+
$this->renderLayout();
|
34 |
+
}
|
35 |
+
}
|
app/code/community/IncentiBox/Communityrewards/controllers/ListenerController.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once(Mage::getBaseDir('lib').'/Incentibox/incentibox_api.php');
|
3 |
+
class IncentiBox_Communityrewards_ListenerController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
protected function isIncentoboxCouponActive(){
|
6 |
+
return Mage::getStoreConfig("communityrewards/communityrewards_settings/active");
|
7 |
+
}
|
8 |
+
|
9 |
+
public function indexAction()
|
10 |
+
{
|
11 |
+
if(!$this->isIncentoboxCouponActive()){
|
12 |
+
header("HTTP/1.0 500 Internal Server Error");
|
13 |
+
header("incentiBoxSuccess: FALSE");
|
14 |
+
exit();
|
15 |
+
}
|
16 |
+
|
17 |
+
try
|
18 |
+
{
|
19 |
+
$VERBOSE = true;
|
20 |
+
$params=$this->getRequest()->getParams();
|
21 |
+
if (empty($params['ib_run']))
|
22 |
+
{
|
23 |
+
header("HTTP/1.0 500 Internal Server Error");
|
24 |
+
header("incentiBoxSuccess: FALSE");
|
25 |
+
exit();
|
26 |
+
}
|
27 |
+
|
28 |
+
// get last coupon id
|
29 |
+
$last_coupon_id = $this->getIncentiboxLastCouponId();
|
30 |
+
|
31 |
+
$INCENTIBOX_API_USER= Mage::getStoreConfig('communityrewards/communityrewards_settings/incentibox_api_user');
|
32 |
+
$INCENTIBOX_API_PASSWORD= Mage::getStoreConfig('communityrewards/communityrewards_settings/incentibox_api_password');
|
33 |
+
$INCENTIBOX_PROGRAM_ID = Mage::getStoreConfig('communityrewards/communityrewards_settings/program_id');
|
34 |
+
$expiration_days = Mage::getStoreConfig('communityrewards/communityrewards_settings/coupon_expires');
|
35 |
+
|
36 |
+
if(!$expiration_days){
|
37 |
+
$expiration_days = 7;
|
38 |
+
}
|
39 |
+
|
40 |
+
if(!$INCENTIBOX_API_USER){
|
41 |
+
header("HTTP/1.0 500 Internal Server Error");
|
42 |
+
header("incentiBoxSuccess: FALSE");
|
43 |
+
exit();
|
44 |
+
}
|
45 |
+
if(!$INCENTIBOX_API_PASSWORD){
|
46 |
+
header("HTTP/1.0 500 Internal Server Error");
|
47 |
+
header("incentiBoxSuccess: FALSE");
|
48 |
+
exit();
|
49 |
+
}
|
50 |
+
if(!$INCENTIBOX_PROGRAM_ID){
|
51 |
+
header("HTTP/1.0 500 Internal Server Error");
|
52 |
+
header("incentiBoxSuccess: FALSE");
|
53 |
+
exit();
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
$incentibox_client = new IncentiboxApi($INCENTIBOX_API_USER,$INCENTIBOX_API_PASSWORD);
|
58 |
+
// returns all the redeemed_rewards for this program
|
59 |
+
$new_rewards_array = $incentibox_client->get_redeemed_rewards($INCENTIBOX_PROGRAM_ID, $last_coupon_id);
|
60 |
+
|
61 |
+
// insert coupon in incentibox_coupon table and also in magento
|
62 |
+
foreach ($new_rewards_array as $new_reward)
|
63 |
+
{
|
64 |
+
$listener = Mage::getModel('communityrewards/listener');
|
65 |
+
$listener->setIncentiboxCouponId($new_reward['id']);
|
66 |
+
$listener->setCouponCode($new_reward['code']);
|
67 |
+
$listener->setCouponAmount($new_reward['amount']);
|
68 |
+
$listener->setOrderMinimum($new_reward['order_minimum']);
|
69 |
+
$listener->setDateRedeemed($new_reward['redeemed_at']);
|
70 |
+
$listener->setEmailedTo($new_reward['email']);
|
71 |
+
$listener->setDateCreated(now());
|
72 |
+
$listener->save();
|
73 |
+
|
74 |
+
|
75 |
+
// now insert coupon in magento
|
76 |
+
$model = Mage::getModel('salesrule/rule');
|
77 |
+
$session = Mage::getSingleton('adminhtml/session');
|
78 |
+
$toDate = date("F d, Y H:i:s", Mage::getModel('core/date')->timestamp(time()));
|
79 |
+
$copunValidateDays = $expiration_days;
|
80 |
+
$nextday=strftime("%Y-%m-%d", strtotime("$todate +$copunValidateDays day"));
|
81 |
+
|
82 |
+
$data = array();
|
83 |
+
$data['name'] = "incentiBox Coupon ". $listener->getIncentiboxCouponId();
|
84 |
+
$data['coupon_type'] = '2';
|
85 |
+
$data['coupon_code'] = $listener->getCouponCode();
|
86 |
+
$data['is_active']= '1';
|
87 |
+
$data['uses_per_coupon'] = '1';
|
88 |
+
$data['uses_per_customer'] = '1';
|
89 |
+
$data['to_date']= $nextday;
|
90 |
+
$data['simple_action']='by_fixed';
|
91 |
+
$data['discount_amount']=$listener->getCouponAmount();
|
92 |
+
|
93 |
+
// get all websites
|
94 |
+
$websites = Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray();
|
95 |
+
$website_ids = array();
|
96 |
+
if(count($websites)>0){
|
97 |
+
foreach($websites as $website){
|
98 |
+
$website_ids[] = $website['value'];
|
99 |
+
}
|
100 |
+
}
|
101 |
+
$data['website_ids'] = $website_ids;
|
102 |
+
|
103 |
+
// prepare customer group ids
|
104 |
+
$customer_group_ids = array();
|
105 |
+
$groups = Mage::getResourceModel('customer/group_collection')
|
106 |
+
// ->addFieldToFilter('customer_group_id', array('gt'=> 0))
|
107 |
+
->load()
|
108 |
+
->toOptionArray();
|
109 |
+
|
110 |
+
if(count($groups)>0){
|
111 |
+
foreach($groups as $group){
|
112 |
+
$customer_group_ids[] = $group['value'];
|
113 |
+
}
|
114 |
+
}
|
115 |
+
$data['customer_group_ids'] = $customer_group_ids;
|
116 |
+
|
117 |
+
// prepare rule
|
118 |
+
$rule=array(
|
119 |
+
"conditions"=>array(
|
120 |
+
"1"=>array(
|
121 |
+
"type" => "salesrule/rule_condition_combine",
|
122 |
+
"aggregator" => "all",
|
123 |
+
"value" => "1",
|
124 |
+
"new_child" => "",
|
125 |
+
),
|
126 |
+
"1--1"=>array(
|
127 |
+
"type" => "salesrule/rule_condition_address",
|
128 |
+
"attribute" => "base_subtotal",
|
129 |
+
"operator" => ">=",
|
130 |
+
"value" => $listener->getOrderMinimum(),
|
131 |
+
)
|
132 |
+
),
|
133 |
+
"actions" =>array(
|
134 |
+
"1" => Array(
|
135 |
+
"type" => "salesrule/rule_condition_product_combine",
|
136 |
+
"aggregator" => "all",
|
137 |
+
"value" => "1",
|
138 |
+
"new_child" =>""
|
139 |
+
)
|
140 |
+
)
|
141 |
+
);
|
142 |
+
$data['rule']=$rule;
|
143 |
+
if (isset($data['rule']['conditions'])) {
|
144 |
+
$data['conditions'] = $data['rule']['conditions'];
|
145 |
+
}
|
146 |
+
if (isset($data['rule']['actions'])) {
|
147 |
+
$data['actions'] = $data['rule']['actions'];
|
148 |
+
}
|
149 |
+
|
150 |
+
unset($data['rule']);
|
151 |
+
|
152 |
+
|
153 |
+
|
154 |
+
$model1=$model->loadPost($data);
|
155 |
+
$session->setPageData($model->getData());
|
156 |
+
$model->save();
|
157 |
+
}
|
158 |
+
header("HTTP/1.0 200 OK");
|
159 |
+
header("incentiBoxSuccess: TRUE");
|
160 |
+
exit;
|
161 |
+
}
|
162 |
+
catch (Mage_Core_Exception $e)
|
163 |
+
{
|
164 |
+
|
165 |
+
// echo $e->getMessage();
|
166 |
+
return;
|
167 |
+
}
|
168 |
+
catch (Exception $e)
|
169 |
+
{
|
170 |
+
// echo $e->getMessage();
|
171 |
+
return;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
public function getIncentiboxLastCouponId(){
|
176 |
+
// get table name
|
177 |
+
$coreResource = Mage::getSingleton('core/resource');
|
178 |
+
$tableName = $coreResource->getTableName('incentibox_coupons');
|
179 |
+
|
180 |
+
//prepare query and run
|
181 |
+
// fetch write database connection that is used in Mage_Core module
|
182 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
183 |
+
$query = "select incentibox_coupon_id from ".$tableName." order by incentibox_coupon_id DESC LIMIT 1";
|
184 |
+
$data = $coreResource->getConnection('core_read')->fetchAll($query);
|
185 |
+
if(isset($data[0]['incentibox_coupon_id']) && !empty($data[0]['incentibox_coupon_id'])){
|
186 |
+
return $data[0]['incentibox_coupon_id'];
|
187 |
+
}
|
188 |
+
return false;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
?>
|
app/code/community/IncentiBox/Communityrewards/etc/adminhtml.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<acl>
|
5 |
+
<resources>
|
6 |
+
<admin>
|
7 |
+
<children>
|
8 |
+
<system>
|
9 |
+
<children>
|
10 |
+
<config>
|
11 |
+
<children>
|
12 |
+
<communityrewards translate="title" module="communityrewards">
|
13 |
+
<title>incentiBox</title>
|
14 |
+
<sort_order>10</sort_order>
|
15 |
+
</communityrewards>
|
16 |
+
</children>
|
17 |
+
</config>
|
18 |
+
</children>
|
19 |
+
</system>
|
20 |
+
</children>
|
21 |
+
</admin>
|
22 |
+
</resources>
|
23 |
+
</acl>
|
24 |
+
<menu>
|
25 |
+
<promo>
|
26 |
+
<children>
|
27 |
+
<communityrewards translate="title" module="communityrewards">
|
28 |
+
<title>incentiBox Coupons</title>
|
29 |
+
<action>adminhtml/communityrewards</action>
|
30 |
+
<!--<depends><module>DevelopersIndia_IncentiBox</module></depends>-->
|
31 |
+
</communityrewards>
|
32 |
+
</children>
|
33 |
+
</promo>
|
34 |
+
</menu>
|
35 |
+
</config>
|
app/code/community/IncentiBox/Communityrewards/etc/config.xml
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<IncentiBox_Communityrewards>
|
5 |
+
<version>1.0.5</version>
|
6 |
+
</IncentiBox_Communityrewards>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<adminhtml>
|
10 |
+
<acl>
|
11 |
+
<resources>
|
12 |
+
<admin>
|
13 |
+
<children>
|
14 |
+
<system>
|
15 |
+
<children>
|
16 |
+
<config>
|
17 |
+
<children>
|
18 |
+
<communityrewards translate="title" module="communityrewards">
|
19 |
+
<title>incentiBox</title>
|
20 |
+
</communityrewards>
|
21 |
+
</children>
|
22 |
+
</config>
|
23 |
+
</children>
|
24 |
+
</system>
|
25 |
+
</children>
|
26 |
+
</admin>
|
27 |
+
</resources>
|
28 |
+
</acl>
|
29 |
+
<layout>
|
30 |
+
<updates>
|
31 |
+
<communityrewards>
|
32 |
+
<file>communityrewards.xml</file>
|
33 |
+
</communityrewards>
|
34 |
+
</updates>
|
35 |
+
</layout>
|
36 |
+
<translate>
|
37 |
+
<modules>
|
38 |
+
<IncentiBox_Communityrewards>
|
39 |
+
<files>
|
40 |
+
<default>IncentiBox_Communityrewards.csv</default>
|
41 |
+
</files>
|
42 |
+
</IncentiBox_Communityrewards>
|
43 |
+
</modules>
|
44 |
+
</translate>
|
45 |
+
</adminhtml>
|
46 |
+
<admin>
|
47 |
+
<routers>
|
48 |
+
<adminhtml>
|
49 |
+
<args>
|
50 |
+
<modules>
|
51 |
+
<IncentiBox_Communityrewards before="Mage_Adminhtml">IncentiBox_Communityrewards</IncentiBox_Communityrewards>
|
52 |
+
</modules>
|
53 |
+
</args>
|
54 |
+
</adminhtml>
|
55 |
+
</routers>
|
56 |
+
</admin>
|
57 |
+
<global>
|
58 |
+
<blocks>
|
59 |
+
<communityrewards>
|
60 |
+
<class>IncentiBox_Communityrewards_Block</class>
|
61 |
+
</communityrewards>
|
62 |
+
</blocks>
|
63 |
+
<models>
|
64 |
+
<communityrewards>
|
65 |
+
<class>IncentiBox_Communityrewards_Model</class>
|
66 |
+
<resourceModel>communityrewards_mysql4</resourceModel>
|
67 |
+
</communityrewards>
|
68 |
+
<communityrewards_mysql4>
|
69 |
+
<class>IncentiBox_Communityrewards_Model_Mysql4</class>
|
70 |
+
<entities>
|
71 |
+
<listener>
|
72 |
+
<table>incentibox_coupons</table>
|
73 |
+
</listener>
|
74 |
+
</entities>
|
75 |
+
</communityrewards_mysql4>
|
76 |
+
</models>
|
77 |
+
<helpers>
|
78 |
+
<communityrewards>
|
79 |
+
<class>IncentiBox_Communityrewards_Helper</class>
|
80 |
+
</communityrewards>
|
81 |
+
</helpers>
|
82 |
+
<resources>
|
83 |
+
<communityrewards_setup>
|
84 |
+
<setup>
|
85 |
+
<module>IncentiBox_Communityrewards</module>
|
86 |
+
</setup>
|
87 |
+
<connection>
|
88 |
+
<use>core_setup</use>
|
89 |
+
</connection>
|
90 |
+
</communityrewards_setup>
|
91 |
+
<communityrewards_write>
|
92 |
+
<connection>
|
93 |
+
<use>core_write</use>
|
94 |
+
</connection>
|
95 |
+
</communityrewards_write>
|
96 |
+
<communityrewards_read>
|
97 |
+
<connection>
|
98 |
+
<use>core_read</use>
|
99 |
+
</connection>
|
100 |
+
</communityrewards_read>
|
101 |
+
</resources>
|
102 |
+
</global>
|
103 |
+
<frontend>
|
104 |
+
<translate>
|
105 |
+
<modules>
|
106 |
+
<IncentiBox_Communityrewards>
|
107 |
+
<files>
|
108 |
+
<default>IncentiBox_Communityrewards.csv</default>
|
109 |
+
</files>
|
110 |
+
</IncentiBox_Communityrewards>
|
111 |
+
</modules>
|
112 |
+
</translate>
|
113 |
+
<routers>
|
114 |
+
<communityrewards>
|
115 |
+
<use>standard</use>
|
116 |
+
<args>
|
117 |
+
<module>IncentiBox_Communityrewards</module>
|
118 |
+
<frontName>incentibox</frontName>
|
119 |
+
</args>
|
120 |
+
</communityrewards>
|
121 |
+
</routers>
|
122 |
+
<layout>
|
123 |
+
<updates>
|
124 |
+
<communityrewards>
|
125 |
+
<file>communityrewards.xml</file>
|
126 |
+
</communityrewards>
|
127 |
+
</updates>
|
128 |
+
</layout>
|
129 |
+
</frontend>
|
130 |
+
</config>
|
app/code/community/IncentiBox/Communityrewards/etc/system.xml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<incentiboxtab translate="label" module="communityrewards">
|
5 |
+
<label>incentiBox</label>
|
6 |
+
<sort_order>200</sort_order>
|
7 |
+
</incentiboxtab>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<communityrewards translate="label" module="communityrewards">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>incentiBox Coupons</label>
|
13 |
+
<tab>incentiboxtab</tab>
|
14 |
+
<sort_order>130</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<communityrewards_settings translate="label">
|
20 |
+
<label>incentiBox communityrewards settings</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<active translate="label">
|
28 |
+
<label>Enabled</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</active>
|
36 |
+
<incentibox_api_user translate="label">
|
37 |
+
<label>incentiBox API User</label>
|
38 |
+
<frontend_type>text</frontend_type>
|
39 |
+
<sort_order>10</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</incentibox_api_user>
|
44 |
+
<incentibox_api_password translate="label">
|
45 |
+
<label>incentiBox API Password</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<sort_order>20</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</incentibox_api_password>
|
52 |
+
<program_id translate="label">
|
53 |
+
<label>Program ID</label>
|
54 |
+
<frontend_type>text</frontend_type>
|
55 |
+
<sort_order>30</sort_order>
|
56 |
+
<show_in_default>1</show_in_default>
|
57 |
+
<show_in_website>1</show_in_website>
|
58 |
+
<show_in_store>1</show_in_store>
|
59 |
+
</program_id>
|
60 |
+
<coupon_expires translate="label">
|
61 |
+
<label>Coupon expires in (days)</label>
|
62 |
+
<frontend_type>text</frontend_type>
|
63 |
+
<sort_order>40</sort_order>
|
64 |
+
<show_in_default>1</show_in_default>
|
65 |
+
<show_in_website>1</show_in_website>
|
66 |
+
<show_in_store>1</show_in_store>
|
67 |
+
</coupon_expires>
|
68 |
+
</fields>
|
69 |
+
</communityrewards_settings>
|
70 |
+
</groups>
|
71 |
+
</communityrewards>
|
72 |
+
</sections>
|
73 |
+
</config>
|
app/code/community/IncentiBox/Communityrewards/sql/communityrewards_setup/mysql4-install-1.0.1.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* @var $installer Mage_Customer_Model_Entity_Setup */
|
4 |
+
$installer = $this;
|
5 |
+
|
6 |
+
$installer->startSetup();
|
7 |
+
$installer->run("
|
8 |
+
CREATE TABLE {$this->getTable('incentibox_coupons')}(
|
9 |
+
unique_id int(11) NOT NULL auto_increment,
|
10 |
+
incentibox_coupon_id int(11) NOT NULL DEFAULT 0,
|
11 |
+
coupon_code varchar(32) NOT NULL DEFAULT '',
|
12 |
+
coupon_amount decimal(8,4) NOT NULL DEFAULT '0.0000',
|
13 |
+
order_minimum decimal(8,4) NOT NULL DEFAULT '0.0000',
|
14 |
+
date_redeemed datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
15 |
+
emailed_to varchar(128) DEFAULT NULL,
|
16 |
+
date_created datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
17 |
+
PRIMARY KEY (unique_id),
|
18 |
+
UNIQUE KEY (incentibox_coupon_id),
|
19 |
+
UNIQUE KEY (coupon_code)
|
20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
21 |
+
");
|
22 |
+
$installer->endSetup();
|
23 |
+
?>
|
app/etc/modules/IncentiBox_Communityrewards.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<modules>
|
5 |
<IncentiBox_Communityrewards>
|
6 |
<active>true</active>
|
7 |
-
<codePool>
|
8 |
</IncentiBox_Communityrewards>
|
9 |
</modules>
|
10 |
-
</config>
|
4 |
<modules>
|
5 |
<IncentiBox_Communityrewards>
|
6 |
<active>true</active>
|
7 |
+
<codePool>community</codePool>
|
8 |
</IncentiBox_Communityrewards>
|
9 |
</modules>
|
10 |
+
</config>
|
lib/{Incentibox → IncentiBox}/incentibox_api.php
RENAMED
File without changes
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>IncentiBox_Communityrewards</name>
|
4 |
-
<version>1.0.
|
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 @@ Coupon codes are auto-generated, and will show up in the admin panel, so you can
|
|
16 |


Example: Give participants a $5 off coupon when they share about your products with their social networks. You gain valuable word-of-mouth advertising for your Magento store, AND generate additional sales when participants and their friends redeem their store credit!


|
17 |

|
18 |
Notes: This extension interfaces with incentiBox, and communicates through the incentiBox API. For more information, and to sign up for incentiBox for API access, please see www.incentibox.com.</description>
|
19 |
-
<notes>Update to 1.0.
|
20 |
<authors><author><name>incentiBox</name><user>auto-converted</user><email>support@incentibox.com</email></author></authors>
|
21 |
<date>2011-10-06</date>
|
22 |
-
<time>
|
23 |
-
<contents><target name="magelib"><dir name="
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>IncentiBox_Communityrewards</name>
|
4 |
+
<version>1.0.5</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 |


Example: Give participants a $5 off coupon when they share about your products with their social networks. You gain valuable word-of-mouth advertising for your Magento store, AND generate additional sales when participants and their friends redeem their store credit!


|
17 |

|
18 |
Notes: This extension interfaces with incentiBox, and communicates through the incentiBox API. For more information, and to sign up for incentiBox for API access, please see www.incentibox.com.</description>
|
19 |
+
<notes>Update to 1.0.5 to get extension working on MagentoCommerce</notes>
|
20 |
<authors><author><name>incentiBox</name><user>auto-converted</user><email>support@incentibox.com</email></author></authors>
|
21 |
<date>2011-10-06</date>
|
22 |
+
<time>21:17:36</time>
|
23 |
+
<contents><target name="magelib"><dir name="IncentiBox"><file name="incentibox_api.php" hash="06490bf2d59166ab0ad4cec6f33d9398"/></dir></target><target name="magecommunity"><dir name="IncentiBox"><dir name="Communityrewards"><dir name="Block"><dir name="Communityrewards"><file name="Grid.php" hash="d3aed2d0bdcebcc08522f6786547db18"/></dir><file name="Communityrewards.php" hash="f6726f9479326221dbdffd3762f539c0"/></dir><dir name="Helper"><file name="Data.php" hash="13c5e3a3be9ffe04ba7c22c88e4fb4ee"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Listener"><file name="Collection.php" hash="db440e47cbdef4a38e2465233eab31b4"/></dir><file name="Listener.php" hash="7ab66261411770446f6dd3a9ab6ce469"/></dir><file name="Listener.php" hash="ba27fae5d984f3f892fac14c6d644c9d"/></dir><dir name="controllers"><file name="CommunityrewardsController.php" hash="fec1796b16a7d13e0fd8d77e832b9081"/><file name="ListenerController.php" hash="a5c5a4d05940e6df69c8bb8feb3a6a25"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0e809c3d1e05c6cfce33cdf0c6fc1d95"/><file name="config.xml" hash="7fd5b4fc2ef81cdcb2870a637ddc59b3"/><file name="system.xml" hash="b436d1b7d1f98e4b108b474102cdeb80"/></dir><dir name="sql"><dir name="communityrewards_setup"><file name="mysql4-install-1.0.1.php" hash="3ddbd3bcc4ec5ab995a52bcc0b563fe7"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="communityrewards.xml" hash="384dd484ddce3264fb17cfb107c02f9a"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="communityrewards.xml" hash="0bf6e0c40c944be8b51f0513bdd17a7f"/></dir><dir name="template"><dir name="communityrewards"><file name="footer_script.phtml" hash="4202d828ae1370916ba041c7bf4747f7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="IncentiBox_Communityrewards.xml" hash="13e38120f4fc14fde6f23c0b95e63ebf"/></dir></target><target name="magelocale"><dir name="en_US"><file name="IncentiBox_Communityrewards.csv" hash="b957c5e9040d798f9ce2a838fce55ee8"/></dir></target></contents>
|
24 |
<compatible/>
|
25 |
<dependencies/>
|
26 |
</package>
|