Medma_Reward_Referral - Version 1.0.0

Version Notes

This is a stable version

Download this release

Release Info

Developer Medma Infomatix
Extension Medma_Reward_Referral
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (27) hide show
  1. app/code/local/Medma/Reward/Block/Adminhtml/Customer/Edit.php +137 -0
  2. app/code/local/Medma/Reward/Block/Adminhtml/Customer/Edit/Tab/Action.php +74 -0
  3. app/code/local/Medma/Reward/Helper/Data.php +6 -0
  4. app/code/local/Medma/Reward/Model/Mysql4/Redemptpayment.php +10 -0
  5. app/code/local/Medma/Reward/Model/Mysql4/Redemptpayment/Collection.php +18 -0
  6. app/code/local/Medma/Reward/Model/Mysql4/Reward.php +10 -0
  7. app/code/local/Medma/Reward/Model/Mysql4/Reward/Collection.php +18 -0
  8. app/code/local/Medma/Reward/Model/Observer.php +87 -0
  9. app/code/local/Medma/Reward/Model/Redemptpayment.php +10 -0
  10. app/code/local/Medma/Reward/Model/Reward.php +10 -0
  11. app/code/local/Medma/Reward/controllers/AccountController.php +361 -0
  12. app/code/local/Medma/Reward/controllers/Adminhtml/CustomerController.php +87 -0
  13. app/code/local/Medma/Reward/etc/adminhtml.xml +26 -0
  14. app/code/local/Medma/Reward/etc/config.xml +126 -0
  15. app/code/local/Medma/Reward/etc/system.xml +41 -0
  16. app/code/local/Medma/Reward/sql/reward_setup/mysql4-install-0.1.0.php +39 -0
  17. app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.1.0-0.1.1.php +35 -0
  18. app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.1.9-0.2.0.php +41 -0
  19. app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.2.0-0.2.1.php +31 -0
  20. app/design/adminhtml/default/default/layout/reward.xml +8 -0
  21. app/design/adminhtml/default/default/template/reward/action.phtml +34 -0
  22. app/design/frontend/default/default/layout/reward.xml +32 -0
  23. app/design/frontend/default/default/template/reward/form/edit.phtml +121 -0
  24. app/design/frontend/default/default/template/reward/form/redemption.phtml +113 -0
  25. app/design/frontend/default/default/template/reward/form/register.phtml +198 -0
  26. app/etc/modules/Medma_Reward.xml +9 -0
  27. package.xml +18 -0
app/code/local/Medma/Reward/Block/Adminhtml/Customer/Edit.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer edit block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ include_once "app/code/core/Mage/Adminhtml/Block/Customer/Edit.php";
35
+ class Medma_Reward_Block_Adminhtml_Customer_Edit extends Mage_Adminhtml_Block_Customer_Edit
36
+ {
37
+ public function __construct()
38
+ {//print_r($_POST);exit;
39
+ $this->_objectId = 'id';
40
+ $this->_controller = 'customer';
41
+
42
+ if ($this->getCustomerId() &&
43
+ Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/create')) {
44
+ $this->_addButton('order', array(
45
+ 'label' => Mage::helper('customer')->__('Create Order'),
46
+ 'onclick' => 'setLocation(\'' . $this->getCreateOrderUrl() . '\')',
47
+ 'class' => 'add',
48
+ ), 0);
49
+ }
50
+
51
+ $this->_addButton('sendcode', array(
52
+ 'label' => Mage::helper('customer')->__('Send Code'),
53
+ 'onclick' => 'setLocation(\'' . $this->getCreateSendUrl($this->getCustomerId()) . '\')',
54
+ 'class' => 'add',
55
+ ), 0);
56
+
57
+ parent::__construct();
58
+
59
+ $this->_updateButton('save', 'label', Mage::helper('customer')->__('Save Customer'));
60
+ $this->_updateButton('delete', 'label', Mage::helper('customer')->__('Delete Customer'));
61
+
62
+ if (Mage::registry('current_customer')->isReadonly()) {
63
+ $this->_removeButton('save');
64
+ $this->_removeButton('reset');
65
+ }
66
+
67
+ if (!Mage::registry('current_customer')->isDeleteable()) {
68
+ $this->_removeButton('delete');
69
+ }
70
+ }
71
+
72
+ public function getCreateOrderUrl()
73
+ {
74
+ return $this->getUrl('*/sales_order_create/start', array('customer_id' => $this->getCustomerId()));
75
+ }
76
+
77
+ public function getCreateSendUrl($custId)
78
+ {
79
+ $get_key = Mage::getSingleton('adminhtml/url')->getSecretKey("adminhtml_customer","sendemail");
80
+
81
+ return Mage::getUrl("reward/adminhtml_customer/sendemail/key/$get_key/customerId/$custId");
82
+ }
83
+
84
+ public function getCustomerId()
85
+ {
86
+ return Mage::registry('current_customer')->getId();
87
+ }
88
+
89
+ public function getHeaderText()
90
+ {
91
+ if (Mage::registry('current_customer')->getId()) {
92
+ return $this->htmlEscape(Mage::registry('current_customer')->getName());
93
+ }
94
+ else {
95
+ return Mage::helper('customer')->__('New Customer');
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Prepare form html. Add block for configurable product modification interface
101
+ *
102
+ * @return string
103
+ */
104
+ public function getFormHtml()
105
+ {
106
+ $html = parent::getFormHtml();
107
+ $html .= $this->getLayout()->createBlock('adminhtml/catalog_product_composite_configure')->toHtml();
108
+ return $html;
109
+ }
110
+
111
+ public function getValidationUrl()
112
+ {
113
+ return $this->getUrl('*/*/validate', array('_current'=>true));
114
+ }
115
+
116
+ protected function _prepareLayout()
117
+ {
118
+ if (!Mage::registry('current_customer')->isReadonly()) {
119
+ $this->_addButton('save_and_continue', array(
120
+ 'label' => Mage::helper('customer')->__('Save and Continue Edit'),
121
+ 'onclick' => 'saveAndContinueEdit(\''.$this->_getSaveAndContinueUrl().'\')',
122
+ 'class' => 'save'
123
+ ), 10);
124
+ }
125
+
126
+ return parent::_prepareLayout();
127
+ }
128
+
129
+ protected function _getSaveAndContinueUrl()
130
+ {
131
+ return $this->getUrl('*/*/save', array(
132
+ '_current' => true,
133
+ 'back' => 'edit',
134
+ 'tab' => '{{tab_id}}'
135
+ ));
136
+ }
137
+ }
app/code/local/Medma/Reward/Block/Adminhtml/Customer/Edit/Tab/Action.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Adminhtml customer action tab
5
+ *
6
+ */
7
+ class Medma_Reward_Block_Adminhtml_Customer_Edit_Tab_Action extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
8
+ {
9
+
10
+ public function __construct()
11
+ {
12
+ $this->setTemplate('reward/action.phtml');
13
+
14
+ }
15
+
16
+ public function getCustomtabInfo(){
17
+
18
+ $customer = Mage::registry('current_customer');
19
+ return $customer->getId();
20
+ }
21
+
22
+ /**
23
+ * Return Tab label
24
+ *
25
+ * @return string
26
+ */
27
+ public function getTabLabel()
28
+ {
29
+ return $this->__('Total Redemption');
30
+ }
31
+
32
+ /**
33
+ * Return Tab title
34
+ *
35
+ * @return string
36
+ */
37
+ public function getTabTitle()
38
+ {
39
+ return $this->__('Total Redemption');
40
+ }
41
+
42
+ /**
43
+ * Can show tab in tabs
44
+ *
45
+ * @return boolean
46
+ */
47
+ public function canShowTab()
48
+ {
49
+ $customer = Mage::registry('current_customer');
50
+ return (bool)$customer->getId();
51
+ }
52
+
53
+ /**
54
+ * Tab is hidden
55
+ *
56
+ * @return boolean
57
+ */
58
+ public function isHidden()
59
+ {
60
+ return false;
61
+ }
62
+
63
+ /**
64
+ * Defines after which tab, this tab should be rendered
65
+ *
66
+ * @return string
67
+ */
68
+ public function getAfter()
69
+ {
70
+ return 'tags';
71
+ }
72
+
73
+ }
74
+ ?>
app/code/local/Medma/Reward/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Medma/Reward/Model/Mysql4/Redemptpayment.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Mysql4_Redemptpayment extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the registration_id refers to the key field in your database table.
8
+ $this->_init('reward/redemptpayment', 'id');
9
+ }
10
+ }
app/code/local/Medma/Reward/Model/Mysql4/Redemptpayment/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Mysql4_Redemptpayment_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('reward/redemptpayment');
9
+ }
10
+ // public function addFieldToSort($attribute, $dir='asc')
11
+ // {
12
+ // if (!is_string($attribute)) {
13
+ // return $this;
14
+ // }
15
+ // $this->setOrder($attribute, $dir);
16
+ // return $this;
17
+ // }
18
+ }
app/code/local/Medma/Reward/Model/Mysql4/Reward.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Mysql4_Reward extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the registration_id refers to the key field in your database table.
8
+ $this->_init('reward/reward', 'redemptionpayment_id');
9
+ }
10
+ }
app/code/local/Medma/Reward/Model/Mysql4/Reward/Collection.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Mysql4_Reward_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('reward/reward');
9
+ }
10
+ // public function addFieldToSort($attribute, $dir='asc')
11
+ // {
12
+ // if (!is_string($attribute)) {
13
+ // return $this;
14
+ // }
15
+ // $this->setOrder($attribute, $dir);
16
+ // return $this;
17
+ // }
18
+ }
app/code/local/Medma/Reward/Model/Observer.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Observer {
4
+
5
+ public function sendRedeemedAmount($observer) {
6
+
7
+ $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
8
+ $totalPrice = 0;
9
+ foreach($items as $item)
10
+ {
11
+ $totalPrice += $item->getRowTotal();
12
+ }
13
+ $creditPercent = Mage::getStoreConfig('reward/reward/credit');
14
+ $redemptionAmt = ($totalPrice*$creditPercent)/100;
15
+ $customerId = Mage::getSingleton('customer/session')->getId();
16
+ $customerCode = Mage::getSingleton('customer/session')->getCustomer()->getBusinesslicensepath();
17
+
18
+ $customerReferral = Mage::getModel('customer/customer');
19
+ $customerReferral = $customerReferral->getCollection()
20
+
21
+ ->addFieldToFilter('customeridentifier1',array($customerCode))
22
+
23
+ ->getData();
24
+ $referralCustomer = $customerReferral[0]['entity_id'];
25
+ $referralCustomerEmail = $customerReferral[0]['email'];
26
+
27
+ $insertData['customer_id'] = $referralCustomer;
28
+ $insertData['redemption_amount'] = $redemptionAmt;
29
+ $model = Mage::getModel('reward/reward');
30
+ $model->setData($insertData)->setId();
31
+ $model->save();
32
+
33
+ $customerDetails= Mage::getSingleton('customer/session')->getCustomer()->getData();
34
+ $customerFirstName = $customerDetails['firstname'];
35
+ $customerLastName = $customerDetails['lastname'];
36
+ $customerName = $customerFirstName.' '.$customerLastName;
37
+
38
+ $message = "<table align='center' cellpadding='0' cellspacing='0' border='0' style='border:1px solid #bababa;width:800px;background-color:#eeeeee'>
39
+ <tr>
40
+ <td align='center' width='100%'>
41
+ <table align='center' cellpadding='0' cellspacing='0' border='0' width='100%'>
42
+ <tr>
43
+ <td colspan='3' style='padding-left: 30px;'>
44
+ <table align='left' cellpadding='0' cellspacing='0' border='0' width='100%'>
45
+ <tr><td height='15px;'></td></tr>
46
+ <tr>
47
+ <td align='left' style='font-size:14px;font-family:Arial;'> Hello $customerName<b>,</b></td>
48
+ </tr>
49
+ <tr><td height='10px;'></td></tr>
50
+ <tr>
51
+ <td align='left' style='font-size:14px;font-family:Arial;'>Kindly login to your account to get the information about credited amount.</td>
52
+ </tr>
53
+ <tr><td height='10px;'></td></tr>
54
+ <tr>
55
+ <td align='left' style='font-size:14px;font-family:Arial;'>
56
+ </tr>
57
+ <tr><td height='5px;'></td></tr>
58
+
59
+ <tr><td height='30px;'></td></tr>
60
+ <tr>
61
+ <td align='left' style='font-size:14px;font-family:Arial;font-weight:bold'>Best Regards,</td>
62
+ </tr>
63
+ <tr><td height='5px;'></td></tr>
64
+ <tr>
65
+ <td align='left' style='font-size:14px;font-family:Arial;'>Rewards Team</td>
66
+ </tr>
67
+ </table>
68
+ </td>
69
+ </tr>
70
+ <tr><td height='50px;'></td></tr>
71
+ </table>
72
+ </td>
73
+ </tr>
74
+ </table>";
75
+ //echo $message;exit;
76
+
77
+ $subject = 'Amount Credited';
78
+ $to = $referralCustomerEmail;
79
+ $from_email = Mage::getStoreConfig('trans_email/ident_general/email');
80
+
81
+ $header ="MIME-Version: 1.0"."\r\n";
82
+ $header.="Content-type: text/html; charset=iso-8859-1"."\r\n";
83
+ $header.="From: <".$from_email.">"."\r\n";
84
+
85
+ mail($to,$subject,$message,$header);
86
+ }
87
+ }
app/code/local/Medma/Reward/Model/Redemptpayment.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Redemptpayment extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('reward/redemptpayment');
9
+ }
10
+ }
app/code/local/Medma/Reward/Model/Reward.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Medma_Reward_Model_Reward extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('reward/reward');
9
+ }
10
+ }
app/code/local/Medma/Reward/controllers/AccountController.php ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Customer/controllers/AccountController.php';
3
+ class Medma_Reward_AccountController extends Mage_Customer_AccountController
4
+ {
5
+ public function redemptionPostAction(){//print_r($_POST);exit;
6
+ if (!$this->_validateFormKey()) {
7
+ return $this->_redirect('*/*/edit');
8
+ }
9
+
10
+ if ($this->getRequest()->isPost()) {
11
+ /** @var $customer Mage_Customer_Model_Customer */
12
+ $customer = $this->_getSession()->getCustomer();
13
+
14
+ /** @var $customerForm Mage_Customer_Model_Form */
15
+ $customerForm = Mage::getModel('customer/form');
16
+ $customerForm->setFormCode('customer_account_redemption')
17
+ ->setEntity($customer);
18
+
19
+ $model = Mage::getModel('reward/reward');
20
+ $curDate = date("Y-m-d");
21
+
22
+ $redemptAmt = $_POST['redemption_amount'];
23
+ $customerName = $_POST['bank_name'];
24
+ $account_no = $_POST['account_no'];
25
+ if($redemptAmt!=0 && $customerName!='' && $account_no!='')
26
+ {
27
+ $customerId = Mage::getSingleton('customer/session')->getId();
28
+ $defaultData['customer_id'] = $customerId;
29
+ $defaultData['redemption_amount'] = $redemptAmt;
30
+ $defaultData['bank_name'] = $bankName;
31
+ $defaultData['claim_request'] = 'claimed';
32
+ $defaultData['redemption_time'] = $curDate;
33
+ $defaultData['customer_account'] = $account_no;
34
+ $model->setData($defaultData)->setId();
35
+ $model->save();
36
+
37
+ $storeCurrency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
38
+ $customerEmail = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
39
+
40
+ $message = "<table align='center' cellpadding='0' cellspacing='0' border='0' style='border:1px solid #bababa;width:800px;background-color:#eeeeee'>
41
+ <tr>
42
+ <td align='center' width='100%'>
43
+ <table align='center' cellpadding='0' cellspacing='0' border='0' width='100%'>
44
+ <tr>
45
+ <td colspan='3' style='padding-left: 30px;'>
46
+ <table align='left' cellpadding='0' cellspacing='0' border='0' width='100%'>
47
+ <tr><td height='15px;'></td></tr>
48
+ <tr>
49
+ <td align='left' style='font-size:14px;font-family:Arial;'> Hello Admin<b>,</b></td>
50
+ </tr>
51
+ <tr><td height='10px;'></td></tr>
52
+ <tr>
53
+ <td align='left' style='font-size:14px;font-family:Arial;'>$customerName has filled his/her redemption form</td>
54
+ </tr>
55
+ <tr><td height='10px;'></td></tr>
56
+ <tr>
57
+ <td align='left' style='font-size:14px;font-family:Arial;'>Redemption Amount: $redemptAmt</td>
58
+ </tr>
59
+ <tr><td height='10px;'></td></tr>
60
+
61
+ <tr>
62
+ <td align='left' style='font-size:14px;font-family:Arial;'>Customer Account no.: $account_no</td>
63
+ </tr>
64
+ <tr>
65
+ <td align='left' style='font-size:14px;font-family:Arial;'>
66
+ </tr>
67
+ <tr><td height='5px;'></td></tr>
68
+
69
+ <tr><td height='30px;'></td></tr>
70
+ <tr>
71
+ <td align='left' style='font-size:14px;font-family:Arial;font-weight:bold'>Best Regards,</td>
72
+ </tr>
73
+ <tr><td height='5px;'></td></tr>
74
+ <tr>
75
+ <td align='left' style='font-size:14px;font-family:Arial;'>$customerName</td>
76
+ </tr>
77
+ </table>
78
+ </td>
79
+ </tr>
80
+ <tr><td height='50px;'></td></tr>
81
+ </table>
82
+ </td>
83
+ </tr>
84
+ </table>";
85
+ //echo $message;exit;
86
+
87
+ $subject = 'Redemption Form Information';
88
+ $to = Mage::getStoreConfig('trans_email/ident_general/email');
89
+ $customerDetails= Mage::getSingleton('customer/session')->getCustomer()->getData();
90
+ $from_email = $customerDetails['email'];
91
+
92
+ $header ="MIME-Version: 1.0"."\r\n";
93
+ $header.="Content-type: text/html; charset=iso-8859-1"."\r\n";
94
+ $header.="From: <".$from_email.">"."\r\n";
95
+
96
+ mail($to,$subject,$message,$header);
97
+ //print_r($customerForm);
98
+ $this->_getSession()
99
+ ->addSuccess($this->__('Redemption information has been sent to Admin.'));
100
+ $this->_redirect('*/*/redemption');
101
+ }
102
+ else
103
+ {
104
+ $this->_getSession()
105
+ ->addError($this->__('Redemption information cound not be sent to Admin.'));
106
+ $this->_redirect('*/*/redemption');
107
+ }
108
+ }
109
+ }
110
+ public function redemptionAction()
111
+ {
112
+
113
+ $this->loadLayout();
114
+ $this->_initLayoutMessages('customer/session');
115
+ $this->_initLayoutMessages('catalog/session');
116
+ $data = $this->_getSession()->getCustomerFormData(true);
117
+ $customer = $this->_getSession()->getCustomer();
118
+ if (!empty($data)) {
119
+ $customer->addData($data);
120
+ }
121
+ $this->renderLayout();
122
+ }
123
+
124
+ public function editPostAction()
125
+ {
126
+ if (!$this->_validateFormKey()) {
127
+ return $this->_redirect('*/*/edit');
128
+ }
129
+
130
+ if ($this->getRequest()->isPost()) {
131
+ $referalCode = $_POST['businesslicensepath'];
132
+ if($referalCode!='')
133
+ {
134
+ $cust = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('customeridentifier1', array($referalCode))->getData();//print_r($cust);exit;
135
+ if(count($cust)==0)
136
+ {
137
+ $this->_getSession()->addError($this->__('Invalid referal code'));
138
+ $this->_redirect('*/*/edit');
139
+ return;
140
+ }
141
+ }
142
+ /** @var $customer Mage_Customer_Model_Customer */
143
+ $customer = $this->_getSession()->getCustomer();
144
+
145
+ /** @var $customerForm Mage_Customer_Model_Form */
146
+ $customerForm = Mage::getModel('customer/form');
147
+ $customerForm->setFormCode('customer_account_edit')
148
+ ->setEntity($customer);
149
+
150
+ $customerData = $customerForm->extractData($this->getRequest());
151
+
152
+ $errors = array();
153
+ $customerErrors = $customerForm->validateData($customerData);
154
+ if ($customerErrors !== true) {
155
+ $errors = array_merge($customerErrors, $errors);
156
+ } else {
157
+ $customerForm->compactData($customerData);
158
+ $errors = array();
159
+
160
+ // If password change was requested then add it to common validation scheme
161
+ if ($this->getRequest()->getParam('change_password')) {
162
+ $currPass = $this->getRequest()->getPost('current_password');
163
+ $newPass = $this->getRequest()->getPost('password');
164
+ $confPass = $this->getRequest()->getPost('confirmation');
165
+
166
+ $oldPass = $this->_getSession()->getCustomer()->getPasswordHash();
167
+ if (Mage::helper('core/string')->strpos($oldPass, ':')) {
168
+ list($_salt, $salt) = explode(':', $oldPass);
169
+ } else {
170
+ $salt = false;
171
+ }
172
+
173
+ if ($customer->hashPassword($currPass, $salt) == $oldPass) {
174
+ if (strlen($newPass)) {
175
+ /**
176
+ * Set entered password and its confirmation - they
177
+ * will be validated later to match each other and be of right length
178
+ */
179
+ $customer->setPassword($newPass);
180
+ $customer->setConfirmation($confPass);
181
+ } else {
182
+ $errors[] = $this->__('New password field cannot be empty.');
183
+ }
184
+ } else {
185
+ $errors[] = $this->__('Invalid current password');
186
+ }
187
+ }
188
+
189
+ // Validate account and compose list of errors if any
190
+ $customerErrors = $customer->validate();
191
+ if (is_array($customerErrors)) {
192
+ $errors = array_merge($errors, $customerErrors);
193
+ }
194
+ }
195
+
196
+ if (!empty($errors)) {
197
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
198
+ foreach ($errors as $message) {
199
+ $this->_getSession()->addError($message);
200
+ }
201
+ $this->_redirect('*/*/edit');
202
+ return $this;
203
+ }
204
+
205
+ try {
206
+ $customer->setConfirmation(null);
207
+ $customer->save();
208
+ $this->_getSession()->setCustomer($customer)
209
+ ->addSuccess($this->__('The account information has been saved.'));
210
+
211
+ $this->_redirect('customer/account');
212
+ return;
213
+ } catch (Mage_Core_Exception $e) {
214
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
215
+ ->addError($e->getMessage());
216
+ } catch (Exception $e) {
217
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost())
218
+ ->addException($e, $this->__('Cannot save the customer.'));
219
+ }
220
+ }
221
+
222
+ $this->_redirect('*/*/edit');
223
+ }
224
+ public function createPostAction()
225
+ {
226
+ $session = $this->_getSession();
227
+ if ($session->isLoggedIn()) {
228
+ $this->_redirect('*/*/');
229
+ return;
230
+ }
231
+ $session->setEscapeMessages(true); // prevent XSS injection in user input
232
+ if ($this->getRequest()->isPost()) {
233
+ $referalCode = $_POST['businesslicensepath'];
234
+ if($referalCode!='')
235
+ {
236
+ $cust = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('customeridentifier1', array($referalCode))->getData();//print_r($cust);exit;
237
+ if(count($cust)==0)
238
+ {
239
+ $session->addError($this->__('Invalid referal code'));
240
+ $this->_redirect('*/*/create');
241
+ return;
242
+ }
243
+ }
244
+
245
+ $errors = array();
246
+
247
+ if (!$customer = Mage::registry('current_customer')) {
248
+ $customer = Mage::getModel('customer/customer')->setId(null);
249
+ }
250
+
251
+ /* @var $customerForm Mage_Customer_Model_Form */
252
+ $customerForm = Mage::getModel('customer/form');
253
+ $customerForm->setFormCode('customer_account_create')
254
+ ->setEntity($customer);
255
+
256
+ $customerData = $customerForm->extractData($this->getRequest());
257
+
258
+ if ($this->getRequest()->getParam('is_subscribed', false)) {
259
+ $customer->setIsSubscribed(1);
260
+ }
261
+
262
+ /**
263
+ * Initialize customer group id
264
+ */
265
+ $customer->getGroupId();
266
+
267
+ if ($this->getRequest()->getPost('create_address')) {
268
+ /* @var $address Mage_Customer_Model_Address */
269
+ $address = Mage::getModel('customer/address');
270
+ /* @var $addressForm Mage_Customer_Model_Form */
271
+ $addressForm = Mage::getModel('customer/form');
272
+ $addressForm->setFormCode('customer_register_address')
273
+ ->setEntity($address);
274
+
275
+ $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
276
+ $addressErrors = $addressForm->validateData($addressData);
277
+ if ($addressErrors === true) {
278
+ $address->setId(null)
279
+ ->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))
280
+ ->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
281
+ $addressForm->compactData($addressData);
282
+ $customer->addAddress($address);
283
+
284
+ $addressErrors = $address->validate();
285
+ if (is_array($addressErrors)) {
286
+ $errors = array_merge($errors, $addressErrors);
287
+ }
288
+ } else {
289
+ $errors = array_merge($errors, $addressErrors);
290
+ }
291
+ }
292
+
293
+ try {
294
+ $customerErrors = $customerForm->validateData($customerData);
295
+ if ($customerErrors !== true) {
296
+ $errors = array_merge($customerErrors, $errors);
297
+ } else {
298
+ $customerForm->compactData($customerData);
299
+ $customer->setPassword($this->getRequest()->getPost('password'));
300
+ $customer->setConfirmation($this->getRequest()->getPost('confirmation'));
301
+ $customerErrors = $customer->validate();
302
+ if (is_array($customerErrors)) {
303
+ $errors = array_merge($customerErrors, $errors);
304
+ }
305
+ }
306
+
307
+ $validationResult = count($errors) == 0;
308
+
309
+ if (true === $validationResult) {
310
+ $customer->save();
311
+
312
+ Mage::dispatchEvent('customer_register_success',
313
+ array('account_controller' => $this, 'customer' => $customer)
314
+ );
315
+
316
+ if ($customer->isConfirmationRequired()) {
317
+ $customer->sendNewAccountEmail(
318
+ 'confirmation',
319
+ $session->getBeforeAuthUrl(),
320
+ Mage::app()->getStore()->getId()
321
+ );
322
+ $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())));
323
+ $this->_redirectSuccess(Mage::getUrl('*/*/index', array('_secure'=>true)));
324
+ return;
325
+ } else {
326
+ $session->setCustomerAsLoggedIn($customer);
327
+ $url = $this->_welcomeCustomer($customer);
328
+ $this->_redirectSuccess($url);
329
+ return;
330
+ }
331
+ } else {
332
+ $session->setCustomerFormData($this->getRequest()->getPost());
333
+ if (is_array($errors)) {
334
+ foreach ($errors as $errorMessage) {
335
+ $session->addError($errorMessage);
336
+ }
337
+ } else {
338
+ $session->addError($this->__('Invalid customer data'));
339
+ }
340
+ }
341
+ } catch (Mage_Core_Exception $e) {
342
+ $session->setCustomerFormData($this->getRequest()->getPost());
343
+ if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
344
+ $url = Mage::getUrl('customer/account/forgotpassword');
345
+ $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
346
+ $session->setEscapeMessages(false);
347
+ } else {
348
+ $message = $e->getMessage();
349
+ }
350
+ $session->addError($message);
351
+ } catch (Exception $e) {
352
+ $session->setCustomerFormData($this->getRequest()->getPost())
353
+ ->addException($e, $this->__('Cannot save the customer.'));
354
+ }
355
+
356
+ }
357
+
358
+ $this->_redirectError(Mage::getUrl('*/*/create', array('_secure' => true)));
359
+ }
360
+
361
+ }
app/code/local/Medma/Reward/controllers/Adminhtml/CustomerController.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Adminhtml/controllers/CustomerController.php';
3
+ class Medma_Reward_Adminhtml_CustomerController extends Mage_Adminhtml_CustomerController
4
+ {
5
+ public function sendemailAction()
6
+ {
7
+ $customerId = $this->getRequest()->getParam('customerId');
8
+ $cust = Mage::getModel('customer/customer')->load($customerId, 'entity_id');//print_r($cust);
9
+ $custAttr = Mage::getModel('customer/customer')->load($customerId)->getData();//print_r($custAttr);exit;
10
+ $custUniqueCode = $custAttr['customeridentifier1'];
11
+ $discountCode = $custAttr['discountcode1'];
12
+ $email = $custAttr['email'];
13
+ if($custUniqueCode!='' && $discountCode!='')
14
+ {
15
+ // MAIL WOULD BE SEND TO CUSTOMER
16
+ $message = "<table align='center' cellpadding='0' cellspacing='0' border='0' style='border:1px solid #bababa;width:800px;background-color:#eeeeee'>
17
+ <tr>
18
+ <td align='center' width='100%'>
19
+ <table align='center' cellpadding='0' cellspacing='0' border='0' width='100%'>
20
+ <tr>
21
+ <td colspan='3' style='padding-left: 30px;'>
22
+ <table align='left' cellpadding='0' cellspacing='0' border='0' width='100%'>
23
+ <tr><td height='15px;'></td></tr>
24
+ <tr>
25
+ <td align='left' style='font-size:14px;font-family:Arial;'> Hello <b>".$nickName.",</b></td>
26
+ </tr>
27
+ <tr><td height='10px;'></td></tr>
28
+ <tr>
29
+ <td align='left' style='font-size:14px;font-family:Arial;'>Rewards/Referral Code is:</td>
30
+ </tr>
31
+ <tr><td height='10px;'></td></tr>
32
+ <tr>
33
+ <td align='left' style='font-size:14px;font-family:Arial;'>
34
+ </tr>
35
+ <tr><td height='5px;'></td></tr>
36
+ <tr>
37
+ <td align='left' style='font-size:14px;font-family:Arial;'><strong>Customer Unique Code:</strong> ".$custUniqueCode."</td>
38
+ </tr>
39
+ <tr><td height='5px;'></td></tr>
40
+ <tr>
41
+ <td align='left' style='font-size:14px;font-family:Arial;'><strong>Discount Code:</strong> ".$discountCode."</td>
42
+ </tr>
43
+ <tr><td height='30px;'></td></tr>
44
+ <tr>
45
+ <td align='left' style='font-size:14px;font-family:Arial;font-weight:bold'>Best Regards,</td>
46
+ </tr>
47
+ <tr><td height='5px;'></td></tr>
48
+ <tr>
49
+ <td align='left' style='font-size:14px;font-family:Arial;'>Rewards Team</td>
50
+ </tr>
51
+ </table>
52
+ </td>
53
+ </tr>
54
+ <tr><td height='50px;'></td></tr>
55
+ </table>
56
+ </td>
57
+ </tr>
58
+ </table>";
59
+ //echo $message;exit;
60
+
61
+ $subject = 'Customer Unique Code & Discount Code';
62
+ $to = $email;
63
+ $from_email = Mage::getStoreConfig('trans_email/ident_general/email');
64
+
65
+ $header ="MIME-Version: 1.0"."\r\n";
66
+ $header.="Content-type: text/html; charset=iso-8859-1"."\r\n";
67
+ $header.="From: Rewards <".$from_email.">"."\r\n";
68
+
69
+ mail($to,$subject,$message,$header);
70
+
71
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('reward')->__('Customer Unique Code and Discount Code sended successfully'));
72
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
73
+
74
+ $this->_redirectReferer('*/*/');
75
+ }
76
+ else
77
+ {
78
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('reward')->__('Customer Unique Code and Discount Code could not be sended'));
79
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
80
+
81
+ $this->_redirectReferer('*/*/');
82
+ }
83
+
84
+ }
85
+
86
+ }
87
+
app/code/local/Medma/Reward/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <reward translate="title">
15
+ <title>Reward Section</title>
16
+ <sort_order>100</sort_order>
17
+ </reward>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/local/Medma/Reward/etc/config.xml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Medma_Reward>
5
+ <version>0.2.1</version>
6
+ </Medma_Reward>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <reward>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Medma_Reward</module>
14
+ <frontName>reward</frontName>
15
+ </args>
16
+ </reward>
17
+ <customer>
18
+ <args>
19
+ <modules>
20
+ <medma_reward before="Mage_Customer">Medma_Reward</medma_reward>
21
+ </modules>
22
+ </args>
23
+ </customer>
24
+ </routers>
25
+ <layout>
26
+ <updates>
27
+ <reward>
28
+ <file>reward.xml</file>
29
+ </reward>
30
+ </updates>
31
+ </layout>
32
+ <events>
33
+ <checkout_submit_all_after>
34
+ <observers>
35
+ <Medma_Reward_Model_Observer>
36
+ <type>singleton</type>
37
+ <class>Medma_Reward_Model_Observer</class>
38
+ <method>sendRedeemedAmount</method>
39
+ </Medma_Reward_Model_Observer>
40
+ </observers>
41
+ </checkout_submit_all_after>
42
+ </events>
43
+ </frontend>
44
+ <admin>
45
+ <routers>
46
+ <!--<reward>
47
+ <use>admin</use>
48
+ <args>
49
+ <module>Medma_Reward</module>
50
+ <frontName>reward</frontName>
51
+ </args>
52
+ </reward>-->
53
+ <adminhtml>
54
+ <args>
55
+ <modules>
56
+ <medma_reward before="Mage_Adminhtml">Medma_Reward_Adminhtml</medma_reward>
57
+ </modules>
58
+ </args>
59
+ </adminhtml>
60
+ </routers>
61
+ </admin>
62
+ <adminhtml>
63
+
64
+ <layout>
65
+ <updates>
66
+ <reward>
67
+ <file>reward.xml</file>
68
+ </reward>
69
+ </updates>
70
+ </layout>
71
+ </adminhtml>
72
+ <global>
73
+ <models>
74
+ <reward>
75
+ <class>Medma_Reward_Model</class>
76
+ <resourceModel>reward_mysql4</resourceModel>
77
+ </reward>
78
+ <reward_mysql4>
79
+ <class>Medma_Reward_Model_Mysql4</class>
80
+ <entities>
81
+ <reward>
82
+ <table>customer_redemption</table>
83
+ </reward>
84
+ <redemptpayment>
85
+ <table>redemption_payment</table>
86
+ </redemptpayment>
87
+ </entities>
88
+ </reward_mysql4>
89
+ </models>
90
+ <resources>
91
+ <reward_setup>
92
+ <setup>
93
+ <module>Medma_Reward</module>
94
+ </setup>
95
+ <connection>
96
+ <use>core_setup</use>
97
+ </connection>
98
+ </reward_setup>
99
+ <reward_write>
100
+ <connection>
101
+ <use>core_write</use>
102
+ </connection>
103
+ </reward_write>
104
+ <reward_read>
105
+ <connection>
106
+ <use>core_read</use>
107
+ </connection>
108
+ </reward_read>
109
+ </resources>
110
+ <blocks>
111
+ <adminhtml>
112
+ <rewrite>
113
+ <customer_edit>Medma_Reward_Block_Adminhtml_Customer_Edit</customer_edit>
114
+ </rewrite>
115
+ </adminhtml>
116
+ <reward>
117
+ <class>Medma_Reward_Block</class>
118
+ </reward>
119
+ </blocks>
120
+ <helpers>
121
+ <reward>
122
+ <class>Medma_Reward_Helper</class>
123
+ </reward>
124
+ </helpers>
125
+ </global>
126
+ </config>
app/code/local/Medma/Reward/etc/system.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <reward translate="label">
5
+ <label>Credit Settings</label>
6
+ <sort_order>1500</sort_order>
7
+ </reward>
8
+ </tabs>
9
+ <sections>
10
+ <reward translate="label">
11
+ <label>Credit Settings</label>
12
+ <tab>reward</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <!-- New groups go here -->
19
+ <reward translate="label">
20
+ <label>Credit Settings</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>100</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
+
28
+ <credit>
29
+ <label>Credit</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>11</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
+ </credit>
36
+ </fields>
37
+ </reward>
38
+ </groups>
39
+ </reward>
40
+ </sections>
41
+ </config>
app/code/local/Medma/Reward/sql/reward_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+ $setup = Mage::getModel('customer/entity_setup', 'core_setup');
7
+
8
+ $setup->addAttribute('customer', 'discountcode1', array(
9
+ 'type' => 'text',
10
+ 'input' => 'text',
11
+ 'label' => 'Discount Code',
12
+ 'global' => 1,
13
+ 'visible' => 1,
14
+ 'required' => 0,
15
+ 'user_defined' => 1,
16
+ 'default' => '0',
17
+ 'visible_on_front' => 1,
18
+ 'source'=> 'profile/entity_discountcode1',
19
+ ));
20
+ if (version_compare(Mage::getVersion(), '1.6.0', '<='))
21
+ {
22
+ $customer = Mage::getModel('customer/customer');
23
+ $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
24
+ $setup->addAttributeToSet('customer', $attrSetId, 'General', 'discountcode1');
25
+ }
26
+ if (version_compare(Mage::getVersion(), '1.4.2', '>='))
27
+ {
28
+ Mage::getSingleton('eav/config')
29
+ ->getAttribute('customer', 'discountcode1')
30
+ ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
31
+ ->save();
32
+ }
33
+ $installer->run("
34
+
35
+
36
+
37
+ ");
38
+
39
+ $installer->endSetup();
app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $setup = Mage::getModel('customer/entity_setup', 'core_setup');
8
+
9
+ $setup->addAttribute('customer', 'customeridentifier1', array(
10
+ 'type' => 'text',
11
+ 'input' => 'text',
12
+ 'label' => 'Customer Unique Code',
13
+ 'global' => 1,
14
+ 'visible' => 1,
15
+ 'required' => 0,
16
+ 'user_defined' => 1,
17
+ 'default' => '0',
18
+ 'visible_on_front' => 1,
19
+ 'source'=> 'profile/entity_customeridentifier1',
20
+ ));
21
+ if (version_compare(Mage::getVersion(), '1.6.0', '<='))
22
+ {
23
+ $customer = Mage::getModel('customer/customer');
24
+ $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
25
+ $setup->addAttributeToSet('customer', $attrSetId, 'General', 'customeridentifier1');
26
+ }
27
+ if (version_compare(Mage::getVersion(), '1.4.2', '>='))
28
+ {
29
+ Mage::getSingleton('eav/config')
30
+ ->getAttribute('customer', 'customeridentifier1')
31
+ ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
32
+ ->save();
33
+ }
34
+
35
+ $installer->endSetup();
app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.1.9-0.2.0.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $setup = Mage::getModel('customer/entity_setup', 'core_setup');
8
+
9
+ /***********************remove attribute*******************/
10
+
11
+
12
+ // below code will add text attribute
13
+ //$setup->removeAttribute('customer', 'businesslicensepath');
14
+
15
+ $setup->addAttribute('customer', 'businesslicensepath', array(
16
+ 'type' => 'text',
17
+ 'input' => 'text',
18
+ 'label' => 'Referal Code',
19
+ 'global' => 1,
20
+ 'visible' => 1,
21
+ 'required' => 0,
22
+ 'user_defined' => 1,
23
+ 'default' => '0',
24
+ 'visible_on_front' => 1,
25
+ 'source'=> 'profile/entity_businesslicensepath',
26
+ ));
27
+ if (version_compare(Mage::getVersion(), '1.6.0', '<='))
28
+ {
29
+ $customer = Mage::getModel('customer/customer');
30
+ $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
31
+ $setup->addAttributeToSet('customer', $attrSetId, 'General', 'businesslicensepath');
32
+ }
33
+ if (version_compare(Mage::getVersion(), '1.4.2', '>='))
34
+ {
35
+ Mage::getSingleton('eav/config')
36
+ ->getAttribute('customer', 'businesslicensepath')
37
+ ->setData('used_in_forms', array('adminhtml_customer','customer_account_create','customer_account_edit','checkout_register'))
38
+ ->save();
39
+ }
40
+
41
+ $installer->endSetup();
app/code/local/Medma/Reward/sql/reward_setup/mysql4-upgrade-0.2.0-0.2.1.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('reward/reward')};
10
+ CREATE TABLE {$this->getTable('reward/reward')} (
11
+ `redemptionpayment_id` int(11) unsigned NOT NULL auto_increment,
12
+ `customer_id` int(11) NOT NULL,
13
+ `redemption_amount` decimal(6,3),
14
+ `bank_name` varchar(255) NOT NULL default '',
15
+ `bank_address` varchar(255) NOT NULL default '',
16
+ `claim_request` varchar(50) NOT NULL default '',
17
+ `customer_account` varchar(150) NOT NULL default '',
18
+ `redemption_time` datetime NULL,
19
+ PRIMARY KEY (`redemptionpayment_id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+
22
+ CREATE TABLE IF NOT EXISTS {$this->getTable('reward/redemptpayment')} (
23
+ `id` int(11) NOT NULL AUTO_INCREMENT,
24
+ `customer_id` int(11) NOT NULL,
25
+ `redemption_amount` decimal(9,3) DEFAULT NULL,
26
+ PRIMARY KEY (`id`)
27
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
28
+
29
+ ");
30
+
31
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/reward.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_customer_edit>
4
+ <reference name="customer_edit_tabs">
5
+ <action method="addTab"><name>customer_edit_tab_action</name><block>reward/adminhtml_customer_edit_tab_action</block></action>
6
+ </reference>
7
+ </adminhtml_customer_edit>
8
+ </layout>
app/design/adminhtml/default/default/template/reward/action.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $customerId = $this->getRequest()->getParam('id');
3
+
4
+ $model = Mage::getModel('reward/reward');
5
+ $model = $model->getCollection()
6
+ ->addFieldToFilter('customer_id',array($customerId))
7
+ ->getData();
8
+
9
+ $redemptionAmount = 0;
10
+ for($q=0;$q<count($model);$q++)
11
+ {
12
+ $redemptionAmount += $model[$q]['redemption_amount'];
13
+ }
14
+ ?>
15
+ <div id="customer_info_tabs_customer_edit_tab_action_content">
16
+ <div class="entry-edit">
17
+ <div class="entry-edit-head">
18
+ <h4 class="icon-head head-edit-form fieldset-legend">Redemption Amount</h4>
19
+ </div>
20
+ <div id="group_fields4" class="fieldset fieldset-wide">
21
+ <div class="hor-scroll">
22
+ <table class="form-list" cellspacing="0">
23
+ <tbody>
24
+ <tr>
25
+ <td class="label"><?php echo $this->__('Redemption Price')?></td>
26
+ <td class="value"><input type="text" class="input-text" id="redemption_id" name="redemption_id" value="<?php echo $redemptionAmount;?>" /></td>
27
+ </tr>
28
+ </tbody>
29
+ </table>
30
+
31
+ </div>
32
+ </div>
33
+ </div>
34
+ </div>
app/design/frontend/default/default/layout/reward.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <layout version="0.1.0">
2
+ <!--<customer_account_create translate="label">
3
+ <reference name="content">
4
+ <block type="customer/form_register" name="customer_form_register" template="reward/form/register.phtml"/>
5
+ </reference>
6
+ </customer_account_create>-->
7
+ <customer_account_create>
8
+ <reference name="customer_form_register">
9
+ <action method="setTemplate"><template>reward/form/register.phtml</template></action>
10
+ </reference>
11
+ </customer_account_create>
12
+ <customer_account>
13
+ <reference name="customer_account_navigation">
14
+ <action method="addLink" translate="label" module="customer"><name>account_redemption</name><path>customer/account/redemption/</path><label>Redemption Information</label></action>
15
+ </reference>
16
+ </customer_account>
17
+ <customer_account_redemption translate="label">
18
+ <label>Customer Account Redemption Form</label>
19
+ <update handle="customer_account"/>
20
+ <reference name="my.account.wrapper">
21
+ <block type="core/template" name="customer_redemption" template="reward/form/redemption.phtml"/>
22
+ </reference>
23
+ <reference name="left">
24
+ <action method="unsetChild"><name>left.permanent.callout</name></action>
25
+ </reference>
26
+ </customer_account_redemption>
27
+ <customer_account_edit>
28
+ <reference name="my.account.wrapper">
29
+ <block type="customer/form_edit" name="customer_edit" template="reward/form/edit.phtml"/>
30
+ </reference>
31
+ </customer_account_edit>
32
+ </layout>
app/design/frontend/default/default/template/reward/form/edit.phtml ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ ?>
28
+ <div class="page-title">
29
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
30
+ </div>
31
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
32
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
33
+ <div class="fieldset">
34
+ <?php echo $this->getBlockHtml('formkey')?>
35
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
36
+ <ul class="form-list">
37
+ <li class="fields">
38
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
39
+ </li>
40
+ <li>
41
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
42
+ <div class="input-box">
43
+ <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
44
+ </div>
45
+ </li>
46
+ <li>
47
+ <label for="email"><?php echo $this->__('Referal Code') ?></label>
48
+ <div class="input-box">
49
+ <input type="text" name="businesslicensepath" id="businesslicensepath" value="<?php echo $this->htmlEscape($this->getCustomer()->getBusinesslicensepath()) ?>" title="<?php echo $this->__('Referal Code') ?>" class="input-text" />
50
+ </div>
51
+ </li>
52
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
53
+ <?php if ($_dob->isEnabled()): ?>
54
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
55
+ <?php endif ?>
56
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
57
+ <?php if ($_taxvat->isEnabled()): ?>
58
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
59
+ <?php endif ?>
60
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
61
+ <?php if ($_gender->isEnabled()): ?>
62
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
63
+ <?php endif ?>
64
+ <li class="control">
65
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('Change Password') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
66
+ </li>
67
+ </ul>
68
+ </div>
69
+ <div class="fieldset" style="display:none;">
70
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
71
+ <ul class="form-list">
72
+ <li>
73
+ <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
74
+ <div class="input-box">
75
+ <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" />
76
+ </div>
77
+ </li>
78
+ <li class="fields">
79
+ <div class="field">
80
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
81
+ <div class="input-box">
82
+ <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" />
83
+ </div>
84
+ </div>
85
+ <div class="field">
86
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
87
+ <div class="input-box">
88
+ <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
89
+ </div>
90
+ </div>
91
+ </li>
92
+ </ul>
93
+ </div>
94
+ <div class="buttons-set">
95
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
96
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
97
+ <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
98
+ </div>
99
+ </form>
100
+ <script type="text/javascript">
101
+ //<![CDATA[
102
+ var dataForm = new VarienForm('form-validate', true);
103
+ function setPasswordForm(arg){
104
+ if(arg){
105
+ $('current_password').up(3).show();
106
+ $('current_password').addClassName('required-entry');
107
+ $('password').addClassName('required-entry');
108
+ $('confirmation').addClassName('required-entry');
109
+
110
+ }else{
111
+ $('current_password').up(3).hide();
112
+ $('current_password').removeClassName('required-entry');
113
+ $('password').removeClassName('required-entry');
114
+ $('confirmation').removeClassName('required-entry');
115
+ }
116
+ }
117
+ <?php if($this->getCustomer()->getChangePassword()): ?>
118
+ setPasswordForm(true);
119
+ <?php endif; ?>
120
+ //]]>
121
+ </script>
app/design/frontend/default/default/template/reward/form/redemption.phtml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+
27
+ $customerId = Mage::getSingleton('customer/session')->getId();
28
+ $customerDetails= Mage::getSingleton('customer/session')->getCustomer()->getData();
29
+ $customerFirstName = $customerDetails['firstname'];
30
+ $customerLastName = $customerDetails['lastname'];
31
+ $customerName = $customerFirstName.' '.$customerLastName;
32
+ $customerUniqueId = $customerDetails['customeridentifier1'];
33
+ $model = Mage::getModel('reward/reward');
34
+ $model = $model->getCollection()
35
+ ->addFieldToFilter('customer_id',array($customerId))
36
+ ->getData();
37
+ $redemptionAmount = 0;
38
+ for($q=0;$q<count($model);$q++)
39
+ {
40
+ $redemptionAmount += $model[$q]['redemption_amount'];
41
+ }
42
+ $modelRedempt = Mage::getModel('reward/reward');
43
+ $modelRedempt = $modelRedempt->getCollection()
44
+ ->addFieldToFilter('customer_id',array($customerId))
45
+ ->getData();
46
+ $redemptionRow = count($modelRedempt);
47
+ $storeCurrency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
48
+
49
+ ?>
50
+ <div class="page-title">
51
+ <h1><?php echo $this->__('Redemption Account Information') ?></h1>
52
+ </div>
53
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
54
+ <form action="<?php echo $this->getUrl('customer/account/redemptionPost') ?>" method="post" id="form-validate">
55
+ <div class="fieldset">
56
+ <?php echo $this->getBlockHtml('formkey')?>
57
+ <h2 class="legend"><?php echo $this->__('Redemption Information') ?></h2>
58
+ <ul class="form-list">
59
+ <li>
60
+ <label for="email"><?php echo $this->__('Redemption Amount: '.$storeCurrency.''.$redemptionAmount) ?></label>
61
+ <div class="input-box">
62
+
63
+ </div>
64
+ </li>
65
+ </ul>
66
+ </div>
67
+ <?php if($redemptionRow>0){?>
68
+ <div class="fieldset">
69
+ <?php echo $this->getBlockHtml('formkey')?>
70
+ <h2 class="legend"><?php echo $this->__('Redemption Request Submitted') ?></h2>
71
+ <ul class="form-list">
72
+ <li>
73
+ <label for="email"><?php echo $this->__('Redemption request has been sent to admin') ?></label>
74
+ <div class="input-box">
75
+
76
+ </div>
77
+ </li>
78
+ </ul>
79
+ </div>
80
+ <?php } else {?>
81
+ <div class="fieldset">
82
+ <?php echo $this->getBlockHtml('formkey')?>
83
+ <h2 class="legend"><?php echo $this->__('Redemption Form') ?></h2>
84
+ <ul class="form-list">
85
+ <li>
86
+ <label for="bank_name" class="required"><em>*</em><?php echo $this->__('Name') ?></label>
87
+ <div class="input-box">
88
+ <input type="text" name="bank_name" id="bank_name" value="<?php echo $customerName;?>" title="<?php echo $this->__('Name') ?>" class="input-text required-entry" />
89
+ </div>
90
+ </li>
91
+ <li>
92
+ <label for="bank_address" class="required"><em>*</em><?php echo $this->__('Unique Code') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" name="account_no" id="account_no" value="<?php echo $customerUniqueId;?>" title="<?php echo $this->__('Unique Code') ?>" class="input-text" />
95
+ </div>
96
+ </li>
97
+
98
+ <li>
99
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Redemption Amount') ?></label>
100
+ <div class="input-box">
101
+ <input type="text" name="redemption_amount" id="redemption_amount" value="<?php echo $redemptionAmount;?>" title="<?php echo $this->__('Redemption Amount') ?>" class="input-text" readonly="true" />
102
+ </div>
103
+ </li>
104
+ </ul>
105
+ </div>
106
+ <div class="buttons-set">
107
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
108
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
109
+ <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
110
+ </div>
111
+ <?php }?>
112
+
113
+ </form>
app/design/frontend/default/default/template/reward/form/register.phtml ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/register.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Register */
34
+ ?>
35
+ <div class="account-create">
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Create an Account') ?></h1>
38
+ </div>
39
+ <?php echo $this->getChildHtml('form_fields_before')?>
40
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
41
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
42
+ <div class="fieldset">
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
46
+ <ul class="form-list">
47
+ <li class="fields">
48
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
49
+ </li>
50
+ <li>
51
+ <label for="referal_code"><?php echo $this->__('Referal Code') ?></label>
52
+ <div class="input-box">
53
+ <input type="text" name="businesslicensepath" id="businesslicensepath" value="<?php echo $this->escapeHtml($this->getFormData()->getBusinesslicensepath()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text" />
54
+ </div>
55
+ </li>
56
+ <li>
57
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
58
+ <div class="input-box">
59
+ <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
60
+ </div>
61
+ </li>
62
+ <?php if ($this->isNewsletterEnabled()): ?>
63
+ <li class="control">
64
+ <div class="input-box">
65
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
66
+ </div>
67
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
68
+ </li>
69
+ <?php endif ?>
70
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
71
+ <?php if ($_dob->isEnabled()): ?>
72
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
73
+ <?php endif ?>
74
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
75
+ <?php if ($_taxvat->isEnabled()): ?>
76
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
77
+ <?php endif ?>
78
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
79
+ <?php if ($_gender->isEnabled()): ?>
80
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
81
+ <?php endif ?>
82
+ </ul>
83
+ </div>
84
+ <?php if($this->getShowAddressFields()): ?>
85
+ <div class="fieldset">
86
+ <input type="hidden" name="create_address" value="1" />
87
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
88
+ <ul class="form-list">
89
+ <li class="fields">
90
+ <div class="field">
91
+ <label for="company"><?php echo $this->__('Company') ?></label>
92
+ <div class="input-box">
93
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
94
+ </div>
95
+ </div>
96
+ <div class="field">
97
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
100
+ </div>
101
+ </div>
102
+ </li>
103
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
104
+ <li class="wide">
105
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
106
+ <div class="input-box">
107
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
108
+ </div>
109
+ </li>
110
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
111
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
112
+ <li class="wide">
113
+ <div class="input-box">
114
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
115
+ </div>
116
+ </li>
117
+ <?php endfor; ?>
118
+ <li class="fields">
119
+ <div class="field">
120
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
121
+ <div class="input-box">
122
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
123
+ </div>
124
+ </div>
125
+ <div class="field">
126
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
127
+ <div class="input-box">
128
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
129
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
130
+ </select>
131
+ <script type="text/javascript">
132
+ //<![CDATA[
133
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
134
+ //]]>
135
+ </script>
136
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
137
+ </div>
138
+ </div>
139
+ </li>
140
+ <li class="fields">
141
+ <div class="field">
142
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
143
+ <div class="input-box">
144
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
145
+ </div>
146
+ </div>
147
+ <div class="field">
148
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
149
+ <div class="input-box">
150
+ <?php echo $this->getCountryHtmlSelect() ?>
151
+ </div>
152
+ </div>
153
+ </li>
154
+ </ul>
155
+ <input type="hidden" name="default_billing" value="1" />
156
+ <input type="hidden" name="default_shipping" value="1" />
157
+ </div>
158
+ <?php endif; ?>
159
+ <div class="fieldset">
160
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
161
+ <ul class="form-list">
162
+ <li class="fields">
163
+ <div class="field">
164
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
165
+ <div class="input-box">
166
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
167
+ </div>
168
+ </div>
169
+ <div class="field">
170
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
171
+ <div class="input-box">
172
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
173
+ </div>
174
+ </div>
175
+ </li>
176
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
177
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
178
+ </ul>
179
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
180
+ </div>
181
+ <div class="buttons-set">
182
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
183
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
184
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
185
+ </div>
186
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
187
+ <input name="context" type="hidden" value="checkout" />
188
+ <?php endif; ?>
189
+ </form>
190
+ <script type="text/javascript">
191
+ //<![CDATA[
192
+ var dataForm = new VarienForm('form-validate', true);
193
+ <?php if($this->getShowAddressFields()): ?>
194
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
195
+ <?php endif; ?>
196
+ //]]>
197
+ </script>
198
+ </div>
app/etc/modules/Medma_Reward.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Medma_Reward>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Medma_Reward>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Medma_Reward_Referral</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension provides reward feature to be included for customers.</summary>
10
+ <description>This extension provides reward feature to be included for customers.</description>
11
+ <notes>This is a stable version</notes>
12
+ <authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
13
+ <date>2012-09-25</date>
14
+ <time>11:34:39</time>
15
+ <contents><target name="magelocal"><dir name="Medma"><dir name="Reward"><dir name="Block"><dir name="Adminhtml"><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Action.php" hash="2181fe64be6fa281bd9de57846491ad3"/></dir></dir><file name="Edit.php" hash="ce306a8d9a923b49ad93ad17b735020a"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="d55caff5bb37f1ac3a285bb62461cec3"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Redemptpayment"><file name="Collection.php" hash="80d4fc648c8dccc355b0eae9ef6989b8"/></dir><file name="Redemptpayment.php" hash="b6604e2ebbd273b0bac6e53679bad5b4"/><dir name="Reward"><file name="Collection.php" hash="fbcfd1204a45a1df7ab639d7a29d537b"/></dir><file name="Reward.php" hash="6073233455c20d644a5ac4a3a86a34ba"/></dir><file name="Observer.php" hash="c5c0a2ee9d42d4c8cfc8537ec2d26fca"/><file name="Redemptpayment.php" hash="15c05eadd004cb38f06e7a722493bde5"/><file name="Reward.php" hash="9a54a47ba130cc3d9a2d53ffc6773872"/></dir><dir name="controllers"><file name="AccountController.php" hash="87f47ac8b04ff6577bd2b690dd237f20"/><dir name="Adminhtml"><file name="CustomerController.php" hash="8bca658c2dd041fa576b4e531325005b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="7e343c10ae4631b468da46f33d493563"/><file name="config.xml" hash="2a1a189a759df2eccf75af6cff86ef4d"/><file name="system.xml" hash="d07b4e11a5b379246d943e2eb32f6eef"/></dir><dir name="sql"><dir name="reward_setup"><file name="mysql4-install-0.1.0.php" hash="45479d9da2e758a3483755bed684b53a"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="e9c2132f14d8564abf27bf9a703cf102"/><file name="mysql4-upgrade-0.1.9-0.2.0.php" hash="d286c223beb48cec0f4685213f4e665c"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="91b101a45354fce10a2f04b9e094c4d5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Medma_Reward.xml" hash="1ff85a15dfccb65fec1031083202a9b1"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="reward.xml" hash="399314ccef290da60c4139e4656d5d33"/></dir><dir name="template"><dir name="reward"><file name="action.phtml" hash="633aa761542c7767cd94f00923129d3b"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="reward.xml" hash="edb7e111b05485e8ab9b14a3a0a38d0a"/></dir><dir name="template"><dir name="reward"><dir name="form"><file name="edit.phtml" hash="1101cb76115ab62afec6e835020194ba"/><file name="redemption.phtml" hash="14f10b5d06e993cb65fecca290ccee8c"/><file name="register.phtml" hash="575734d892c56e8307bca328cc9cd183"/></dir></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>