Version Notes
Rewards points pro
Download this release
Release Info
Developer | iMedia inc. |
Extension | Imedia_RewardPointsPro |
Version | 1.0.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.0.2 to 1.0.0.3
- app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit.php +25 -0
- app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit/Form.php +62 -0
- app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit/Tab.php +23 -0
- app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Grid.php +9 -14
- app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Sales/Creditmemo.php +0 -21
- app/code/community/Imedia/RewardPointsPro/Model/Account.php +31 -25
- app/code/community/Imedia/RewardPointsPro/Model/Observer.php +14 -10
- app/code/community/Imedia/RewardPointsPro/controllers/Adminhtml/RewardpointsproController.php +38 -0
- package.xml +5 -5
app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Reward Points Pro grid row edit block
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
7 |
+
{
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
$this->_blockGroup = 'imedia_rewardpointspro';
|
11 |
+
$this->_controller = 'adminhtml_rewardpointspro';
|
12 |
+
parent::__construct();
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get Header text
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function getHeaderText()
|
21 |
+
{
|
22 |
+
return Mage::helper('imedia_rewardpointspro')->__('Customer Reward Points');
|
23 |
+
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit/Form.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*Reward Points Widget Form
|
4 |
+
*/
|
5 |
+
class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* Init class
|
9 |
+
*/
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
|
14 |
+
$this->setId('imedia_rewardpointspro_rewardpointspro_edit_form');
|
15 |
+
$this->setTitle(Mage::helper('imedia_rewardpointspro')->__('Reward Point Information'));
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Setup form fields for inserts/updates
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
protected function _prepareForm()
|
23 |
+
{
|
24 |
+
$cusId = $this->getRequest()->getParam('id');
|
25 |
+
$customer_data = Mage::getModel('customer/customer')->load($cusId);
|
26 |
+
$rewardPoints = Mage::getModel('imedia_rewardpointspro/account')->load($cusId);
|
27 |
+
|
28 |
+
$form = new Varien_Data_Form(array(
|
29 |
+
'id' => 'edit_form',
|
30 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
31 |
+
'method' => 'post'
|
32 |
+
));
|
33 |
+
|
34 |
+
$fieldset = $form->addFieldset('base_fieldset', array(
|
35 |
+
'legend' => Mage::helper('imedia_rewardpointspro')->__('Reward Point Information'),
|
36 |
+
'class' => 'fieldset-wide',
|
37 |
+
));
|
38 |
+
$fieldset->addField('customer_firstname', 'label', array(
|
39 |
+
'label' => Mage::helper('imedia_rewardpointspro')->__('Customer FirstName'),
|
40 |
+
'value' => $customer_data->getFirstname()
|
41 |
+
));
|
42 |
+
$fieldset->addField('customer_lastname', 'label', array(
|
43 |
+
'label' => Mage::helper('imedia_rewardpointspro')->__('Customer LastName'),
|
44 |
+
'value' => $customer_data->getLastname()
|
45 |
+
));
|
46 |
+
$fieldset->addField('customer_email', 'label', array(
|
47 |
+
'label' => Mage::helper('imedia_rewardpointspro')->__('Customer Email'),
|
48 |
+
'value' => $customer_data->getEmail()
|
49 |
+
));
|
50 |
+
|
51 |
+
$fieldset->addField('reward_point', 'text', array(
|
52 |
+
'label' => Mage::helper('imedia_rewardpointspro')->__('Current Reward Points'),
|
53 |
+
'value' => $rewardPoints->getPointsCurrent(),
|
54 |
+
'name' => 'reward_points'
|
55 |
+
));
|
56 |
+
|
57 |
+
$form->setUseContainer(true);
|
58 |
+
$this->setForm($form);
|
59 |
+
|
60 |
+
return parent::_prepareForm();
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Edit/Tab.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*Reward Points Pro Row Edit Tab
|
4 |
+
*/
|
5 |
+
class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Edit_Tab extends Mage_Adminhtml_Block_Widget_Tabs
|
6 |
+
{
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
parent::__construct();
|
10 |
+
$this->setId('form_tabs');
|
11 |
+
$this->setDestElementId('edit_form');
|
12 |
+
$this->setTitle(Mage::helper('imedia_rewardpointspro')->__('Customer Reward Point'));
|
13 |
+
}
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('imedia_rewardpointspro')->__('Customer Reward Point'),
|
18 |
+
'title' => Mage::helper('imedia_rewardpointspro')->__('Customer Reward Point'),
|
19 |
+
));
|
20 |
+
|
21 |
+
return parent::_beforeToHtml();
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Rewardpointspro/Grid.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
-
|
6 |
class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
7 |
{
|
8 |
public function __construct()
|
@@ -13,10 +13,7 @@ class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_A
|
|
13 |
$this->setDefaultDir('DESC');
|
14 |
$this->setSaveParametersInSession(true);
|
15 |
$this->setUseAjax(true);
|
16 |
-
$this->setVarNameFilter('product_filter');
|
17 |
-
|
18 |
}
|
19 |
-
|
20 |
protected function _getStore()
|
21 |
{
|
22 |
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
@@ -35,8 +32,7 @@ class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_A
|
|
35 |
->addAttributeToSelect('email')
|
36 |
->addAttributeToSelect('firstname')
|
37 |
->addAttributeToSelect('lastname')
|
38 |
-
->addAttributeToSelect('entity_id');
|
39 |
-
//->addAttributeToSelect('type_id');
|
40 |
|
41 |
$collection->joinField('points_current',
|
42 |
'rewardpointspro_account',
|
@@ -48,7 +44,6 @@ class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_A
|
|
48 |
$this->setCollection($collection);
|
49 |
|
50 |
parent::_prepareCollection();
|
51 |
-
//$this->getCollection()->addWebsiteNamesToResult();
|
52 |
return $this;
|
53 |
}
|
54 |
|
@@ -70,25 +65,25 @@ class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_A
|
|
70 |
|
71 |
$this->addColumn('firstname',
|
72 |
array(
|
73 |
-
'header'=> Mage::helper('imedia_rewardpointspro')->__('
|
74 |
'index' => 'firstname',
|
75 |
));
|
76 |
|
77 |
$this->addColumn('lastname',
|
78 |
array(
|
79 |
-
'header'=> Mage::helper('imedia_rewardpointspro')->__('
|
80 |
'index' => 'lastname',
|
81 |
));
|
82 |
|
83 |
$this->addColumn('email',
|
84 |
array(
|
85 |
-
'header'=> Mage::helper('imedia_rewardpointspro')->__('Email'),
|
86 |
'index' => 'email',
|
87 |
));
|
88 |
|
89 |
$this->addColumn('points_current',
|
90 |
array(
|
91 |
-
'header'=> Mage::helper('imedia_rewardpointspro')->__('Rewards Points'),
|
92 |
'index' => 'points_current',
|
93 |
));
|
94 |
$this->addExportType('*/*/exportCsv',Mage::helper('imedia_rewardpointspro')->__('CSV'));
|
@@ -96,9 +91,9 @@ class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_A
|
|
96 |
return parent::_prepareColumns();
|
97 |
}
|
98 |
|
99 |
-
|
100 |
{
|
101 |
-
return $this->getUrl('*/*/
|
102 |
}
|
103 |
|
104 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Reward Points Pro grid block
|
4 |
*
|
5 |
+
*/
|
6 |
class Imedia_RewardPointsPro_Block_Adminhtml_Rewardpointspro_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
7 |
{
|
8 |
public function __construct()
|
13 |
$this->setDefaultDir('DESC');
|
14 |
$this->setSaveParametersInSession(true);
|
15 |
$this->setUseAjax(true);
|
|
|
|
|
16 |
}
|
|
|
17 |
protected function _getStore()
|
18 |
{
|
19 |
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
32 |
->addAttributeToSelect('email')
|
33 |
->addAttributeToSelect('firstname')
|
34 |
->addAttributeToSelect('lastname')
|
35 |
+
->addAttributeToSelect('entity_id');
|
|
|
36 |
|
37 |
$collection->joinField('points_current',
|
38 |
'rewardpointspro_account',
|
44 |
$this->setCollection($collection);
|
45 |
|
46 |
parent::_prepareCollection();
|
|
|
47 |
return $this;
|
48 |
}
|
49 |
|
65 |
|
66 |
$this->addColumn('firstname',
|
67 |
array(
|
68 |
+
'header'=> Mage::helper('imedia_rewardpointspro')->__('Customer FirstName'),
|
69 |
'index' => 'firstname',
|
70 |
));
|
71 |
|
72 |
$this->addColumn('lastname',
|
73 |
array(
|
74 |
+
'header'=> Mage::helper('imedia_rewardpointspro')->__('Customer LastName'),
|
75 |
'index' => 'lastname',
|
76 |
));
|
77 |
|
78 |
$this->addColumn('email',
|
79 |
array(
|
80 |
+
'header'=> Mage::helper('imedia_rewardpointspro')->__('Customer Email'),
|
81 |
'index' => 'email',
|
82 |
));
|
83 |
|
84 |
$this->addColumn('points_current',
|
85 |
array(
|
86 |
+
'header'=> Mage::helper('imedia_rewardpointspro')->__('Customer Rewards Points'),
|
87 |
'index' => 'points_current',
|
88 |
));
|
89 |
$this->addExportType('*/*/exportCsv',Mage::helper('imedia_rewardpointspro')->__('CSV'));
|
91 |
return parent::_prepareColumns();
|
92 |
}
|
93 |
|
94 |
+
public function getRowUrl($row)
|
95 |
{
|
96 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
97 |
}
|
98 |
|
99 |
}
|
app/code/community/Imedia/RewardPointsPro/Block/Adminhtml/Sales/Creditmemo.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Imedia_RewardPointsPro_Block_Adminhtml_Sales_Creditmemo extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
3 |
-
{
|
4 |
-
protected function _initTotals() {
|
5 |
-
parent::_initTotals();
|
6 |
-
$amt = $this->getSource()->getFeeAmount();
|
7 |
-
//Mage::log('creditmemo.php: '.$amt);
|
8 |
-
$baseAmt = $this->getSource()->getBaseFeeAmount();
|
9 |
-
if ($amt != 0) {
|
10 |
-
|
11 |
-
$this->addTotal(new Varien_Object(array(
|
12 |
-
'code' => 'Discount',
|
13 |
-
'value' => $amt,
|
14 |
-
'base_value' => $baseAmt,
|
15 |
-
'label' => 'Rewards points discount',
|
16 |
-
)), 'discount');
|
17 |
-
}
|
18 |
-
return $this;
|
19 |
-
}
|
20 |
-
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Imedia/RewardPointsPro/Model/Account.php
CHANGED
@@ -15,7 +15,7 @@ class Imedia_RewardPointsPro_Model_Account extends Mage_Core_Model_Abstract
|
|
15 |
protected $pointsSpent = NULL;
|
16 |
|
17 |
|
18 |
-
public function save()
|
19 |
$connection = Mage::getSingleton('core/resource')->getConnection('rewardpointspro_write');
|
20 |
|
21 |
$connection->beginTransaction();
|
@@ -47,30 +47,36 @@ class Imedia_RewardPointsPro_Model_Account extends Mage_Core_Model_Abstract
|
|
47 |
throw $e;
|
48 |
}
|
49 |
return $this;
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
public function load($id , $field=null) {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
|
73 |
-
|
74 |
$collpoint = Mage::getModel('rewardpointspro/account')->load($customerId);
|
75 |
if($collpoint){
|
76 |
$pointsCurrent = $collpoint->getPointsCurrent();
|
@@ -85,9 +91,9 @@ class Imedia_RewardPointsPro_Model_Account extends Mage_Core_Model_Abstract
|
|
85 |
$this->pointsSpent = $pointsSpent;
|
86 |
$this->customerId = $customerId;
|
87 |
$this->storeId = $storeId;
|
88 |
-
|
89 |
|
90 |
-
|
91 |
$collpoint = Mage::getModel('rewardpointspro/account')->load($customerId);
|
92 |
if($collpoint){
|
93 |
$pointsCurrent = $collpoint->getPointsCurrent();
|
@@ -102,7 +108,7 @@ class Imedia_RewardPointsPro_Model_Account extends Mage_Core_Model_Abstract
|
|
102 |
$this->customerId = $customerId;
|
103 |
$this->pointsReceived = $pointsReceived;
|
104 |
$this->storeId = $storeId;
|
105 |
-
|
106 |
|
107 |
|
108 |
}
|
15 |
protected $pointsSpent = NULL;
|
16 |
|
17 |
|
18 |
+
public function save(){
|
19 |
$connection = Mage::getSingleton('core/resource')->getConnection('rewardpointspro_write');
|
20 |
|
21 |
$connection->beginTransaction();
|
47 |
throw $e;
|
48 |
}
|
49 |
return $this;
|
50 |
+
}
|
51 |
+
public function updatepoints($p, $customerId) {
|
52 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('rewardpointspro_write');
|
53 |
+
$connection->beginTransaction();
|
54 |
+
$fields = array('points_current'=>$p);
|
55 |
+
$where = $connection->quoteInto('customer_id=?',$customerId);
|
56 |
+
$connection->update('rewardpointspro_account', $fields, $where);
|
57 |
+
}
|
58 |
public function load($id , $field=null) {
|
59 |
+
if ($field === null) {
|
60 |
+
$field = 'customer_id';
|
61 |
+
}
|
62 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('rewardpointspro_read');
|
63 |
+
$select = $connection->select()->from('rewardpointspro_account')->where('rewardpointspro_account.'.$field.'=?', $id);
|
64 |
+
$data = $connection->fetchRow($select);
|
65 |
+
if (!$data) {
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
$this->setRewardpointsAccountId($data['rewardpoints_account_id']);
|
69 |
+
$this->setCustomerId($data['customer_id']);
|
70 |
+
$this->setStoreId($data['store_id']);
|
71 |
+
$this->setPointsCurrent($data['points_current']);
|
72 |
+
$this->setPointsReceived($data['points_received']);
|
73 |
+
$this->setPointsSpent($data['points_spent']);
|
74 |
+
$this->_afterLoad();
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
|
78 |
|
79 |
+
public function addPoints($p, $customerId) {
|
80 |
$collpoint = Mage::getModel('rewardpointspro/account')->load($customerId);
|
81 |
if($collpoint){
|
82 |
$pointsCurrent = $collpoint->getPointsCurrent();
|
91 |
$this->pointsSpent = $pointsSpent;
|
92 |
$this->customerId = $customerId;
|
93 |
$this->storeId = $storeId;
|
94 |
+
}
|
95 |
|
96 |
+
public function subtractPoints($p, $customerId) {
|
97 |
$collpoint = Mage::getModel('rewardpointspro/account')->load($customerId);
|
98 |
if($collpoint){
|
99 |
$pointsCurrent = $collpoint->getPointsCurrent();
|
108 |
$this->customerId = $customerId;
|
109 |
$this->pointsReceived = $pointsReceived;
|
110 |
$this->storeId = $storeId;
|
111 |
+
}
|
112 |
|
113 |
|
114 |
}
|
app/code/community/Imedia/RewardPointsPro/Model/Observer.php
CHANGED
@@ -7,20 +7,24 @@
|
|
7 |
class Imedia_RewardPointsPro_Model_Observer extends Mage_Core_Model_Abstract {
|
8 |
public function orderStatusChange($event)
|
9 |
{
|
10 |
-
|
11 |
$state = $order->getState();
|
12 |
$items = $order->getAllVisibleItems();
|
13 |
$cusId = $order->getCustomerId();
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
if($state == 'canceled'){
|
20 |
-
$this->useCouponPoints($rewardPoints, $cusId);
|
21 |
-
}
|
22 |
}
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
public function rewardpoints($observer){
|
7 |
class Imedia_RewardPointsPro_Model_Observer extends Mage_Core_Model_Abstract {
|
8 |
public function orderStatusChange($event)
|
9 |
{
|
10 |
+
$order = $event->getOrder();
|
11 |
$state = $order->getState();
|
12 |
$items = $order->getAllVisibleItems();
|
13 |
$cusId = $order->getCustomerId();
|
14 |
+
$rewardPoints = 0;
|
15 |
+
$prodIds = array();
|
16 |
+
if($state == 'canceled'){
|
17 |
+
foreach ($items as $item) {
|
18 |
+
$prodIds[] = $item->getProduct()->getId();
|
|
|
|
|
|
|
19 |
}
|
20 |
+
$prod = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('reward_points_pro')->addIdFilter($prodIds);
|
21 |
+
//sum up points per product per quantity
|
22 |
+
foreach ($items as $item) {
|
23 |
+
$rewardPoints += $prod->getItemById($item->getProduct()->getId())->getRewardPointsPro() * $item->getQtyOrdered();
|
24 |
+
}
|
25 |
+
//delete customer points when order cancel
|
26 |
+
$this->useCouponPoints($rewardPoints, $cusId);
|
27 |
+
}
|
28 |
}
|
29 |
|
30 |
public function rewardpoints($observer){
|
app/code/community/Imedia/RewardPointsPro/controllers/Adminhtml/RewardpointsproController.php
CHANGED
@@ -46,5 +46,43 @@ class Imedia_RewardPointsPro_Adminhtml_RewardpointsproController extends Mage_Ad
|
|
46 |
$content = $this->getLayout()->createBlock('imedia_rewardpointspro/adminhtml_rewardpointspro_grid')->getCsvFile();
|
47 |
$this->_prepareDownloadResponse($fileName, $content);
|
48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
}
|
46 |
$content = $this->getLayout()->createBlock('imedia_rewardpointspro/adminhtml_rewardpointspro_grid')->getCsvFile();
|
47 |
$this->_prepareDownloadResponse($fileName, $content);
|
48 |
}
|
49 |
+
public function editAction()
|
50 |
+
{
|
51 |
+
$this->_initAction()
|
52 |
+
->_addContent($this->getLayout()->createBlock('imedia_rewardpointspro/adminhtml_rewardpointspro_edit')->setData('action', $this->getUrl('*/*/save')))
|
53 |
+
->_addLeft($this->getLayout()->createBlock('imedia_rewardpointspro/adminhtml_rewardpointspro_edit_tab'))
|
54 |
+
->renderLayout();
|
55 |
+
}
|
56 |
+
public function saveAction()
|
57 |
+
{
|
58 |
+
if ($postData = $this->getRequest()->getPost()){
|
59 |
+
$cusId = $this->getRequest()->getParam('id');
|
60 |
+
$pointsInt = $postData['reward_points'];
|
61 |
+
$points = Mage::getModel('rewardpointspro/account')->load($cusId);
|
62 |
+
$postValues = array('points_current' => $pointsInt);
|
63 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
64 |
+
$connection->beginTransaction();
|
65 |
+
$where = $connection->quoteInto('customer_id =?', $cusId);
|
66 |
+
|
67 |
+
try {
|
68 |
+
|
69 |
+
$connection->update('rewardpointspro_account', $postValues, $where);
|
70 |
+
$connection->commit();
|
71 |
+
|
72 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('imedia_rewardpointspro')->__('The Customer Points has been saved.'));
|
73 |
+
$this->_redirect('*/*/');
|
74 |
+
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
catch (Mage_Core_Exception $e) {
|
78 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
79 |
+
}
|
80 |
+
catch (Exception $e) {
|
81 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('imedia_rewardpointspro')->__('An error occurred while saving this status.'));
|
82 |
+
}
|
83 |
+
$this->_redirectReferer();
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
|
88 |
}
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Imedia_RewardPointsPro</name>
|
4 |
-
<version>1.0.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Customer reward points pro</summary>
|
10 |
-
<description>Customer reward points pro
|
11 |
<notes>Rewards points pro</notes>
|
12 |
<authors><author><name>iMedia inc.</name><user>imedia</user><email>info@imediadesigns.org</email></author></authors>
|
13 |
-
<date>2015-07-
|
14 |
-
<time>09:
|
15 |
-
<contents><target name="magecommunity"><dir name="Imedia"><dir name="RewardPointsPro"><dir name="Block"><dir name="Adminhtml"><dir name="Renderer"><file name="CustomerName.php" hash="9880f3ee37b07e5af35ef0cc8f825e4e"/></dir><dir name="Rewardpointspro"><file name="
|
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>Imedia_RewardPointsPro</name>
|
4 |
+
<version>1.0.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Customer reward points pro</summary>
|
10 |
+
<description>Customer reward points pro for newsletter signups, customer register and products. Rewards points pro are manageable from admin. </description>
|
11 |
<notes>Rewards points pro</notes>
|
12 |
<authors><author><name>iMedia inc.</name><user>imedia</user><email>info@imediadesigns.org</email></author></authors>
|
13 |
+
<date>2015-07-17</date>
|
14 |
+
<time>14:09:09</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Imedia"><dir name="RewardPointsPro"><dir name="Block"><dir name="Adminhtml"><dir name="Renderer"><file name="CustomerName.php" hash="9880f3ee37b07e5af35ef0cc8f825e4e"/></dir><dir name="Rewardpointspro"><dir name="Edit"><file name="Form.php" hash="6378b6024cd51c6f9cd662577d3e2630"/><file name="Tab.php" hash="64bff195d8b4866b25a7a5f123e4a477"/></dir><file name="Edit.php" hash="91dd07e9f309dc2b4adceab2ebeb56e4"/><file name="Grid.php" hash="4d4d4deb1983f2c286334a8313c40aaf"/></dir><file name="Rewardpointspro.php" hash="6de26e3169f625e61b98ea4c2c5af234"/><dir name="Sales"><file name="Invoice.php" hash="b05e90d8a4b2aa434fe7ddb63f1c687f"/><file name="Order.php" hash="c62f395e1fc3f059944dd0dba949b117"/></dir></dir><dir name="Reward"><file name="Points.php" hash="3a7c7562fffc83c63dd3be4906586d72"/></dir><dir name="Sales"><file name="Creditmemo.php" hash="116e21ffef79527507b07c492065ebd2"/><dir name="Order"><file name="Total.php" hash="37101295846b957a216a1f9998cec684"/></dir><file name="Order.php" hash="33b5f22132606778769080116046daba"/></dir></dir><dir name="Helper"><file name="Data.php" hash="4f276c0f4c8ea385d780c23b50b349b5"/></dir><dir name="Model"><file name="Account.php" hash="eed9cef4fb7964f44ead7f817c774ebf"/><file name="Creditmemo.php" hash="ba6c8a5182bb921b79aed5fe32ab5535"/><file name="Discount.php" hash="d44594fc83dd0632c2dc0151ecf58739"/><file name="Invoice.php" hash="06fa01fd6689a8db282d0560087478ca"/><dir name="Mysql4"><dir name="Account"><file name="Collection.php" hash="64b81d1a62d9d964afe0913d6f56207f"/></dir><file name="Account.php" hash="b3669fb000d7274ad25a97f72f5bb497"/><dir name="Rewardpointspro"><file name="Collection.php" hash="5e5bfd54858fa1da52b155f24519647b"/></dir><file name="Rewardpointspro.php" hash="28855cd07a056e045d14d97c31c0ee85"/></dir><file name="Observer.php" hash="d9733a37fa5643d55a947ebf69287431"/><dir name="Resource"><file name="Setup.php" hash="7045ffc6c6acf290a2accc45aef2e8f0"/></dir><file name="Rewardpointspro.php" hash="cf9779be9803ee36e5727fa034c37ba9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RewardpointsproController.php" hash="e01ef0a5be993557a5f1bf097be90e80"/></dir><file name="CartController.php" hash="53895e47b697c86be73746e93cad3bb6"/><file name="IndexController.php" hash="e668e366b4abe41d262c3eb8710fa245"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c29c05d914a25e1d71d14a6e060990ac"/><file name="config.xml" hash="0fc831654be27b1729e4da80d8dc9fc7"/><file name="system.xml" hash="8787e2406ed52ec7091c137b2d952d41"/></dir><dir name="sql"><dir name="imedia_rewardpointspro_setup"><file name="install-0.0.1.php" hash="7c9122cf6207517dc38bcc64fcf8ca84"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="imedia"><file name="imedia_rewardpointspro.xml" hash="0682d43add3bd93151cfeb755abd36f2"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="imedia"><file name="imedia_rewardpointspro.xml" hash="bc7dea0c578bebb2c444028762bbb0c2"/></dir></dir><dir name="template"><dir name="imedia"><file name="rewardproform.phtml" hash="e279194e1fba55a427d051ae0b4d003f"/><dir name="rewardpointspro"><file name="dashboard_pro_points.phtml" hash="8e7c3233a2ef7f982d992ddfe3b455af"/><file name="my_dashboard_pro.phtml" hash="e4e93745a6a9978074488f7d9448e669"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Imedia_RewardPointsPro.xml" hash="b7c856109447a6197843c8116dbe88d5"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="imedia"><file name="im_rewardspro.css" hash="55bb13de3ffc6a7642c627b9b0546b7e"/></dir></dir></dir></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>
|