commodity_promotion_solution - Version 1.3.0

Version Notes

Customer can subscribe for product price cut and stock available notification which they very interested

Download this release

Release Info

Developer iifire
Extension commodity_promotion_solution
Version 1.3.0
Comparing to
See all releases


Version 1.3.0

Files changed (72) hide show
  1. app/code/community/Iifire/Cps/Block/Account.php +53 -0
  2. app/code/community/Iifire/Cps/Block/Account/Draw.php +38 -0
  3. app/code/community/Iifire/Cps/Block/Account/Draw/History.php +136 -0
  4. app/code/community/Iifire/Cps/Block/Account/Draw/New.php +25 -0
  5. app/code/community/Iifire/Cps/Block/Account/Filter.php +99 -0
  6. app/code/community/Iifire/Cps/Block/Account/History.php +44 -0
  7. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps.php +24 -0
  8. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Export.php +104 -0
  9. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid.php +131 -0
  10. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid/Renderer/Action.php +20 -0
  11. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid/Renderer/Commission.php +13 -0
  12. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw.php +26 -0
  13. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Export.php +114 -0
  14. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Grid.php +121 -0
  15. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Grid/Renderer/Action.php +20 -0
  16. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log.php +26 -0
  17. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log/Export.php +75 -0
  18. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log/Grid.php +101 -0
  19. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner.php +27 -0
  20. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Edit.php +74 -0
  21. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Edit/Form.php +80 -0
  22. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Export.php +98 -0
  23. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Grid.php +144 -0
  24. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Grid/Renderer/Commission.php +13 -0
  25. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/New.php +74 -0
  26. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/New/Form.php +103 -0
  27. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report.php +26 -0
  28. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report/Export.php +50 -0
  29. app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report/Grid.php +66 -0
  30. app/code/community/Iifire/Cps/Helper/Data.php +128 -0
  31. app/code/community/Iifire/Cps/Model/Cps.php +50 -0
  32. app/code/community/Iifire/Cps/Model/Draw.php +46 -0
  33. app/code/community/Iifire/Cps/Model/Log.php +13 -0
  34. app/code/community/Iifire/Cps/Model/Mysql4/Cps.php +21 -0
  35. app/code/community/Iifire/Cps/Model/Mysql4/Cps/Collection.php +13 -0
  36. app/code/community/Iifire/Cps/Model/Mysql4/Draw.php +21 -0
  37. app/code/community/Iifire/Cps/Model/Mysql4/Draw/Collection.php +8 -0
  38. app/code/community/Iifire/Cps/Model/Mysql4/Log.php +22 -0
  39. app/code/community/Iifire/Cps/Model/Mysql4/Log/Collection.php +13 -0
  40. app/code/community/Iifire/Cps/Model/Mysql4/Partner.php +22 -0
  41. app/code/community/Iifire/Cps/Model/Mysql4/Partner/Collection.php +13 -0
  42. app/code/community/Iifire/Cps/Model/Mysql4/Report.php +22 -0
  43. app/code/community/Iifire/Cps/Model/Mysql4/Report/Collection.php +13 -0
  44. app/code/community/Iifire/Cps/Model/Observer.php +40 -0
  45. app/code/community/Iifire/Cps/Model/Partner.php +14 -0
  46. app/code/community/Iifire/Cps/Model/Report.php +21 -0
  47. app/code/community/Iifire/Cps/Model/System/Status.php +18 -0
  48. app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/CpsController.php +164 -0
  49. app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/DrawController.php +115 -0
  50. app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/LogController.php +84 -0
  51. app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/PartnerController.php +107 -0
  52. app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/ReportController.php.bak +71 -0
  53. app/code/community/Iifire/Cps/controllers/DrawController.php +93 -0
  54. app/code/community/Iifire/Cps/controllers/IndexController.php +47 -0
  55. app/code/community/Iifire/Cps/controllers/PartnerController.php +41 -0
  56. app/code/community/Iifire/Cps/etc/adminhtml.xml +72 -0
  57. app/code/community/Iifire/Cps/etc/config.xml +144 -0
  58. app/code/community/Iifire/Cps/etc/system.xml +96 -0
  59. app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-install-1.0.0.php +60 -0
  60. app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.0.0-1.1.0.php +20 -0
  61. app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.1.0-1.2.0.php +20 -0
  62. app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.2.0-1.3.0.php +5 -0
  63. app/design/frontend/default/default/layout/iifire_cps.xml +81 -0
  64. app/design/frontend/default/default/template/iifire/cps/account/datefilter.phtml +80 -0
  65. app/design/frontend/default/default/template/iifire/cps/account/draw.phtml +53 -0
  66. app/design/frontend/default/default/template/iifire/cps/account/draw/form.phtml +38 -0
  67. app/design/frontend/default/default/template/iifire/cps/account/draw/history.phtml +72 -0
  68. app/design/frontend/default/default/template/iifire/cps/account/headline.phtml +18 -0
  69. app/design/frontend/default/default/template/iifire/cps/account/history.phtml +79 -0
  70. app/design/frontend/default/default/template/iifire/cps/account/index.phtml +74 -0
  71. app/etc/modules/Iifire_Cps.xml +19 -0
  72. package.xml +25 -0
app/code/community/Iifire/Cps/Block/Account.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iifire_Cps_Block_Account extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $duration = $this->getDuration();
10
+ $this->setTemplate('iifire/cps/account/index.phtml');
11
+ $cpsCollection = Mage::getResourceModel('iifire_cps/cps_collection')
12
+ ->addFieldToSelect('*')
13
+ ->addFieldToFilter('partner_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
14
+ ->addFieldToFilter('main_table.created_at',array('from'=>$duration['from'],'to'=>$duration['to']))
15
+ ->setOrder('created_at', 'desc');
16
+ $cpsCollection->getSelect()->joinLeft(
17
+ array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')),
18
+ 'main_table.order_id = order.entity_id',
19
+ array('grand_total','status','increment_id')
20
+ );
21
+ $statusArray = Mage::getSingleton('iifire_cps/cps')->getStatusArray();
22
+ if(is_array($statusArray) && count($statusArray)) {
23
+ $cpsCollection->addFieldToFilter('status',array('in'=>$statusArray));
24
+ }
25
+ $this->setCpsCollection($cpsCollection);
26
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('iifire_cps')->__('My CPS Account'));
27
+ }
28
+
29
+ protected function _prepareLayout()
30
+ {
31
+ parent::_prepareLayout();
32
+
33
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'cps.account.pager')
34
+ ->setCollection($this->getCpsCollection());
35
+ $this->setChild('pager', $pager);
36
+ $this->getCpsCollection()->load();
37
+ return $this;
38
+ }
39
+ public function getDuration()
40
+ {
41
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-6,date("Y"))).' 00:00:00';
42
+ $toDate = date("Y-m-d")." 23:59:59";
43
+ return array('from'=>$fromDate,'to'=>$toDate);
44
+ }
45
+ public function getPagerHtml()
46
+ {
47
+ return $this->getChildHtml('pager');
48
+ }
49
+ public function getHistoryUrl()
50
+ {
51
+ return $this->getUrl('cps/index/history/');
52
+ }
53
+ }
app/code/community/Iifire/Cps/Block/Account/Draw.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iifire_Cps_Block_Account_Draw extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('iifire/cps/account/draw.phtml');
10
+
11
+ $draws = Mage::getResourceModel('iifire_cps/draw_collection')
12
+ ->addFieldToSelect('*')
13
+ ->addFieldToFilter('partner_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
14
+ ->setOrder('created_at', 'desc');
15
+ $this->setDraws($draws);
16
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('iifire_cps')->__('My CPS Draw History'));
17
+ }
18
+
19
+ protected function _prepareLayout()
20
+ {
21
+ parent::_prepareLayout();
22
+
23
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'cps.account.pager')
24
+ ->setCollection($this->getDraws());
25
+ $this->setChild('pager', $pager);
26
+ $this->getDraws()->load();
27
+ return $this;
28
+ }
29
+
30
+ public function getPagerHtml()
31
+ {
32
+ return $this->getChildHtml('pager');
33
+ }
34
+ public function getBackUrl()
35
+ {
36
+ return $this->getUrl('cps/index/');
37
+ }
38
+ }
app/code/community/Iifire/Cps/Block/Account/Draw/History.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iifire_Cps_Block_Account_Draw_History extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $duration = $this->getDuration();
10
+ $this->setTemplate('iifire/cps/account/draw/history.phtml');
11
+ $cps = Mage::getResourceModel('iifire_cps/draw_collection')
12
+ ->addFieldToSelect('*')
13
+ ->addFieldToFilter('partner_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
14
+ ->addFieldToFilter('main_table.created_at',array('from'=>$duration['from'],'to'=>$duration['to']))
15
+ ->setOrder('created_at', 'desc');
16
+ $this->setDraw($cps);
17
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('iifire_cps')->__('My CPS Account'));
18
+ }
19
+ public function getDuration()
20
+ {
21
+ $fromDate = $toDate = '';
22
+ $dateOption = $this->getRequest()->getParam('dateoption');
23
+ if (isset($dateOption)) {
24
+ $dateOption = $this->getRequest()->getParam('dateoption');
25
+ if ($dateOption=='timeperiod') {
26
+ $dayOfWeek = date('w') ? date('w') : 7;
27
+ $dayOfMonth = date('d');
28
+ //echo "dayofweek=".$dayOfWeek.'&dayokmonth='.$dayOfMonth;
29
+ $toDate = date('Y-m-d h:i:s');
30
+ $datePeriod = $this->getRequest()->getParam('transactionperiod');
31
+ if ($datePeriod == 1) { //Today
32
+ $fromDate = date('Y-m-d '.'00:00:00');
33
+ } elseif($datePeriod == 2) { //This Week (Mon - Today)
34
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek+1,date("Y"))).' 00:00:00';
35
+ } elseif($datePeriod == 3) { //Last Week (Mon - Sun)
36
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek-6,date("Y"))).' 00:00:00';
37
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek,date("Y"))).' 23:59:59';
38
+ } elseif($datePeriod == 4) { //This Month
39
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
40
+ } elseif($datePeriod == 5) { //Last Month
41
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
42
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth,date("Y"))).' 23:59:59';
43
+ } elseif($datePeriod == 6) { //Last Three Months
44
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-3,date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
45
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth,date("Y"))).' 23:59:59';
46
+ }
47
+ } elseif($dateOption=='dateselect') {
48
+ $fromDatePost = $this->getRequest()->getParam('from_date');
49
+ $toDatePost = $this->getRequest()->getParam('to_date');
50
+ $toDatePost = $toDatePost ? $toDatePost : date('Y-m-d h:i:s');
51
+ $validator = new Zend_Validate_Date('YYYY-MM-DD');
52
+ if($validator->isValid($fromDatePost) && $validator->isValid($toDatePost) && $fromDatePost<=$toDatePost) {
53
+ $fromDate = $fromDatePost." 00:00:00";
54
+ $toDate = $toDatePost." 23:59:59";
55
+ } else {
56
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y"))).' 00:00:00';
57
+ $toDate = date("Y-m-d h:i:s");
58
+ }
59
+ }
60
+ } else {
61
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y"))).' 00:00:00';
62
+ $toDate = date("Y-m-d h:i:s");
63
+ }
64
+ return array('from'=>$fromDate,'to'=>$toDate);
65
+ }
66
+
67
+ protected function _prepareLayout()
68
+ {
69
+ parent::_prepareLayout();
70
+
71
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'cps.account.pager')
72
+ ->setCollection($this->getDraw());
73
+ $this->setChild('pager', $pager);
74
+ $this->getDraw()->load();
75
+ return $this;
76
+ }
77
+
78
+ public function getPagerHtml()
79
+ {
80
+ return $this->getChildHtml('pager');
81
+ }
82
+
83
+ public function getBackUrl()
84
+ {
85
+ return $this->getUrl('customer/account/');
86
+ }
87
+
88
+
89
+ public function getTimePeriodAsOptions()
90
+ {
91
+ return array(
92
+ '1' => Mage::helper('iifire_cps')->__('Today'),
93
+ '2' => Mage::helper('iifire_cps')->__('This Week (Mon - Today)'),
94
+ '3' => Mage::helper('iifire_cps')->__('Last Week (Mon - Sun)'),
95
+ '4' => Mage::helper('iifire_cps')->__('This Month'),
96
+ '5' => Mage::helper('iifire_cps')->__('Last Month'),
97
+ '6' => Mage::helper('iifire_cps')->__('Last Three Months'),
98
+ );
99
+ }
100
+ public function getCurrentDateOption()
101
+ {
102
+ return $this->getRequest()->getParam('dateoption');
103
+
104
+ }
105
+ public function getCurrentTimePeriod()
106
+ {
107
+ $dateOption = $this->getRequest()->getParam('dateoption');
108
+ if (isset($dateOption) && $this->getRequest()->getParam('dateoption') == 'timeperiod')
109
+ {
110
+ return $this->getRequest()->getParam('transactionperiod');
111
+ } else {
112
+ return false;
113
+ }
114
+ }
115
+ public function getDefaultFromDate()
116
+ {
117
+ $duration = $this->getDuration();
118
+ $dateOption = $this->getCurrentDateOption();
119
+ if ($dateOption=='dateselect') {
120
+ return substr($duration['from'],0,10);
121
+ } else {
122
+ return date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y")));
123
+ }
124
+
125
+ }
126
+ public function getDefaultToDate()
127
+ {
128
+ $duration = $this->getDuration();
129
+ $dateOption = $this->getCurrentDateOption();
130
+ if ($dateOption=='dateselect') {
131
+ return substr($duration['to'],0,10);
132
+ } else {
133
+ return date('Y-m-d');
134
+ }
135
+ }
136
+ }
app/code/community/Iifire/Cps/Block/Account/Draw/New.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iifire_Cps_Block_Account_Draw_New extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setTemplate('iifire/cps/account/draw/form.phtml');
10
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('iifire_cps')->__('My CPS Draw History'));
11
+ }
12
+
13
+ public function getBackUrl()
14
+ {
15
+ return $this->getUrl('cps/account/');
16
+ }
17
+ public function getPostActionUrl()
18
+ {
19
+ return $this->getUrl('cps/draw/save/');
20
+ }
21
+ public function getDrawUrl()
22
+ {
23
+ return $this->getUrl('cps/draw/');
24
+ }
25
+ }
app/code/community/Iifire/Cps/Block/Account/Filter.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iifire_Cps_Block_Account_Filter extends Mage_Core_Block_Template
3
+ {
4
+ public function getDuration()
5
+ {
6
+ $fromDate = $toDate = '';
7
+ $dateOption = $this->getRequest()->getParam('dateoption');
8
+ if (isset($dateOption)) {
9
+ $dateOption = $this->getRequest()->getParam('dateoption');
10
+ if ($dateOption=='timeperiod') {
11
+ $dayOfWeek = date('w') ? date('w') : 7;
12
+ $dayOfMonth = date('d');
13
+ //echo "dayofweek=".$dayOfWeek.'&dayokmonth='.$dayOfMonth;
14
+ $toDate = date('Y-m-d h:i:s');
15
+ $datePeriod = $this->getRequest()->getParam('transactionperiod');
16
+ if ($datePeriod == 1) { //Today
17
+ $fromDate = date('Y-m-d '.'00:00:00');
18
+ } elseif($datePeriod == 2) { //This Week (Mon - Today)
19
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek+1,date("Y"))).' 00:00:00';
20
+ } elseif($datePeriod == 3) { //Last Week (Mon - Sun)
21
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek-6,date("Y"))).' 00:00:00';
22
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfWeek,date("Y"))).' 23:59:59';
23
+ } elseif($datePeriod == 4) { //This Month
24
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
25
+ } elseif($datePeriod == 5) { //Last Month
26
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
27
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth,date("Y"))).' 23:59:59';
28
+ } elseif($datePeriod == 6) { //Last Three Months
29
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-3,date("d")-$dayOfMonth+1,date("Y"))).' 00:00:00';
30
+ $toDate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$dayOfMonth,date("Y"))).' 23:59:59';
31
+ }
32
+ } elseif($dateOption=='dateselect') {
33
+ $fromDatePost = $this->getRequest()->getParam('from_date');
34
+ $toDatePost = $this->getRequest()->getParam('to_date');
35
+ $toDatePost = $toDatePost ? $toDatePost : date('Y-m-d h:i:s');
36
+ $validator = new Zend_Validate_Date('YYYY-MM-DD');
37
+ if($validator->isValid($fromDatePost) && $validator->isValid($toDatePost) && $fromDatePost<=$toDatePost) {
38
+ $fromDate = $fromDatePost." 00:00:00";
39
+ $toDate = $toDatePost." 23:59:59";
40
+ } else {
41
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y"))).' 00:00:00';
42
+ $toDate = date("Y-m-d h:i:s");
43
+ }
44
+ }
45
+ } else {
46
+ $fromDate = date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y"))).' 00:00:00';
47
+ $toDate = date("Y-m-d h:i:s");
48
+ }
49
+ return array('from'=>$fromDate,'to'=>$toDate);
50
+ }
51
+ public function getTimePeriodAsOptions()
52
+ {
53
+ return array(
54
+ '1' => Mage::helper('iifire_cps')->__('Today'),
55
+ '2' => Mage::helper('iifire_cps')->__('This Week (Mon - Today)'),
56
+ '3' => Mage::helper('iifire_cps')->__('Last Week (Mon - Sun)'),
57
+ '4' => Mage::helper('iifire_cps')->__('This Month'),
58
+ '5' => Mage::helper('iifire_cps')->__('Last Month'),
59
+ '6' => Mage::helper('iifire_cps')->__('Last Three Months'),
60
+ );
61
+ }
62
+ public function getCurrentDateOption()
63
+ {
64
+ return $this->getRequest()->getParam('dateoption');
65
+
66
+ }
67
+ public function getCurrentTimePeriod()
68
+ {
69
+ $dateOption = $this->getRequest()->getParam('dateoption');
70
+ if (isset($dateOption) && $this->getRequest()->getParam('dateoption') == 'timeperiod')
71
+ {
72
+ return $this->getRequest()->getParam('transactionperiod');
73
+ } else {
74
+ return false;
75
+ }
76
+ }
77
+ public function getDefaultFromDate()
78
+ {
79
+ $duration = $this->getDuration();
80
+ $dateOption = $this->getCurrentDateOption();
81
+ if ($dateOption=='dateselect') {
82
+ return substr($duration['from'],0,10);
83
+ } else {
84
+ return date("Y-m-d",mktime(0,0,0,date("m")-1,date("d"),date("Y")));
85
+ }
86
+
87
+ }
88
+ public function getDefaultToDate()
89
+ {
90
+ $duration = $this->getDuration();
91
+ $dateOption = $this->getCurrentDateOption();
92
+ if ($dateOption=='dateselect') {
93
+ return substr($duration['to'],0,10);
94
+ } else {
95
+ return date('Y-m-d');
96
+ }
97
+ }
98
+ }
99
+ ?>
app/code/community/Iifire/Cps/Block/Account/History.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Iifire_Cps_Block_Account_History extends Mage_Core_Block_Template
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $dateFilter = Mage::getBlockSingleton('iifire_cps/account_filter');
10
+ $duration = $dateFilter->getDuration();
11
+ $this->setTemplate('iifire/cps/account/history.phtml');
12
+ $cps = Mage::getResourceModel('iifire_cps/cps_collection')
13
+ ->addFieldToSelect('*')
14
+ ->addFieldToFilter('partner_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
15
+ ->addFieldToFilter('main_table.created_at',array('from'=>$duration['from'],'to'=>$duration['to']))
16
+ ->setOrder('created_at', 'desc');
17
+ $cps->getSelect()->joinLeft(
18
+ array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')),
19
+ 'main_table.order_id = order.entity_id',
20
+ array('grand_total','status','increment_id')
21
+ );
22
+ //echo $cps->getSelect();
23
+ $statusArray = Mage::getSingleton('iifire_cps/cps')->getStatusArray();
24
+ if(is_array($statusArray) && count($statusArray)) {
25
+ $cps->addFieldToFilter('status',array('in'=>$statusArray));
26
+ }
27
+ $this->setCps($cps);
28
+ Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('iifire_cps')->__('My CPS Account'));
29
+ }
30
+ protected function _prepareLayout()
31
+ {
32
+ parent::_prepareLayout();
33
+ $pager = $this->getLayout()->createBlock('page/html_pager', 'cps.account.pager')
34
+ ->setCollection($this->getCps());
35
+ $this->setChild('pager', $pager);
36
+ $this->getCps()->load();
37
+ return $this;
38
+ }
39
+
40
+ public function getPagerHtml()
41
+ {
42
+ return $this->getChildHtml('pager');
43
+ }
44
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Cps extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/index.phtml');
13
+ }
14
+ protected function _prepareLayout()
15
+ {
16
+ $this->setChild('grid', $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_cps_grid', 'cps.grid'));
17
+ return parent::_prepareLayout();
18
+
19
+ }
20
+ public function getHeaderText()
21
+ {
22
+ return Mage::helper('iifire_cps')->__('CPS Management');
23
+ }
24
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Export.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Cps_Export extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+ protected function _getStore()
15
+ {
16
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
17
+ return Mage::app()->getStore($storeId);
18
+ }
19
+ protected function _prepareCollection()
20
+ {
21
+ $collection = Mage::getModel('iifire_cps/cps')
22
+ ->getResourceCollection();
23
+ $collection->getSelect()->joinLeft(
24
+ array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')),
25
+ 'main_table.order_id = order.entity_id',
26
+ array('grand_total','status','increment_id','store_id')
27
+ );
28
+ $this->setCollection($collection);
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns()
33
+ {
34
+ $this->addColumn('cps_id', array(
35
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
36
+ 'index' => 'cps_id',
37
+ 'type' => 'number',
38
+ ));
39
+ $this->addColumn('partner_id', array(
40
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
41
+ 'index' => 'partner_id',
42
+ 'width' => '65',
43
+ 'type' => 'number',
44
+ ));
45
+ $this->addColumn('sku', array(
46
+ 'header' => Mage::helper('iifire_cps')->__('Sku'),
47
+ 'index' => 'sku',
48
+ ));
49
+ $this->addColumn('increment_id', array(
50
+ 'header' => Mage::helper('iifire_cps')->__('Order #'),
51
+ 'index' => 'increment_id',
52
+ ));
53
+ $store = $this->_getStore();
54
+ $this->addColumn('grand_total', array(
55
+ 'header' => Mage::helper('iifire_cps')->__('Order Grand Total'),
56
+ 'index' => 'grand_total',
57
+ 'type' => 'price',
58
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
59
+ ));
60
+ $this->addColumn('commission', array(
61
+ 'header' => Mage::helper('iifire_cps')->__('Commission'),
62
+ 'index' => 'commission',
63
+ 'renderer' => 'iifire_cps/adminhtml_cps_cps_grid_renderer_commission',
64
+ 'align' => 'right',
65
+ ));
66
+ $this->addColumn('status', array(
67
+ 'header' => Mage::helper('iifire_cps')->__('Order Status'),
68
+ 'index' => 'status',
69
+ 'type' => 'options',
70
+ 'width' => '70px',
71
+ 'options' => Mage::getModel('iifire_cps/cps')->getStatusArray(),
72
+ ));
73
+
74
+ if (!Mage::app()->isSingleStoreMode()) {
75
+ $this->addColumn('store_id', array(
76
+ 'header' => Mage::helper('iifire_cps')->__('Store'),
77
+ 'index' => 'store_id',
78
+ 'type' => 'store',
79
+ 'store_view' => true,
80
+ 'sortable' => false
81
+ ));
82
+ }
83
+ $this->addColumn('created_at', array(
84
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
85
+ 'index' => 'created_at',
86
+ 'type' => 'datetime',
87
+ ));
88
+ $status = Mage::helper('iifire_cps')->getCpsStatus();
89
+ $this->addColumn('cps_status', array(
90
+ 'header' => Mage::helper('iifire_cps')->__('CPS Status'),
91
+ 'index' => 'cps_status',
92
+ 'type' => 'options',
93
+ 'options' => $status,
94
+ 'align' => 'center',
95
+ ));
96
+
97
+ $this->addColumn('action', array(
98
+ 'header' => Mage::helper('iifire_cps')->__('Action'),
99
+ 'width' => '100px',
100
+ 'renderer' => 'iifire_cps/adminhtml_cps_cps_grid_renderer_action',
101
+ ));
102
+ return parent::_prepareColumns();
103
+ }
104
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Cps_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('cps_id');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _getStore()
18
+ {
19
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
20
+ return Mage::app()->getStore($storeId);
21
+ }
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getModel('iifire_cps/cps')
25
+ ->getResourceCollection();
26
+ $collection->getSelect()->joinLeft(
27
+ array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')),
28
+ 'main_table.order_id = order.entity_id',
29
+ array('grand_total','status','increment_id','store_id')
30
+ );
31
+ $this->setCollection($collection);
32
+ return parent::_prepareCollection();
33
+ }
34
+
35
+ protected function _prepareColumns()
36
+ {
37
+ $this->addColumn('cps_id', array(
38
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
39
+ 'index' => 'cps_id',
40
+ 'type' => 'number',
41
+ ));
42
+ $this->addColumn('partner_id', array(
43
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
44
+ 'index' => 'partner_id',
45
+ 'width' => '65',
46
+ 'type' => 'number',
47
+ ));
48
+ $this->addColumn('sku', array(
49
+ 'header' => Mage::helper('iifire_cps')->__('Sku'),
50
+ 'index' => 'sku',
51
+ ));
52
+ $this->addColumn('increment_id', array(
53
+ 'header' => Mage::helper('iifire_cps')->__('Order #'),
54
+ 'index' => 'increment_id',
55
+ ));
56
+ $store = $this->_getStore();
57
+ $this->addColumn('grand_total', array(
58
+ 'header' => Mage::helper('iifire_cps')->__('Order Grand Total'),
59
+ 'index' => 'grand_total',
60
+ 'type' => 'price',
61
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
62
+ ));
63
+ $this->addColumn('commission', array(
64
+ 'header' => Mage::helper('iifire_cps')->__('Commission'),
65
+ 'index' => 'commission',
66
+ 'renderer' => 'iifire_cps/adminhtml_cps_cps_grid_renderer_commission',
67
+ 'align' => 'right',
68
+ ));
69
+ $this->addColumn('status', array(
70
+ 'header' => Mage::helper('iifire_cps')->__('Order Status'),
71
+ 'index' => 'status',
72
+ 'type' => 'options',
73
+ 'width' => '70px',
74
+ 'options' => Mage::getModel('iifire_cps/cps')->getStatusArray(),
75
+ ));
76
+
77
+ if (!Mage::app()->isSingleStoreMode()) {
78
+ $this->addColumn('store_id', array(
79
+ 'header' => Mage::helper('iifire_cps')->__('Store'),
80
+ 'index' => 'store_id',
81
+ 'type' => 'store',
82
+ 'store_view' => true,
83
+ 'sortable' => false
84
+ ));
85
+ }
86
+ $this->addColumn('created_at', array(
87
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
88
+ 'index' => 'created_at',
89
+ 'type' => 'datetime',
90
+ ));
91
+ $status = Mage::helper('iifire_cps')->getCpsStatus();
92
+ $this->addColumn('cps_status', array(
93
+ 'header' => Mage::helper('iifire_cps')->__('CPS Status'),
94
+ 'index' => 'cps_status',
95
+ 'type' => 'options',
96
+ 'options' => $status,
97
+ 'align' => 'center',
98
+ ));
99
+
100
+ $this->addColumn('action', array(
101
+ 'header' => Mage::helper('iifire_cps')->__('Action'),
102
+ 'width' => '100px',
103
+ 'renderer' => 'iifire_cps/adminhtml_cps_cps_grid_renderer_action',
104
+ ));
105
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
106
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
107
+ return parent::_prepareColumns();
108
+ }
109
+
110
+ protected function _prepareMassaction()
111
+ {
112
+ $this->setMassactionIdField('cps_id');
113
+ $this->getMassactionBlock()->setUseSelectAll(false);//@Joy
114
+ $this->getMassactionBlock()->addItem('approved', array(
115
+ 'label' => Mage::helper('iifire_cps')->__('Approved'),
116
+ 'url' => $this->getUrl('*/*/massApproved'),
117
+ 'confirm' => Mage::helper('iifire_cps')->__('Are you sure?')
118
+ ));
119
+ $this->getMassactionBlock()->addItem('cancel', array(
120
+ 'label' => Mage::helper('iifire_cps')->__('Cancel'),
121
+ 'url' => $this->getUrl('*/*/massCancel'),
122
+ 'confirm' => Mage::helper('iifire_cps')->__('Are you sure?')
123
+ ));
124
+
125
+ return parent::_prepareMassaction();
126
+ }
127
+ public function getRowUrl($row)
128
+ {
129
+ return;
130
+ }
131
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.org)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Cps_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
8
+ {
9
+ public function render(Varien_Object $row)
10
+ {
11
+ $status = $row->getCpsStatus();
12
+ if ($status==Iifire_Cps_Model_Cps::CPS_STATUS_PENDING) {
13
+ $url = $this->getUrl('*/*/approved',array('id'=>$row->getId()));
14
+ return '<a href="'.$url.'" >'.Mage::helper('iifire_cps')->__('Approved').'</div>';
15
+ } else {
16
+ return;
17
+ }
18
+
19
+ }
20
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Cps/Grid/Renderer/Commission.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.org)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Cps_Grid_Renderer_Commission extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
8
+ {
9
+ public function render(Varien_Object $row)
10
+ {
11
+ return sprintf("%.2f", $this->_getValue($row)).'%';
12
+ }
13
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Draw extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/index.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('grid', $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_draw_grid', 'draw.grid'));
19
+ return parent::_prepareLayout();
20
+
21
+ }
22
+ public function getHeaderText()
23
+ {
24
+ return Mage::helper('iifire_cps')->__('CPS Withdraw Management');
25
+ }
26
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Export.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Draw_Export extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+
16
+ protected function _getStore()
17
+ {
18
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
19
+ return Mage::app()->getStore($storeId);
20
+ }
21
+ protected function _prepareCollection()
22
+ {
23
+ $collection = Mage::getModel('iifire_cps/draw')
24
+ ->getResourceCollection();
25
+ $this->setCollection($collection);
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns()
30
+ {
31
+ $this->addColumn('draw_id', array(
32
+ 'header' => Mage::helper('iifire_cps')->__('Withdraw ID'),
33
+ 'index' => 'draw_id',
34
+ 'width' => '50px',
35
+ ));
36
+ $this->addColumn('partner_id', array(
37
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
38
+ 'index' => 'partner_id',
39
+ 'width' => '50px',
40
+ ));
41
+ $this->addColumn('partner_email', array(
42
+ 'header' => Mage::helper('iifire_cps')->__('Email'),
43
+ 'index' => 'partner_email',
44
+ 'width' => '120px',
45
+ ));
46
+ $store = $this->_getStore();
47
+ $this->addColumn('draw_amount', array(
48
+ 'header' => Mage::helper('iifire_cps')->__('Amount'),
49
+ 'index' => 'draw_amount',
50
+ 'width' => '80px',
51
+ 'type' => 'price',
52
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
53
+ ));
54
+ $this->addColumn('draw_description', array(
55
+ 'header' => Mage::helper('iifire_cps')->__('Description'),
56
+ 'index' => 'draw_description',
57
+ 'width' => '240px',
58
+ ));
59
+ $this->addColumn('created_at', array(
60
+ 'header' => Mage::helper('iifire_cps')->__('Withdraw At'),
61
+ 'index' => 'created_at',
62
+ 'type' => 'datetime',
63
+ 'width' => '140px',
64
+ ));
65
+
66
+ /*$this->addColumn('grand_total', array(
67
+ 'header' => Mage::helper('iifire_cps')->__('Order Grand Total'),
68
+ 'index' => 'grand_total',
69
+
70
+ ));*/
71
+ $this->addColumn('is_email', array(
72
+ 'header' => Mage::helper('iifire_cps')->__('Is Email'),
73
+ 'index' => 'is_email',
74
+ 'width' => '60px',
75
+ 'type' => 'options',
76
+ 'options' => array(
77
+ '0' => Mage::helper('iifire_cps')->__('No'),
78
+ '1' => Mage::helper('iifire_cps')->__('Yes'),
79
+ ),
80
+ ));
81
+ /*
82
+ if (!Mage::app()->isSingleStoreMode()) {
83
+ $this->addColumn('store_id', array(
84
+ 'header' => Mage::helper('iifire_cps')->__('Store'),
85
+ 'index' => 'store_id',
86
+ 'type' => 'store',
87
+ 'store_view' => true,
88
+ 'sortable' => false
89
+ ));
90
+ }*/
91
+ $this->addColumn('updated_at', array(
92
+ 'header' => Mage::helper('iifire_cps')->__('Updated At'),
93
+ 'index' => 'updated_at',
94
+ 'type' => 'datetime',
95
+ 'width' => '140px',
96
+ ));
97
+ $drawStatusArray = Mage::helper('iifire_cps')->getDrawStatus();
98
+ $this->addColumn('draw_status', array(
99
+ 'header' => Mage::helper('iifire_cps')->__('Status'),
100
+ 'index' => 'draw_status',
101
+ 'width' => '100px',
102
+ 'type' => 'options',
103
+ 'options' => $drawStatusArray,
104
+ ));
105
+ $this->addColumn('action', array(
106
+ 'header' => Mage::helper('iifire_cps')->__('Action'),
107
+ 'width' => '100px',
108
+ 'renderer' => 'iifire_cps/adminhtml_cps_draw_grid_renderer_action',
109
+ ));
110
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
111
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
112
+ return parent::_prepareColumns();
113
+ }
114
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Grid.php ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Draw_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('draw_id');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _getStore()
18
+ {
19
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
20
+ return Mage::app()->getStore($storeId);
21
+ }
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getModel('iifire_cps/draw')
25
+ ->getResourceCollection();
26
+ $this->setCollection($collection);
27
+ return parent::_prepareCollection();
28
+ }
29
+
30
+ protected function _prepareColumns()
31
+ {
32
+ $this->addColumn('draw_id', array(
33
+ 'header' => Mage::helper('iifire_cps')->__('Withdraw ID'),
34
+ 'index' => 'draw_id',
35
+ 'width' => '50px',
36
+ 'align' => 'center',
37
+ 'type' => 'number',
38
+ ));
39
+ $this->addColumn('partner_id', array(
40
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
41
+ 'index' => 'partner_id',
42
+ 'width' => '50px',
43
+ 'align' => 'center',
44
+ 'type' => 'number',
45
+ ));
46
+ $this->addColumn('partner_email', array(
47
+ 'header' => Mage::helper('iifire_cps')->__('Email'),
48
+ 'index' => 'partner_email',
49
+ 'width' => '120px',
50
+ ));
51
+ $store = $this->_getStore();
52
+ $this->addColumn('draw_amount', array(
53
+ 'header' => Mage::helper('iifire_cps')->__('Amount'),
54
+ 'index' => 'draw_amount',
55
+ 'width' => '80px',
56
+ 'type' => 'price',
57
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
58
+ ));
59
+ $this->addColumn('draw_description', array(
60
+ 'header' => Mage::helper('iifire_cps')->__('Description'),
61
+ 'index' => 'draw_description',
62
+ 'width' => '240px',
63
+ ));
64
+ $this->addColumn('created_at', array(
65
+ 'header' => Mage::helper('iifire_cps')->__('Withdraw At'),
66
+ 'index' => 'created_at',
67
+ 'type' => 'datetime',
68
+ 'width' => '140px',
69
+ ));
70
+ /*$this->addColumn('is_email', array(
71
+ 'header' => Mage::helper('iifire_cps')->__('Is Email'),
72
+ 'index' => 'is_email',
73
+ 'width' => '60px',
74
+ 'type' => 'options',
75
+ 'options' => array(
76
+ '0' => Mage::helper('iifire_cps')->__('No'),
77
+ '1' => Mage::helper('iifire_cps')->__('Yes'),
78
+ ),
79
+ ));*/
80
+ $this->addColumn('updated_at', array(
81
+ 'header' => Mage::helper('iifire_cps')->__('Updated At'),
82
+ 'index' => 'updated_at',
83
+ 'type' => 'datetime',
84
+ 'width' => '140px',
85
+ ));
86
+ $drawStatusArray = Mage::helper('iifire_cps')->getDrawStatus();
87
+ $this->addColumn('draw_status', array(
88
+ 'header' => Mage::helper('iifire_cps')->__('Status'),
89
+ 'index' => 'draw_status',
90
+ 'width' => '100px',
91
+ 'type' => 'options',
92
+ 'options' => $drawStatusArray,
93
+ 'align' => 'center',
94
+ ));
95
+ $this->addColumn('action', array(
96
+ 'header' => Mage::helper('iifire_cps')->__('Action'),
97
+ 'width' => '100px',
98
+ 'renderer' => 'iifire_cps/adminhtml_cps_draw_grid_renderer_action',
99
+ ));
100
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
101
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
102
+ return parent::_prepareColumns();
103
+ }
104
+
105
+ protected function _prepareMassaction()
106
+ {
107
+ $this->setMassactionIdField('draw_id');
108
+ $this->getMassactionBlock()->setUseSelectAll(false);//@Joy
109
+ $this->getMassactionBlock()->addItem('delete', array(
110
+ 'label' => Mage::helper('iifire_cps')->__('Approved'),
111
+ 'url' => $this->getUrl('*/*/massApproved'),
112
+ 'confirm' => Mage::helper('iifire_cps')->__('Are you sure?')
113
+ ));
114
+
115
+ return parent::_prepareMassaction();
116
+ }
117
+ public function getRowUrl($row)
118
+ {
119
+ return;
120
+ }
121
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Draw/Grid/Renderer/Action.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.org)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Draw_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
8
+ {
9
+ public function render(Varien_Object $row)
10
+ {
11
+ $status = $row->getDrawStatus();
12
+ if ($status==Iifire_Cps_Model_Draw::DRAW_STATUS_PENDING) {
13
+ $url = $this->getUrl('*/*/approved',array('id'=>$row->getId()));
14
+ return '<a href="'.$url.'" >'.Mage::helper('iifire_cps')->__('Approved').'</div>';
15
+ } else {
16
+ return;
17
+ }
18
+
19
+ }
20
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Log extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/index.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('grid', $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_log_grid', 'log.grid'));
19
+ return parent::_prepareLayout();
20
+
21
+ }
22
+ public function getHeaderText()
23
+ {
24
+ return Mage::helper('iifire_cps')->__('CPS Log Management');
25
+ }
26
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log/Export.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Log_Export extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $collection = Mage::getModel('iifire_cps/cps')
18
+ ->getResourceCollection();
19
+ $collection->getSelect()->joinLeft(
20
+ array('order' => Mage::getSingleton('core/resource')->getTableName('sales_flat_order')),
21
+ 'main_table.order_id = order.entity_id',
22
+ array('grand_total','status')
23
+ );
24
+ $this->setCollection($collection);
25
+ return parent::_prepareCollection();
26
+ }
27
+
28
+ protected function _prepareColumns()
29
+ {
30
+ $this->addColumn('cps_id', array(
31
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
32
+ 'index' => 'cps_id',
33
+ ));
34
+ $this->addColumn('partner_id', array(
35
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
36
+ 'index' => 'partner_id',
37
+ ));
38
+ $this->addColumn('sku', array(
39
+ 'header' => Mage::helper('iifire_cps')->__('Sku'),
40
+ 'index' => 'sku',
41
+ ));
42
+ $this->addColumn('order_id', array(
43
+ 'header' => Mage::helper('iifire_cps')->__('Order ID'),
44
+ 'index' => 'order_id',
45
+ ));
46
+ $this->addColumn('grand_total', array(
47
+ 'header' => Mage::helper('iifire_cps')->__('Order Grand Total'),
48
+ 'index' => 'grand_total',
49
+ ));
50
+ $this->addColumn('status', array(
51
+ 'header' => Mage::helper('iifire_cps')->__('Order Status'),
52
+ 'index' => 'status',
53
+ ));
54
+ $this->addColumn('commission', array(
55
+ 'header' => Mage::helper('iifire_cps')->__('Commission'),
56
+ 'index' => 'commission',
57
+ ));
58
+
59
+
60
+ if (!Mage::app()->isSingleStoreMode()) {
61
+ $this->addColumn('store_id', array(
62
+ 'header' => Mage::helper('iifire_cps')->__('Store'),
63
+ 'index' => 'store_id',
64
+ 'type' => 'store',
65
+ 'store_view' => true,
66
+ 'sortable' => false
67
+ ));
68
+ }
69
+ $this->addColumn('created_at', array(
70
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
71
+ 'index' => 'created_at',
72
+ ));
73
+ return parent::_prepareColumns();
74
+ }
75
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Log/Grid.php ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('log_id');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $collection = Mage::getModel('iifire_cps/log')
20
+ ->getResourceCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns()
26
+ {
27
+ $this->addColumn('log_id', array(
28
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
29
+ 'index' => 'log_id',
30
+ 'width' => '80px',
31
+ 'align' => 'center',
32
+ 'type' => 'number',
33
+ ));
34
+ $this->addColumn('partner_id', array(
35
+ 'header' => Mage::helper('iifire_cps')->__('Partner ID'),
36
+ 'index' => 'partner_id',
37
+ 'width' => '80px',
38
+ 'align' => 'center',
39
+ 'type' => 'number',
40
+ ));
41
+ $this->addColumn('sku', array(
42
+ 'header' => Mage::helper('iifire_cps')->__('Sku'),
43
+ 'index' => 'sku',
44
+ 'width' => '120px',
45
+ 'align' => 'center',
46
+ ));
47
+ $this->addColumn('ip', array(
48
+ 'header' => Mage::helper('iifire_cps')->__('IP'),
49
+ 'index' => 'ip',
50
+ 'width' => '160px',
51
+ 'align' => 'right',
52
+ ));
53
+ if (!Mage::app()->isSingleStoreMode()) {
54
+ $this->addColumn('store_id', array(
55
+ 'header' => Mage::helper('iifire_cps')->__('Store'),
56
+ 'index' => 'store_id',
57
+ 'type' => 'store',
58
+ 'store_view' => true,
59
+ 'sortable' => false
60
+ ));
61
+ }
62
+ $this->addColumn('created_at', array(
63
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
64
+ 'index' => 'created_at',
65
+ 'type' => 'datetime',
66
+ ));
67
+ $this->addColumn('action',
68
+ array(
69
+ 'header' => Mage::helper('iifire_cps')->__('Action'),
70
+ 'width' => '100px',
71
+ 'type' => 'action',
72
+ 'getter' => 'getId',
73
+ 'actions' => array(array(
74
+ 'caption' => Mage::helper('iifire_cps')->__('Delete'),
75
+ 'url' => array(
76
+ 'base'=>'*/*/delete'
77
+ ),
78
+ 'field' => 'id'
79
+ )),
80
+ 'filter' => false,
81
+ 'sortable' => false,
82
+ 'index' => 'log_id',
83
+ ));
84
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
85
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
86
+ return parent::_prepareColumns();
87
+ }
88
+
89
+ protected function _prepareMassaction()
90
+ {
91
+ $this->setMassactionIdField('query_id');
92
+
93
+ $this->getMassactionBlock()->addItem('delete', array(
94
+ 'label' => Mage::helper('iifire_cps')->__('Delete'),
95
+ 'url' => $this->getUrl('*/*/massDelete'),
96
+ 'confirm' => Mage::helper('iifire_cps')->__('Are you sure?')
97
+ ));
98
+
99
+ return parent::_prepareMassaction();
100
+ }
101
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/partner.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('grid', $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner_grid', 'cps.partner.grid'));
19
+ return parent::_prepareLayout();
20
+
21
+ }
22
+
23
+ public function getHeaderText()
24
+ {
25
+ return Mage::helper('iifire_cps')->__('CPS Partner Management');
26
+ }
27
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Edit.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_Edit extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/partner/edit.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('back_button',
19
+ $this->getLayout()->createBlock('adminhtml/widget_button')
20
+ ->setData(array(
21
+ 'label' => Mage::helper('iifire_cps')->__('Back'),
22
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/index').'\')',
23
+ 'class' => 'back'
24
+ ))
25
+ );
26
+ $this->setChild('save_button',
27
+ $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setData(array(
29
+ 'label' => Mage::helper('iifire_cps')->__('Save'),
30
+ 'onclick' => 'partnerControl.save(\''.$this->getUrl('*/*/save', array('continue'=>false)).'\');',
31
+ 'class' => 'save'
32
+ ))
33
+ );
34
+
35
+ $this->setChild('save_continue_button',
36
+ $this->getLayout()->createBlock('adminhtml/widget_button')
37
+ ->setData(array(
38
+ 'label' => Mage::helper('iifire_cps')->__('Save and continue add'),
39
+ 'onclick' => 'partnerControl.continue(\''.$this->getUrl('*/*/save', array('continue'=>true)).'\');',
40
+ 'class' => 'save',
41
+ ))
42
+ );
43
+ return parent::_prepareLayout();
44
+
45
+ }
46
+ public function getForm()
47
+ {
48
+ return $this->getLayout()
49
+ ->createBlock('iifire_cps/adminhtml_cps_partner_edit_form')
50
+ ->toHtml();
51
+ }
52
+ public function getBackButtonHtml()
53
+ {
54
+ return $this->getChildHtml('back_button');
55
+ }
56
+ public function getSaveButtonHtml()
57
+ {
58
+ return $this->getChildHtml('save_button');
59
+ }
60
+ public function getSaveContinueButtonHtml()
61
+ {
62
+ return $this->getChildHtml('save_continue_button');
63
+ }
64
+ public function getHeaderText()
65
+ {
66
+ $id = $this->getRequest()->getParam('id');
67
+ if (!$id) {
68
+ return Mage::helper('iifire_cps')->__('New Partner');
69
+ } else {
70
+ return Mage::helper('iifire_cps')->__('Edit Partner');
71
+ }
72
+
73
+ }
74
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Edit/Form.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Galey <yanggaojiao@qq.com>
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentkey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ }
13
+
14
+
15
+ /**
16
+ * Prepare form before rendering HTML
17
+ *
18
+ * @return Magentokey_QuickAddress_Block_Adminhtml_Address_Country_Form
19
+ */
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form(array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getData('action'),
25
+ 'method' => 'post'
26
+ ));
27
+ $model = Mage::getModel('customer/customer');
28
+ $partnerId = $this->getRequest()->getParam('id');
29
+ if ($partnerId) {
30
+ $model = $model->load($partnerId);
31
+ }
32
+ $fieldset = $form->addFieldset('base_fieldset', array(
33
+ 'legend' => Mage::helper('iifire_cps')->__('CPS Partner Setting'),
34
+ 'class' => 'fieldset-wide'
35
+ ));
36
+ if ($model->getId()) {
37
+ $fieldset->addField('customer_id', 'hidden', array(
38
+ 'name' => 'customer_id',
39
+ 'value' => $model->getId(),
40
+
41
+ ));
42
+ }
43
+ $fieldset->addField('email', 'text', array(
44
+ 'name' => 'email',
45
+ 'label' => Mage::helper('iifire_cps')->__('Partner Email'),
46
+ 'title' => Mage::helper('iifire_cps')->__('Partner Email'),
47
+ 'value' => $model->getEmail(),
48
+ 'required' => true,
49
+ 'disabled' => true,
50
+ ));
51
+
52
+ $fieldset->addField('name', 'text', array(
53
+ 'name' => 'name',
54
+ 'label' => Mage::helper('iifire_cps')->__('Name'),
55
+ 'title' => Mage::helper('iifire_cps')->__('Name'),
56
+ 'value' => $model->getName(),
57
+ 'required' => true,
58
+ 'disabled' => true,
59
+ ));
60
+ $fieldset->addField('commission', 'text', array(
61
+ 'name' => 'commission',
62
+ 'label' => Mage::helper('iifire_cps')->__('CPS Commission'),
63
+ 'title' => Mage::helper('iifire_cps')->__('CPS Commission'),
64
+ 'value' => sprintf("%.2f", $model->getCpsCommission()),
65
+ 'required' => true,
66
+ ));
67
+
68
+ $fieldset->addField('description', 'textarea', array(
69
+ 'name' => 'description',
70
+ 'label' => Mage::helper('iifire_cps')->__('CPS Description'),
71
+ 'title' => Mage::helper('iifire_cps')->__('CPS Description'),
72
+ 'value' => $model->getCpsDescription(),
73
+ 'required' => false,
74
+ ));
75
+
76
+ $this->setForm($form);
77
+
78
+ return parent::_prepareForm();
79
+ }
80
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Export.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_Export extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ protected function _prepareCollection()
16
+ {
17
+ $groupId = Mage::getSingleton('iifire_cps/cps')->getCpsGroupId();
18
+ $collection = Mage::getResourceModel('customer/customer_collection')
19
+ ->addNameToSelect()
20
+ ->addAttributeToSelect(array('email','created_at','cps_description','cps_commission'))
21
+ ->addAttributeToFilter('group_id',$groupId)
22
+ ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
23
+ ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
24
+ ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
25
+ ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
26
+ ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');
27
+
28
+ $this->setCollection($collection);
29
+
30
+ return parent::_prepareCollection();
31
+ }
32
+
33
+ protected function _prepareColumns()
34
+ {
35
+ $this->addColumn('entity_id', array(
36
+ 'header' => Mage::helper('customer')->__('ID'),
37
+ 'width' => '50px',
38
+ 'index' => 'entity_id',
39
+ 'type' => 'number',
40
+ ));
41
+
42
+ $this->addColumn('email', array(
43
+ 'header' => Mage::helper('customer')->__('Email'),
44
+ 'width' => '150',
45
+ 'index' => 'email'
46
+ ));
47
+ $this->addColumn('cps_commission', array(
48
+ 'header' => Mage::helper('customer')->__('Commission'),
49
+ 'width' => '100',
50
+ 'index' => 'cps_commission',
51
+ 'renderer' => 'iifire_cps/adminhtml_cps_partner_grid_renderer_commission',
52
+
53
+ ));
54
+ $this->addColumn('cps_description', array(
55
+ 'header' => Mage::helper('customer')->__('Description'),
56
+ 'width' => '200',
57
+ 'index' => 'cps_description'
58
+ ));
59
+ $this->addColumn('name', array(
60
+ 'header' => Mage::helper('customer')->__('Name'),
61
+ 'index' => 'name',
62
+ 'renderer' => 'adminhtml/customer_grid_renderer_name',
63
+
64
+ ));
65
+ $this->addColumn('Telephone', array(
66
+ 'header' => Mage::helper('customer')->__('Telephone'),
67
+ 'width' => '100',
68
+ 'index' => 'billing_telephone'
69
+ ));
70
+
71
+ $this->addColumn('billing_country_id', array(
72
+ 'header' => Mage::helper('customer')->__('Country'),
73
+ 'width' => '100',
74
+ 'type' => 'country',
75
+ 'index' => 'billing_country_id',
76
+ ));
77
+
78
+ $this->addColumn('customer_since', array(
79
+ 'header' => Mage::helper('customer')->__('Customer Since'),
80
+ 'type' => 'datetime',
81
+ 'align' => 'center',
82
+ 'index' => 'created_at',
83
+ 'gmtoffset' => true
84
+ ));
85
+
86
+ if (!Mage::app()->isSingleStoreMode()) {
87
+ $this->addColumn('website_id', array(
88
+ 'header' => Mage::helper('customer')->__('Website'),
89
+ 'align' => 'center',
90
+ 'width' => '80px',
91
+ 'type' => 'options',
92
+ 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
93
+ 'index' => 'website_id',
94
+ ));
95
+ }
96
+ return parent::_prepareColumns();
97
+ }
98
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Grid.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('created_at');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $groupId = Mage::getSingleton('iifire_cps/cps')->getCpsGroupId();
20
+ $collection = Mage::getResourceModel('customer/customer_collection')
21
+ ->addNameToSelect()
22
+ ->addAttributeToSelect(array('email','created_at','cps_description','cps_commission'))
23
+ ->addAttributeToFilter('group_id',$groupId)
24
+ ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
25
+ ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
26
+ ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
27
+ ->joinAttribute('billing_region', 'customer_address/region', 'default_billing', null, 'left')
28
+ ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');
29
+ $this->setCollection($collection);
30
+
31
+ return parent::_prepareCollection();
32
+ }
33
+
34
+ protected function _prepareColumns()
35
+ {
36
+ $this->addColumn('entity_id', array(
37
+ 'header' => Mage::helper('customer')->__('ID'),
38
+ 'width' => '50px',
39
+ 'index' => 'entity_id',
40
+ 'type' => 'number',
41
+ ));
42
+
43
+ $this->addColumn('email', array(
44
+ 'header' => Mage::helper('customer')->__('Email'),
45
+ 'width' => '150',
46
+ 'index' => 'email',
47
+ 'align' => 'center',
48
+ ));
49
+ $this->addColumn('cps_commission', array(
50
+ 'header' => Mage::helper('customer')->__('Commission'),
51
+ 'width' => '100',
52
+ 'index' => 'cps_commission',
53
+ 'align' => 'right',
54
+ 'renderer' => 'iifire_cps/adminhtml_cps_partner_grid_renderer_commission',
55
+
56
+ ));
57
+ $this->addColumn('cps_description', array(
58
+ 'header' => Mage::helper('customer')->__('Description'),
59
+ 'width' => '200',
60
+ 'index' => 'cps_description'
61
+ ));
62
+ $this->addColumn('name', array(
63
+ 'header' => Mage::helper('customer')->__('Name'),
64
+ 'index' => 'name',
65
+
66
+ ));
67
+ $this->addColumn('Telephone', array(
68
+ 'header' => Mage::helper('customer')->__('Telephone'),
69
+ 'width' => '100',
70
+ 'index' => 'billing_telephone'
71
+ ));
72
+
73
+ $this->addColumn('billing_country_id', array(
74
+ 'header' => Mage::helper('customer')->__('Country'),
75
+ 'width' => '100',
76
+ 'type' => 'country',
77
+ 'index' => 'billing_country_id',
78
+ ));
79
+
80
+ $this->addColumn('customer_since', array(
81
+ 'header' => Mage::helper('customer')->__('Customer Since'),
82
+ 'type' => 'datetime',
83
+ 'align' => 'center',
84
+ 'index' => 'created_at',
85
+ 'gmtoffset' => true
86
+ ));
87
+
88
+ if (!Mage::app()->isSingleStoreMode()) {
89
+ $this->addColumn('website_id', array(
90
+ 'header' => Mage::helper('customer')->__('Website'),
91
+ 'align' => 'center',
92
+ 'width' => '80px',
93
+ 'type' => 'options',
94
+ 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
95
+ 'index' => 'website_id',
96
+ ));
97
+ }
98
+ $this->addColumn('action',
99
+ array(
100
+ 'header' => Mage::helper('customer')->__('Action'),
101
+ 'width' => '100',
102
+ 'type' => 'action',
103
+ 'getter' => 'getId',
104
+ 'actions' => array(
105
+ array(
106
+ 'caption' => Mage::helper('customer')->__('Edit'),
107
+ 'url' => array('base'=> '*/*/edit'),
108
+ 'field' => 'id'
109
+ )
110
+ ),
111
+ 'filter' => false,
112
+ 'sortable' => false,
113
+ 'index' => 'stores',
114
+ 'is_system' => true,
115
+ ));
116
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
117
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
118
+ return parent::_prepareColumns();
119
+ }
120
+ protected function _prepareMassaction()
121
+ {
122
+ $this->setMassactionIdField('partner_id');
123
+ $groups = $this->helper('customer')->getGroups()->toOptionArray();
124
+ array_unshift($groups, array('label'=> '', 'value'=> ''));
125
+ $this->getMassactionBlock()->addItem('assign_group', array(
126
+ 'label' => Mage::helper('customer')->__('Assign a Customer Group'),
127
+ 'url' => $this->getUrl('*/*/massAssignGroup'),
128
+ 'additional' => array(
129
+ 'visibility' => array(
130
+ 'name' => 'group',
131
+ 'type' => 'select',
132
+ 'class' => 'required-entry',
133
+ 'label' => Mage::helper('customer')->__('Group'),
134
+ 'values' => $groups
135
+ )
136
+ )
137
+ ));
138
+ return parent::_prepareMassaction();
139
+ }
140
+ public function getRowUrl($row)
141
+ {
142
+ return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
143
+ }
144
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/Grid/Renderer/Commission.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.org)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_Grid_Renderer_Commission extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
8
+ {
9
+ public function render(Varien_Object $row)
10
+ {
11
+ return sprintf("%.2f", $this->_getValue($row)).'%';
12
+ }
13
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/New.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_New extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/partner/new.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('back_button',
19
+ $this->getLayout()->createBlock('adminhtml/widget_button')
20
+ ->setData(array(
21
+ 'label' => Mage::helper('iifire_cps')->__('Back'),
22
+ 'onclick' => 'setLocation(\''.$this->getUrl('*/*/index').'\')',
23
+ 'class' => 'back'
24
+ ))
25
+ );
26
+ $this->setChild('save_button',
27
+ $this->getLayout()->createBlock('adminhtml/widget_button')
28
+ ->setData(array(
29
+ 'label' => Mage::helper('iifire_cps')->__('Save'),
30
+ 'onclick' => 'partnerControl.save(\''.$this->getUrl('*/*/save', array('continue'=>false)).'\');',
31
+ 'class' => 'save'
32
+ ))
33
+ );
34
+
35
+ $this->setChild('save_continue_button',
36
+ $this->getLayout()->createBlock('adminhtml/widget_button')
37
+ ->setData(array(
38
+ 'label' => Mage::helper('iifire_cps')->__('Save and continue add'),
39
+ 'onclick' => 'partnerControl.continue(\''.$this->getUrl('*/*/save', array('continue'=>true)).'\');',
40
+ 'class' => 'save',
41
+ ))
42
+ );
43
+ return parent::_prepareLayout();
44
+
45
+ }
46
+ public function getForm()
47
+ {
48
+ return $this->getLayout()
49
+ ->createBlock('iifire_cps/adminhtml_cps_partner_new_form')
50
+ ->toHtml();
51
+ }
52
+ public function getBackButtonHtml()
53
+ {
54
+ return $this->getChildHtml('back_button');
55
+ }
56
+ public function getSaveButtonHtml()
57
+ {
58
+ return $this->getChildHtml('save_button');
59
+ }
60
+ public function getSaveContinueButtonHtml()
61
+ {
62
+ return $this->getChildHtml('save_continue_button');
63
+ }
64
+ public function getHeaderText()
65
+ {
66
+ $id = $this->getRequest()->getParam('id');
67
+ if (!$id) {
68
+ return Mage::helper('iifire_cps')->__('New Partner');
69
+ } else {
70
+ return Mage::helper('iifire_cps')->__('Edit Partner');
71
+ }
72
+
73
+ }
74
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Partner/New/Form.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Galey <yanggaojiao@qq.com>
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentkey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Partner_New_Form extends Mage_Adminhtml_Block_Widget_Form
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ }
13
+
14
+
15
+ /**
16
+ * Prepare form before rendering HTML
17
+ *
18
+ * @return Magentokey_QuickAddress_Block_Adminhtml_Address_Country_Form
19
+ */
20
+ protected function _prepareForm()
21
+ {
22
+ $form = new Varien_Data_Form(array(
23
+ 'id' => 'edit_form',
24
+ 'action' => $this->getData('action'),
25
+ 'method' => 'post'
26
+ ));
27
+ $model = Mage::getModel('iifire_cps/partner');
28
+ $partnerId = $this->getRequest()->getParam('id');
29
+ if ($partnerId) {
30
+ $model = $model->load($partnerId);
31
+ }
32
+ $fieldset = $form->addFieldset('base_fieldset', array(
33
+ 'legend' => Mage::helper('iifire_cps')->__('Add Partner'),
34
+ 'class' => 'fieldset-wide'
35
+ ));
36
+ if ($model->getId()) {
37
+ $fieldset->addField('partner_id', 'hidden', array(
38
+ 'name' => 'partner_id',
39
+ 'value' => $model->getId(),
40
+
41
+ ));
42
+ }
43
+ $fieldset->addField('partner_email', 'text', array(
44
+ 'name' => 'partner_email',
45
+ 'label' => Mage::helper('iifire_cps')->__('Partner Email'),
46
+ 'title' => Mage::helper('iifire_cps')->__('Partner Email'),
47
+ 'value' => $model->getPartnerEmail(),
48
+ 'required' => true,
49
+ ));
50
+
51
+ $fieldset->addField('partner_nickname', 'text', array(
52
+ 'name' => 'partner_nickname',
53
+ 'label' => Mage::helper('iifire_cps')->__('Partner Nickname'),
54
+ 'title' => Mage::helper('iifire_cps')->__('Partner Nickname'),
55
+ 'value' => $model->getPartnerNickname(),
56
+ 'required' => true,
57
+ ));
58
+ $fieldset->addField('commission', 'text', array(
59
+ 'name' => 'commission',
60
+ 'label' => Mage::helper('iifire_cps')->__('Commission'),
61
+ 'title' => Mage::helper('iifire_cps')->__('Commission'),
62
+ 'value' => $model->getCommission(),
63
+ 'required' => true,
64
+ ));
65
+ $fieldset->addField('status', 'select', array(
66
+ 'label' => Mage::helper('iifire_cps')->__('Status'),
67
+ 'required' => true,
68
+ 'name' => 'status',
69
+ 'value' => $model->getStatus(),
70
+ 'values' => array(
71
+ 0 => Mage::helper('iifire_cps')->__('Disable'),
72
+ 1 => Mage::helper('iifire_cps')->__('Enable'),
73
+ ),
74
+ ));
75
+ if (!Mage::app()->isSingleStoreMode()) {
76
+ $fieldset->addField('store_id', 'select', array(
77
+ 'label' => Mage::helper('iifire_cps')->__('Choose Store'),
78
+ 'required' => true,
79
+ 'name' => 'store_id',
80
+ 'value' => $model->getStoreId(),
81
+ 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
82
+ ));
83
+ } else {
84
+ $fieldset->addField('store_id', 'hidden', array(
85
+ 'name' => 'store_id',
86
+ 'value' => Mage::app()->getStore(true)->getId(),
87
+
88
+ ));
89
+ }
90
+
91
+ $fieldset->addField('description', 'textarea', array(
92
+ 'name' => 'description',
93
+ 'label' => Mage::helper('iifire_cps')->__('Description'),
94
+ 'title' => Mage::helper('iifire_cps')->__('Description'),
95
+ 'value' => $model->getDescription(),
96
+ 'required' => false,
97
+ ));
98
+
99
+ $this->setForm($form);
100
+
101
+ return parent::_prepareForm();
102
+ }
103
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Report extends Mage_Adminhtml_Block_Template
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setTemplate('iifire/cps/index.phtml');
13
+ }
14
+
15
+
16
+ protected function _prepareLayout()
17
+ {
18
+ $this->setChild('grid', $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_report_grid', 'report.grid'));
19
+ return parent::_prepareLayout();
20
+
21
+ }
22
+ public function getHeaderText()
23
+ {
24
+ return Mage::helper('iifire_cps')->__('CPS Problem Report');
25
+ }
26
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report/Export.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Report_Export extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('report_id');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+ protected function _prepareCollection()
18
+ {
19
+ $collection = Mage::getModel('iifire_cps/report')
20
+ ->getResourceCollection();
21
+ $this->setCollection($collection);
22
+ return parent::_prepareCollection();
23
+ }
24
+
25
+ protected function _prepareColumns()
26
+ {
27
+ $this->addColumn('report_id', array(
28
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
29
+ 'index' => 'report_id',
30
+ 'type' => 'number',
31
+ ));
32
+ $this->addColumn('report_content', array(
33
+ 'header' => Mage::helper('iifire_cps')->__('Report Content'),
34
+ 'index' => 'report_content',
35
+ ));
36
+ $typeOptions = Mage::helper('iifire_cps')->getReportTypes();
37
+ $this->addColumn('report_type', array(
38
+ 'header' => Mage::helper('iifire_cps')->__('Report Type'),
39
+ 'index' => 'report_type',
40
+ 'type' => 'options',
41
+ 'options' => $typeOptions,
42
+ ));
43
+ $this->addColumn('created_at', array(
44
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
45
+ 'index' => 'created_at',
46
+ 'type' => 'datetime',
47
+ ));
48
+ return parent::_prepareColumns();
49
+ }
50
+ }
app/code/community/Iifire/Cps/Block/Adminhtml/Cps/Report/Grid.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Block_Adminhtml_Cps_Report_Grid extends Mage_Adminhtml_Block_Widget_Grid
8
+ {
9
+ public function __construct()
10
+ {
11
+ parent::__construct();
12
+ $this->setDefaultSort('report_id');
13
+ $this->setDefaultOrder('desc');
14
+ $this->setSaveParametersInSession(true);
15
+ }
16
+
17
+
18
+ protected function _prepareCollection()
19
+ {
20
+ $collection = Mage::getModel('iifire_cps/report')
21
+ ->getResourceCollection();
22
+ $this->setCollection($collection);
23
+ return parent::_prepareCollection();
24
+ }
25
+
26
+ protected function _prepareColumns()
27
+ {
28
+ $this->addColumn('report_id', array(
29
+ 'header' => Mage::helper('iifire_cps')->__('ID'),
30
+ 'index' => 'report_id',
31
+ 'type' => 'number',
32
+ ));
33
+ $this->addColumn('report_content', array(
34
+ 'header' => Mage::helper('iifire_cps')->__('Report Content'),
35
+ 'index' => 'report_content',
36
+ ));
37
+ $typeOptions = Mage::helper('iifire_cps')->getReportTypes();
38
+ $this->addColumn('report_type', array(
39
+ 'header' => Mage::helper('iifire_cps')->__('Report Type'),
40
+ 'index' => 'report_type',
41
+ 'type' => 'options',
42
+ 'options' => $typeOptions,
43
+ ));
44
+ $this->addColumn('created_at', array(
45
+ 'header' => Mage::helper('iifire_cps')->__('Created At'),
46
+ 'index' => 'created_at',
47
+ 'type' => 'datetime',
48
+ ));
49
+ $this->addExportType('*/*/exportCsv', Mage::helper('iifire_cps')->__('CSV'));
50
+ $this->addExportType('*/*/exportXml', Mage::helper('iifire_cps')->__('Excel XML'));
51
+ return parent::_prepareColumns();
52
+ }
53
+
54
+ protected function _prepareMassaction()
55
+ {
56
+ $this->setMassactionIdField('report_id');
57
+
58
+ $this->getMassactionBlock()->addItem('delete', array(
59
+ 'label' => Mage::helper('iifire_cps')->__('Delete'),
60
+ 'url' => $this->getUrl('*/*/massDelete'),
61
+ 'confirm' => Mage::helper('iifire_cps')->__('Are you sure?')
62
+ ));
63
+
64
+ return parent::_prepareMassaction();
65
+ }
66
+ }
app/code/community/Iifire/Cps/Helper/Data.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Helper_Data extends Mage_Core_Helper_Abstract
8
+ {
9
+ protected $_cookiePartnerName = 'cps_partner';
10
+ protected $_cookieSku = 'cps_sku';
11
+ protected $_cookieLogId = 'cps_log_id';
12
+ protected $_lifeTime = 36000;
13
+
14
+ public function __construct()
15
+ {
16
+
17
+ }
18
+ public function getCookieLiftTime()
19
+ {
20
+ $lifeTime = (int)Mage::getSingleton('iifire_cps/cps')->getCookieLiftTime();
21
+ if ($lifeTime) {
22
+ return $lifeTime;
23
+ } else {
24
+ $this->_lifeTime;
25
+ }
26
+ }
27
+ public function setPartnerCookie($partnerId)
28
+ {
29
+ $cookie = $this->_getCookie();
30
+ $cookie->set($this->_cookiePartnerName, $partnerId, $this->getCookieLiftTime(), '/');
31
+ }
32
+ public function getPartnerCookie()
33
+ {
34
+ $cookie = $this->_getCookie();
35
+ return $cookie->get($this->_cookiePartnerName);
36
+ }
37
+ public function setSkuCookie($sku)
38
+ {
39
+ $cookie = $this->_getCookie();
40
+ $cookie->set($this->_cookieSku, $sku, $this->getCookieLiftTime(), '/');
41
+ }
42
+ public function getSkuCookie()
43
+ {
44
+ $cookie = $this->_getCookie();
45
+ return $cookie->get($this->_cookieSku);
46
+ }
47
+ public function setLogCookie($logId)
48
+ {
49
+ $cookie = $this->_getCookie();
50
+ $cookie->set($this->_cookieLogId, $logId, $this->getCookieLiftTime(), '/');
51
+ }
52
+ public function getLogCookie()
53
+ {
54
+ $cookie = $this->_getCookie();
55
+ return $cookie->get($this->_cookieLogId);
56
+ }
57
+ public function emptyCookie()
58
+ {
59
+ $cookie = $this->_getCookie();
60
+ $cookie->set($this->_cookieSku, NULL, $this->getCookieLiftTime(), '/');
61
+ $cookie->set($this->_cookiePartnerName, NULL, $this->getCookieLiftTime(), '/');
62
+ $cookie->set($this->_cookieLogId, NULL, $this->getCookieLiftTime(), '/');
63
+ }
64
+ protected function _getCookie()
65
+ {
66
+ return Mage::getSingleton('core/cookie');
67
+ }
68
+ public function getCustomer()
69
+ {
70
+ return Mage::getSingleton('customer/session')->getCustomer();
71
+ }
72
+ public function isCpsGroup()
73
+ {
74
+ $customer = $this->getCustomer();
75
+ $cpsGroupId = Mage::getModel('iifire_cps/cps')->getCpsGroupId();
76
+ if ($customer->getGroupId()==$cpsGroupId) {
77
+ return true;
78
+ } else {
79
+ return false;
80
+ }
81
+ }
82
+ public function checkDrawAvailable($partnerId,$drawAmount)
83
+ {
84
+ $partner = Mage::getModel('customer/customer')->load($partnerId);
85
+ $cpsAcount = $partner->getCpsAccount() ? $partner->getCpsAccount() : 0;
86
+ $cpsDraw = $partner->getCpsDraw() ? $partner->getCpsDraw() : 0;
87
+ if ($partner->getId() && ($cpsAcount-$cpsDraw-$drawAmount)>0) {
88
+ return true;
89
+ } else {
90
+ return false;
91
+ }
92
+ }
93
+ public function getCpsStatus($status='')
94
+ {
95
+ $array = array(
96
+ Iifire_Cps_Model_Cps::CPS_STATUS_APPROVED => $this->__('Approved'),
97
+ Iifire_Cps_Model_Cps::CPS_STATUS_PENDING => $this->__('Pending'),
98
+ Iifire_Cps_Model_Cps::CPS_STATUS_CANCELED => $this->__('Cancel'),
99
+ );
100
+ if (!is_null($status) && array_key_exists($status, $array)) {
101
+ return $array[$status];
102
+ } else {
103
+ return $array;
104
+ }
105
+ }
106
+ public function getDrawStatus($status='')
107
+ {
108
+ $array = array(
109
+ Iifire_Cps_Model_Draw::DRAW_STATUS_APPROVED => $this->__('Approved'),
110
+ Iifire_Cps_Model_Draw::DRAW_STATUS_PENDING => $this->__('Pending'),
111
+ Iifire_Cps_Model_Draw::DRAW_STATUS_CANCELD => $this->__('Cancel'),
112
+ );
113
+ if (!is_null($status) && array_key_exists($status, $array)) {
114
+ return $array[$status];
115
+ } else {
116
+ return $array;
117
+ }
118
+ }
119
+ public function getReportTypes()
120
+ {
121
+ $array = array(
122
+ Iifire_Cps_Model_Report::CPS_REPORT_TYPE_CPS => $this->__('CPS'),
123
+ Iifire_Cps_Model_Report::CPS_REPORT_TYPE_LOG => $this->__('CPS Log'),
124
+ Iifire_Cps_Model_Report::CPS_REPORT_TYPE_DRAW => $this->__('CPS Draw'),
125
+ );
126
+ return $array;
127
+ }
128
+ }
app/code/community/Iifire/Cps/Model/Cps.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Cps extends Mage_Core_Model_Abstract
8
+ {
9
+ const XML_CPS_GROUP = 'iifire_cps/cps/group_id';
10
+ const XML_CPS_COOKIE_TIME = 'iifire_cps/cps/cookie_life_time';
11
+ const XML_CPS_STATUS_VALID = 'iifire_cps/cps/status_valid';
12
+
13
+ const CPS_STATUS_CANCELED = -1;
14
+ const CPS_STATUS_PENDING = 0;
15
+ const CPS_STATUS_APPROVED = 1;
16
+
17
+ protected function _construct()
18
+ {
19
+ $this->_init('iifire_cps/cps','cps_id');
20
+ }
21
+ public function getCpsGroupId()
22
+ {
23
+ return Mage::getStoreConfig(self::XML_CPS_GROUP);
24
+ }
25
+ public function getCookieLiftTime()
26
+ {
27
+ return Mage::getStoreConfig(self::XML_CPS_COOKIE_TIME);
28
+ }
29
+ public function isCpsAvaiable()
30
+ {
31
+ if ($this->getCpsStatus()==self::CPS_STATUS_APPROVED) {
32
+ return true;
33
+ } else {
34
+ return false;
35
+ }
36
+ }
37
+ public function getStatusArray()
38
+ {
39
+ $statusStr = Mage::getStoreConfig(self::XML_CPS_STATUS_VALID);
40
+ $array = explode(',',$statusStr);
41
+ $statusArray = array();
42
+ if (is_array($array)) {
43
+ foreach ($array as $a){
44
+ $statusArray[$a] = $a;
45
+ }
46
+ }
47
+ return $statusArray;
48
+ }
49
+
50
+ }
app/code/community/Iifire/Cps/Model/Draw.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Draw extends Mage_Core_Model_Abstract
8
+ {
9
+ const XML_CPS_DRAW_MIN = 'iifire_cps/draw/min_draw';
10
+ const XML_CPS_DRAW_MAX = 'iifire_cps/draw/max_draw';
11
+
12
+
13
+ const DRAW_STATUS_CANCELD = -1;
14
+ const DRAW_STATUS_PENDING = 0;
15
+ const DRAW_STATUS_APPROVED = 1;
16
+
17
+ protected function _construct()
18
+ {
19
+ $this->_init('iifire_cps/draw','draw_id');
20
+ }
21
+ public function getMinDraw()
22
+ {
23
+ return Mage::getStoreConfig(self::XML_CPS_DRAW_MIN);
24
+ }
25
+ public function getMaxDraw()
26
+ {
27
+ return Mage::getStoreConfig(self::XML_CPS_DRAW_MAX);
28
+ }
29
+ public function isDrawAmountValid($drawAmount)
30
+ {
31
+ $min = $this->getMinDraw();
32
+ $max = $this->getMaxDraw();
33
+ if (($min && $drawAmount<$min) || ($max && $drawAmount>$max)) {
34
+ return false;
35
+ }
36
+ return true;
37
+ }
38
+ public function isDrawAvaiable()
39
+ {
40
+ if ($this->getDrawStatus()==self::DRAW_STATUS_APPROVED) {
41
+ return true;
42
+ } else {
43
+ return false;
44
+ }
45
+ }
46
+ }
app/code/community/Iifire/Cps/Model/Log.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Log extends Mage_Core_Model_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/log','log_id');
12
+ }
13
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Cps.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Cps extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/cps','cps_id');
12
+ }
13
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
14
+ {
15
+ if (!$object->hasCreatedAt()) {
16
+ $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
17
+ }
18
+
19
+ return parent::_beforeSave($object);
20
+ }
21
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Cps/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Cps_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/cps');
12
+ }
13
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Draw.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Draw extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/draw','draw_id');
12
+ }
13
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
14
+ {
15
+ if (!$object->hasCreatedAt()) {
16
+ $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
17
+ }
18
+
19
+ return parent::_beforeSave($object);
20
+ }
21
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Draw/Collection.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iifire_Cps_Model_Mysql4_Draw_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('iifire_cps/draw');
7
+ }
8
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Log.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Log extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/log','log_id');
12
+ }
13
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
14
+ {
15
+ if (!$object->hasCreatedAt()) {
16
+ $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
17
+ }
18
+ $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
19
+
20
+ return parent::_beforeSave($object);
21
+ }
22
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Log/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Log_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/log');
12
+ }
13
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Partner.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Partner extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/partner','partner_id');
12
+ }
13
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
14
+ {
15
+ if (!$object->hasCreatedAt()) {
16
+ $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
17
+ }
18
+ $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
19
+
20
+ return parent::_beforeSave($object);
21
+ }
22
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Partner/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Partner_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/partner');
12
+ }
13
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Report.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Report extends Mage_Core_Model_Mysql4_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/report','report_id');
12
+ }
13
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
14
+ {
15
+ if (!$object->hasCreatedAt()) {
16
+ $object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
17
+ }
18
+ $object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
19
+
20
+ return parent::_beforeSave($object);
21
+ }
22
+ }
app/code/community/Iifire/Cps/Model/Mysql4/Report/Collection.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Mysql4_Report_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
8
+ {
9
+ protected function _construct()
10
+ {
11
+ $this->_init('iifire_cps/report');
12
+ }
13
+ }
app/code/community/Iifire/Cps/Model/Observer.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Galey <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Observer
8
+ {
9
+ //checkout_submit_all_after
10
+ public function createNewOrder($observer)
11
+ {
12
+ $order = $observer->getEvent()->getOrder();
13
+ $cps = Mage::getModel('iifire_cps/cps');
14
+ $session = Mage::getSingleton('customer/session');
15
+ $helper = Mage::helper('iifire_cps');
16
+ $partnerId = $helper->getPartnerCookie();
17
+ if ($partnerId) {
18
+ $partner = Mage::getModel('customer/customer')->load($partnerId);
19
+ if ($partner->getId()) {
20
+ $cps->setStoreId(Mage::app()->getStore()->getId())
21
+ ->setPartnerId($partnerId)
22
+ ->setLogId($helper->getLogCookie())
23
+ ->setSku($helper->getSkuCookie())
24
+ ->setOrderId($order->getId())
25
+ ->setCommission($partner->getCpsCommission());
26
+ try {
27
+ $cpsId = $cps->save();
28
+ } catch (Exception $e) {
29
+ //set cps problem report
30
+ }
31
+ }
32
+
33
+ }
34
+ return $this;
35
+ }
36
+ protected function _getCookie()
37
+ {
38
+ return Mage::getSingleton('core/cookie');
39
+ }
40
+ }
app/code/community/Iifire/Cps/Model/Partner.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Partner extends Mage_Core_Model_Abstract
8
+ {
9
+
10
+ protected function _construct()
11
+ {
12
+ $this->_init('iifire_cps/partner','partner_id');
13
+ }
14
+ }
app/code/community/Iifire/Cps/Model/Report.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Model_Report extends Mage_Core_Model_Abstract
8
+ {
9
+ const CPS_REPORT_TYPE_CPS = '1';
10
+ const CPS_REPORT_TYPE_LOG = '2';
11
+ const CPS_REPORT_TYPE_DRAW = '3';
12
+ protected function _construct()
13
+ {
14
+ $this->_init('iifire_cps/report','report_id');
15
+ }
16
+ public function getStatusArray()
17
+ {
18
+ $statusStr = Mage::getStoreConfig(self::XML_CPS_STATUS_VALID);
19
+ return explode(',',$statusStr);
20
+ }
21
+ }
app/code/community/Iifire/Cps/Model/System/Status.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Iifire_Cps_Model_System_Status
3
+ {
4
+ protected $_options;
5
+
6
+ public function toOptionArray($isMultiselect=false)
7
+ {
8
+ if (!$this->_options) {
9
+ $this->_options = Mage::getResourceModel('sales/order_status_collection')->loadData()->toOptionArray(false);
10
+ }
11
+ $options = $this->_options;
12
+ if(!$isMultiselect){
13
+ array_unshift($options, array('value'=>'', 'label'=> Mage::helper('adminhtml')->__('--Please Select--')));
14
+ }
15
+
16
+ return $options;
17
+ }
18
+ }
app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/CpsController.php ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Adminhtml_Cps_CpsController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__('CPS Management'));
12
+ $this->loadLayout();
13
+ $this->_setActiveMenu('customer');
14
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_cps'));
15
+ $this->renderLayout();
16
+ }
17
+ public function gridAction()
18
+ {
19
+ $this->loadLayout();
20
+ $this->getResponse()->setBody($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_cps_grid')->toHtml());
21
+ }
22
+ public function approvedAction()
23
+ {
24
+ $id = $this->getRequest()->getParam('id');
25
+ $cps = Mage::getModel('iifire_cps/cps')->load($id);
26
+ if ($cps->getId() && $cps->getPartnerId()) {
27
+ $statusArray = Mage::getSingleton('iifire_cps/cps')->getStatusArray();
28
+ $order = Mage::getModel('sales/order')->load($cps->getOrderId());
29
+ $orderStatus = $order->getStatus();
30
+ if ($order->getId() && in_array($orderStatus,$statusArray)) {
31
+ $cps->setCpsStatus(Iifire_Cps_Model_Cps::CPS_STATUS_APPROVED);
32
+ $partner = Mage::getModel('customer/customer')->load($cps->getPartnerId());
33
+ if ($partner->getId()) {
34
+ $account = $partner->getCpsAccount();
35
+ $account += sprintf("%.2f", $cps->getCommission()*$order->getGrandTotal()*0.01);
36
+ $partner->setCpsAccount($account);
37
+ try {
38
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
39
+ $write->beginTransaction();
40
+ $partner->save();
41
+ $cps->save();
42
+ $write->commit();
43
+ $this->_getSession()->addSuccess(
44
+ Mage::helper('iifire_cps')->__('CPS Order %s have been approved',$order->getIncrementId())
45
+ );
46
+ } catch (Exception $e) {
47
+ $write->rollback();
48
+ $this->_getSession()->addError(
49
+ Mage::helper('iifire_cps')->__('Transaction rollback happened.')
50
+ );
51
+ }
52
+ } else {
53
+ $this->_getSession()->addError(
54
+ Mage::helper('iifire_cps')->__('Partner is not exist.')
55
+ );
56
+ }
57
+ } else {
58
+ $this->_getSession()->addError(
59
+ Mage::helper('iifire_cps')->__('Order id invalid or order status can not be approved.')
60
+ );
61
+ }
62
+ } else {
63
+ $this->_getSession()->addError(
64
+ Mage::helper('iifire_cps')->__('CPS id or partner id is invalid.')
65
+ );
66
+ }
67
+
68
+ $this->_redirect('*/*/index');
69
+ }
70
+ public function massApprovedAction()
71
+ {
72
+ $ids= $this->getRequest()->getParam('massaction');
73
+ if (count($ids)) {
74
+ $i = 0;
75
+ $j = 0;
76
+ $statusArray = Mage::getSingleton('iifire_cps/cps')->getStatusArray();
77
+ foreach ($ids as $id) {
78
+ $cps = Mage::getModel('iifire_cps/cps')->load($id);
79
+ $partner = Mage::getModel('customer/customer')->load($cps->getPartnerId());
80
+ $order = Mage::getModel('sales/order')->load($cps->getOrderId());
81
+ $orderStatus = $order->getStatus();
82
+ if ($cps->getCpsStatus()==Iifire_Cps_Model_Cps::CPS_STATUS_PENDING && $order->getId() && in_array($orderStatus,$statusArray) && $partner->getId()) {
83
+ $cps->setCpsStatus(Iifire_Cps_Model_Cps::CPS_STATUS_APPROVED);
84
+ $partner->setCpsAccount(sprintf("%.2f", $cps->getCommission()*$order->getGrandTotal()*0.01)+$partner->getCpsAccount());
85
+ try {
86
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
87
+ $write->beginTransaction();
88
+ $cps->save();
89
+ $partner->save();
90
+ $write->commit();
91
+ $i++;
92
+ } catch (Exeception $e) {
93
+ $write->rollback();
94
+ $j++;
95
+ }
96
+
97
+ } else {
98
+ $j++;
99
+ }
100
+ }
101
+ if ($i) {
102
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('%s item(s) have been approved.',$i));
103
+ }
104
+ if ($j) {
105
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('%s item(s) can not be approved.',$j));
106
+ }
107
+ } else {
108
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Please select item(s).'));
109
+ }
110
+ $this->_redirect('*/*/index');
111
+ }
112
+ public function massCancelAction()
113
+ {
114
+ $ids= $this->getRequest()->getParam('massaction');
115
+ if (count($ids)) {
116
+ $i = 0;
117
+ $j = 0;
118
+ foreach ($ids as $id) {
119
+ $cps = Mage::getModel('iifire_cps/cps')->load($id);
120
+ if ($cps->getCpsStatus()==Iifire_Cps_Model_Cps::CPS_STATUS_PENDING) {
121
+ $cps->setCpsStatus(Iifire_Cps_Model_Cps::CPS_STATUS_CANCELED);
122
+ try {
123
+ $cps->save();
124
+ $i++;
125
+ } catch (Exeception $e) {
126
+ $j++;
127
+ }
128
+
129
+ } else {
130
+ $j++;
131
+ }
132
+ }
133
+ if ($i) {
134
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('%s item(s) have been canceled.',$i));
135
+ }
136
+ if ($j) {
137
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('%s item(s) can not be canceled.',$j));
138
+ }
139
+ } else {
140
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Please select item(s).'));
141
+ }
142
+ $this->_redirect('*/*/index');
143
+ }
144
+ public function exportCsvAction()
145
+ {
146
+ $fileName = 'cps.csv';
147
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_cps_export')
148
+ ->getCsvFile();
149
+
150
+ $this->_prepareDownloadResponse($fileName, $content);
151
+ }
152
+ public function exportXmlAction()
153
+ {
154
+ $fileName = 'cps.xml';
155
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_cps_export')
156
+ ->getExcelFile();
157
+
158
+ $this->_prepareDownloadResponse($fileName, $content);
159
+ }
160
+ protected function _getSession()
161
+ {
162
+ return Mage::getSingleton('adminhtml/session');
163
+ }
164
+ }
app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/DrawController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Adminhtml_Cps_DrawController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__('CPS'))->_title($this->__('Withdraw Management'));
12
+ $this->loadLayout();
13
+ $this->_setActiveMenu('customer');
14
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_draw'));
15
+ $this->renderLayout();
16
+ }
17
+ public function gridAction()
18
+ {
19
+ $this->loadLayout();
20
+ $this->getResponse()->setBody($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_draw_grid')->toHtml());
21
+ }
22
+ public function approvedAction()
23
+ {
24
+ $id = $this->getRequest()->getParam('id');
25
+ $draw = Mage::getModel('iifire_cps/draw')->load($id);
26
+ $partner = Mage::getModel('customer/customer')->load($draw->getPartnerId());
27
+ if (!$draw->getId() || !$draw->getPartnerId() || !$partner->getId() || $draw->getDrawStatus()!=Iifire_Cps_Model_Draw::DRAW_STATUS_PENDING) {
28
+ $this->_redirect('*/*/index');
29
+ }
30
+ $drawAvailable = Mage::helper('iifire_cps')->checkDrawAvailable($draw->getPartnerId(),$draw->getDrawAmount());
31
+ if ($drawAvailable) {
32
+ $draw->setDrawStatus(Iifire_Cps_Model_Draw::DRAW_STATUS_APPROVED);
33
+ $draw->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
34
+ $partner->setCpsDraw($draw->getDrawAmount()+$partner->getCpsDraw());
35
+ try {
36
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
37
+ $write->beginTransaction();
38
+ $draw->save();
39
+ $partner->save();
40
+ $write->commit();
41
+ $this->_getSession()->addSuccess(
42
+ Mage::helper('iifire_cps')->__('Withdraw #%d have been approved.',$id)
43
+ );
44
+ } catch (Exeception $e) {
45
+ $write->rollback();
46
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('An error occurred when approved withdraw #.',$id));
47
+ }
48
+ }
49
+ $this->_redirect('*/*/index');
50
+ }
51
+ public function massApprovedAction()
52
+ {
53
+ $ids= $this->getRequest()->getParam('massaction');
54
+ if (count($ids)) {
55
+ $i = 0;
56
+ $j = 0;
57
+ foreach ($ids as $id) {
58
+ $draw = Mage::getModel('iifire_cps/draw')->load($id);
59
+ $partner = Mage::getModel('customer/customer')->load($draw->getPartnerId());
60
+ if ($draw->getId() && $draw->getPartnerId() && $partner->getId() && $draw->getDrawStatus()==Iifire_Cps_Model_Draw::DRAW_STATUS_PENDING) {
61
+ $drawAvailable = Mage::helper('iifire_cps')->checkDrawAvailable($draw->getPartnerId(),$draw->getDrawAmount());
62
+ if ($drawAvailable) {
63
+ $draw->setDrawStatus(Iifire_Cps_Model_Draw::DRAW_STATUS_APPROVED);
64
+ $draw->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
65
+ $partner->setCpsDraw($draw->getDrawAmount()+$partner->getCpsDraw());
66
+ try {
67
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
68
+ $write->beginTransaction();
69
+ $draw->save();
70
+ $partner->save();
71
+ $write->commit();
72
+ $i++;
73
+ } catch (Exeception $e) {
74
+ $write->rollback();
75
+ $j++;
76
+ }
77
+ } else {
78
+ $j++;
79
+ }
80
+ } else {
81
+ $j++;
82
+ }
83
+ }
84
+ if ($i) {
85
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('%s item(s) have been approved.',$i));
86
+ }
87
+ if ($j) {
88
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('%s item(s) can not be approved.',$j));
89
+ }
90
+ } else {
91
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Please select item(s).'));
92
+ }
93
+ $this->_redirect('*/*/index');
94
+ }
95
+ public function exportCsvAction()
96
+ {
97
+ $fileName = 'cps_withdraw.csv';
98
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_draw_export')
99
+ ->getCsvFile();
100
+
101
+ $this->_prepareDownloadResponse($fileName, $content);
102
+ }
103
+ public function exportXmlAction()
104
+ {
105
+ $fileName = 'cps_withdraw.xml';
106
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_draw_export')
107
+ ->getExcelFile();
108
+
109
+ $this->_prepareDownloadResponse($fileName, $content);
110
+ }
111
+ protected function _getSession()
112
+ {
113
+ return Mage::getSingleton('adminhtml/session');
114
+ }
115
+ }
app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/LogController.php ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Adminhtml_Cps_LogController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__('CPS'))->_title($this->__('Log Management'));
12
+ $this->loadLayout();
13
+ $this->_setActiveMenu('customer');
14
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_log'));
15
+ $this->renderLayout();
16
+ }
17
+ public function gridAction()
18
+ {
19
+ $this->loadLayout();
20
+ $this->getResponse()->setBody($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_log_grid')->toHtml());
21
+ }
22
+ public function deleteAction()
23
+ {
24
+ $id = (int)$this->getRequest()->getParam('id');
25
+
26
+ $log = Mage::getModel('iifire_cps/log')->load($id);
27
+ if (!$log->getId()) {
28
+ $this->_redirect('*/*/index');
29
+ }
30
+ try {
31
+ $log->delete();
32
+ $this->_getSession()->addSuccess(
33
+ Mage::helper('iifire_cps')->__('1 record have been deleted.')
34
+ );
35
+ } catch (Exception $e) {
36
+ $this->_getSession()->addError($e->getMessage());
37
+ }
38
+ $this->_redirect('*/*/index');
39
+ }
40
+ public function massDeleteAction()
41
+ {
42
+ $ids= $this->getRequest()->getParam('massaction');
43
+ if (count($ids)) {
44
+ $i = 0;
45
+ $j = 0;
46
+ foreach ($ids as $id) {
47
+ $log = Mage::getModel('iifire_cps/log')->load($id);
48
+ try {
49
+ $log->delete();
50
+ $i++;
51
+ } catch (Exception $e) {
52
+ $j++;
53
+ }
54
+ }
55
+ if ($i) {
56
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('%s item(s) have been deleted.',$i));
57
+ }
58
+ if ($j) {
59
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('%s item(s) can not be deleted.',$j));
60
+ }
61
+ } else {
62
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Please select item(s).'));
63
+ }
64
+ $this->_redirect('*/*/index');
65
+ }
66
+ public function exportCsvAction()
67
+ {
68
+ $fileName = 'cps_log.csv';
69
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_log_export')
70
+ ->getCsvFile();
71
+ $this->_prepareDownloadResponse($fileName, $content);
72
+ }
73
+ public function exportXmlAction()
74
+ {
75
+ $fileName = 'cps_log.xml';
76
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_log_export')
77
+ ->getExcelFile();
78
+ $this->_prepareDownloadResponse($fileName, $content);
79
+ }
80
+ protected function _getSession()
81
+ {
82
+ return Mage::getSingleton('adminhtml/session');
83
+ }
84
+ }
app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/PartnerController.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Adminhtml_Cps_PartnerController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->_title($this->__('CPS'))->_title($this->__('Partner Management'));
12
+ $this->loadLayout();
13
+ $this->_setActiveMenu('customer');
14
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner'));
15
+ $this->renderLayout();
16
+ }
17
+ public function gridAction()
18
+ {
19
+ $this->loadLayout();
20
+ $this->getResponse()->setBody($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner_grid')->toHtml());
21
+ }
22
+
23
+ public function editAction()
24
+ {
25
+ $this->loadLayout();
26
+ $this->_title($this->__('CPS'))->_title($this->__('Edit Partner'));
27
+ $this->_setActiveMenu('customer');
28
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner_edit'));
29
+ $this->renderLayout();
30
+ }
31
+ public function saveAction()
32
+ {
33
+ $id = $this->getRequest()->getParam('customer_id');
34
+ $commission = $this->getRequest()->getParam('commission');
35
+ $description = $this->getRequest()->getParam('description');
36
+ if ($id) {
37
+ $partner = Mage::getModel('customer/customer')->load($id);
38
+ $partner->setCpsDescription($description);
39
+ $partner->setCpsCommission(floatval($commission));
40
+ try {
41
+ $partner->save();
42
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('Partner have been saved'));
43
+ } catch (Exception $e) {
44
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('An error occurred when save partner.'));
45
+ }
46
+ } else {
47
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('An error occurred when save partner.'));
48
+ }
49
+ //die();
50
+ if ($this->getRequest()->getParam('continue')) {
51
+ $this->_redirect('*/*/edit',array('id'=>$id));
52
+
53
+ } else {
54
+ $this->_redirect('*/*/index');
55
+ }
56
+
57
+ }
58
+ public function massAssignGroupAction()
59
+ {
60
+ $ids= $this->getRequest()->getParam('massaction');
61
+ $group = (int)$this->getRequest()->getParam('group');
62
+ $groups = Mage::helper('customer')->getGroups()->toOptionArray();
63
+ if (count($ids) && array_key_exists($group,$groups)) {
64
+ $i = 0;
65
+ $j = 0;
66
+ foreach ($ids as $id) {
67
+ if($id) {
68
+ $partner = Mage::getModel('customer/customer')->load($id);
69
+ $partner->setGroupId($group);
70
+ try {
71
+ $partner->save();
72
+ $i++;
73
+ } catch (Exception $e) {
74
+ $j++;
75
+ }
76
+ }
77
+ }
78
+ if ($i) {
79
+ $this->_getSession()->addSuccess(Mage::helper('iifire_cps')->__('Total of %d record(s) were updated.', $i));
80
+ }
81
+ if ($j) {
82
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Total of %d record(s) can not be updated.', $j));
83
+ }
84
+ }
85
+ $this->_redirect('*/*/index');
86
+ }
87
+ public function exportCsvAction()
88
+ {
89
+ $fileName = 'cps_partner.csv';
90
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner_export')
91
+ ->getCsvFile();
92
+
93
+ $this->_prepareDownloadResponse($fileName, $content);
94
+ }
95
+ public function exportXmlAction()
96
+ {
97
+ $fileName = 'cps_partner.xml';
98
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_partner_export')
99
+ ->getExcelFile();
100
+
101
+ $this->_prepareDownloadResponse($fileName, $content);
102
+ }
103
+ protected function _getSession()
104
+ {
105
+ return Mage::getSingleton('adminhtml/session');
106
+ }
107
+ }
app/code/community/Iifire/Cps/controllers/Adminhtml/Cps/ReportController.php.bak ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
4
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_Adminhtml_Cps_ReportController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->loadLayout();
12
+ $this->_setActiveMenu('customer');
13
+ $this->_addContent($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_report'));
14
+ $this->renderLayout();
15
+ }
16
+ public function gridAction()
17
+ {
18
+ $this->loadLayout();
19
+ $this->getResponse()->setBody($this->getLayout()->createBlock('iifire_cps/adminhtml_cps_report_grid')->toHtml());
20
+ }
21
+ public function massDeleteAction()
22
+ {
23
+ $ids= $this->getRequest()->getParam('massaction');
24
+ if (count($ids)) {
25
+ $i = 0;
26
+ $j = 0;
27
+ foreach ($ids as $id) {
28
+ $report = Mage::getModel('iifire_cps/report')->load($id);
29
+ try {
30
+ $report->delete();
31
+ $i++;
32
+ } catch (Exception $e) {
33
+ $j++;
34
+ }
35
+ }
36
+ if ($i) {
37
+ $this->_getSession()->addSuccess(
38
+ Mage::helper('iifire_cps')->__('%d record(s) have been delete.',$i)
39
+ );
40
+ }
41
+ if ($j) {
42
+ $this->_getSession()->addError(
43
+ Mage::helper('iifire_cps')->__('%d record(s) can not be delete.',$j)
44
+ );
45
+ }
46
+ } else {
47
+ $this->_getSession()->addError(Mage::helper('iifire_cps')->__('Please select item(s).'));
48
+ }
49
+ $this->_redirect('*/*/index');
50
+ }
51
+ public function exportCsvAction()
52
+ {
53
+ $fileName = 'cps_problem.csv';
54
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_report_export')
55
+ ->getCsvFile();
56
+
57
+ $this->_prepareDownloadResponse($fileName, $content);
58
+ }
59
+ public function exportXmlAction()
60
+ {
61
+ $fileName = 'cps_problem.xml';
62
+ $content = $this->getLayout()->createBlock('iifire_cps/adminhtml_cps_report_export')
63
+ ->getExcelFile();
64
+
65
+ $this->_prepareDownloadResponse($fileName, $content);
66
+ }
67
+ protected function _getSession()
68
+ {
69
+ return Mage::getSingleton('adminhtml/session');
70
+ }
71
+ }
app/code/community/Iifire/Cps/controllers/DrawController.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.com)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.iifire.com)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_DrawController extends Mage_Core_Controller_Front_Action
8
+ {
9
+ public function preDispatch()
10
+ {
11
+ parent::preDispatch();
12
+ $action = $this->getRequest()->getActionName();
13
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
14
+
15
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
16
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
17
+ }
18
+ if (!Mage::helper('iifire_cps')->isCpsGroup()) {
19
+ $this->_redirect('customer/account');
20
+ }
21
+ }
22
+ public function indexAction()
23
+ {
24
+ $this->_forward('history');
25
+ }
26
+ public function historyAction()
27
+ {
28
+ $this->loadLayout();
29
+ $head = $this->getLayout()->getBlock('head');
30
+ $head->setTitle($this->__('Withdraw History').' - '.$this->__('My CPS Account'));
31
+ $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
32
+ if ($navigationBlock) {
33
+ $navigationBlock->setActive('cps/index');
34
+ }
35
+ $this->_initLayoutMessages('customer/session');
36
+ $this->renderLayout();
37
+ }
38
+ public function newAction()
39
+ {
40
+ $this->loadLayout();
41
+ $head = $this->getLayout()->getBlock('head');
42
+ $head->setTitle($this->__('Submit New Withdraw').' - '.$this->__('My CPS Account'));
43
+ $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
44
+ if ($navigationBlock) {
45
+ //$navigationBlock->addLink('cps', 'cps/index/', 'My CPS Account');
46
+ $navigationBlock->setActive('cps/index');
47
+ }
48
+ $this->_initLayoutMessages('customer/session');
49
+ $this->renderLayout();
50
+ }
51
+
52
+ public function saveAction()
53
+ {
54
+ $partnerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
55
+ $drawAmount = floatval($this->getRequest()->getParam('draw_amount'));
56
+ $description = strip_tags($this->getRequest()->getParam('draw_description'));
57
+ $draw = Mage::getModel('iifire_cps/draw');
58
+ $drawAmountValid = $draw->isDrawAmountValid($drawAmount);
59
+ if ($partnerId && $drawAmount && $drawAmountValid) {
60
+ $helper = Mage::helper('iifire_cps');
61
+ $check = $helper->checkDrawAvailable($partnerId,$drawAmount);
62
+ if ($check) {
63
+ $partner = Mage::getModel('customer/customer')->load($partnerId);
64
+ $draw->setDrawStatus(Iifire_Cps_Model_Draw::DRAW_STATUS_PENDING)
65
+ ->setDrawDescription($description);
66
+ $draw->setPartnerId($partnerId)
67
+ ->setPartnerEmail($partner->getEmail())
68
+ ->setDrawAmount($drawAmount)
69
+ ->setIp(Mage::helper('core/http')->getRemoteAddr(false));
70
+ try {
71
+ $draw->save();
72
+ Mage::getSingleton('customer/session')->addSuccess(
73
+ Mage::helper('iifire_cps')->__('Your Request has been submited,please wait for admin approved')
74
+ );
75
+ } catch (Exeption $e) {
76
+ Mage::getSingleton('customer/session')->addError(
77
+ Mage::helper('iifire_cps')->__('submit failed,please contact admin')
78
+ );
79
+ }
80
+ } else {
81
+ Mage::getSingleton('customer/session')->addError(
82
+ Mage::helper('iifire_cps')->__('The withdraw amount is not available.')
83
+ );
84
+ }
85
+ } else {
86
+ Mage::getSingleton('customer/session')->addError(
87
+ Mage::helper('iifire_cps')->__('The withdraw amount is not available.')
88
+ );
89
+ }
90
+ $this->_redirect('*/draw/new');
91
+ }
92
+
93
+ }
app/code/community/Iifire/Cps/controllers/IndexController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.com)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.iifire.com)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_IndexController extends Mage_Core_Controller_Front_Action
8
+ {
9
+ public function preDispatch()
10
+ {
11
+ parent::preDispatch();
12
+ $action = $this->getRequest()->getActionName();
13
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
14
+
15
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
16
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
17
+ }
18
+ if (!Mage::helper('iifire_cps')->isCpsGroup()) {
19
+ $this->_redirect('customer/account');
20
+ }
21
+ }
22
+ public function indexAction()
23
+ {
24
+ $this->loadLayout();
25
+ $head = $this->getLayout()->getBlock('head');
26
+ $head->setTitle($this->__('My CPS Account'));
27
+ $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
28
+ if ($navigationBlock) {
29
+ $navigationBlock->setActive('cps/index');
30
+ }
31
+ $this->_initLayoutMessages('customer/session');
32
+ $this->renderLayout();
33
+ //Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
34
+ }
35
+ public function historyAction()
36
+ {
37
+ $this->loadLayout();
38
+ $head = $this->getLayout()->getBlock('head');
39
+ $head->setTitle($this->__('View all of my transactions').' - '.$this->__('My CPS Account'));
40
+ $navigationBlock = $this->getLayout()->getBlock('customer_account_navigation');
41
+ if ($navigationBlock) {
42
+ $navigationBlock->setActive('cps/index');
43
+ }
44
+ $this->_initLayoutMessages('customer/session');
45
+ $this->renderLayout();
46
+ }
47
+ }
app/code/community/Iifire/Cps/controllers/PartnerController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.com)
4
+ * @copyright Copyright &copy; 2011, IIFire (http://www.magentokey.com, http://www.iifire.com)
5
+ * @version 1.0.0
6
+ */
7
+ class Iifire_Cps_PartnerController extends Mage_Core_Controller_Front_Action
8
+ {
9
+
10
+ public function indexAction()
11
+ {
12
+
13
+ $partnerId = (int)$this->getRequest()->getParam('aff');
14
+ $sku = $this->getRequest()->getParam('s');
15
+ $helper = Mage::helper('iifire_cps');
16
+ $helper->setPartnerCookie($partnerId);
17
+ $cpsLog = Mage::getModel('iifire_cps/log');
18
+ $cpsLog->setStoreId(Mage::app()->getStore()->getId())
19
+ ->setPartnerId($partnerId)
20
+ ->setSku($sku)
21
+ ->setIp(Mage::helper('core/http')->getRemoteAddr(false));
22
+ try {
23
+ $cpsLog->save();
24
+ $helper->setLogCookie($cpsLog->getId());
25
+ } catch (Exception $e) {
26
+
27
+ }
28
+ if (!$sku) {
29
+ $this->_redirect('/');
30
+ } else {
31
+ $helper->setSkuCookie($sku);
32
+ $productId = Mage::getSingleton('catalog/product')->getIdBySku($sku);
33
+ $product = Mage::getSingleton('catalog/product')->load($productId);
34
+ if($product->getId()&&$product->getProductUrl()) {
35
+ $this->_redirectUrl($product->getProductUrl());
36
+ } else {
37
+ $this->_redirect('/');
38
+ }
39
+ }
40
+ }
41
+ }
app/code/community/Iifire/Cps/etc/adminhtml.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Joy <yanggaojiao@qq.com> (http://www.hifasion.org)
5
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
6
+ * @version 1.0.0
7
+ */
8
+ -->
9
+ <config>
10
+ <menu>
11
+ <customer>
12
+ <children>
13
+ <iifire_cps translate="title" module="iifire_cps">
14
+ <title>CPS Management</title>
15
+ <sort_order>1</sort_order>
16
+ <children>
17
+ <iifire_cps_cps translate="title" module="iifire_cps">
18
+ <title>All CPS</title>
19
+ <action>adminhtml/cps_cps/index</action>
20
+ </iifire_cps_cps>
21
+ <iifire_cps_draw translate="title" module="iifire_cps">
22
+ <title>CPS Withdraw</title>
23
+ <action>adminhtml/cps_draw/index</action>
24
+ </iifire_cps_draw>
25
+ <iifire_cps_partner translate="title" module="iifire_cps">
26
+ <title>CPS Partner</title>
27
+ <action>adminhtml/cps_partner/index</action>
28
+ </iifire_cps_partner>
29
+ <iifire_cps_log translate="title" module="iifire_cps">
30
+ <title>CPS Log</title>
31
+ <action>adminhtml/cps_log/index</action>
32
+ </iifire_cps_log>
33
+ <!--iifire_cps_report translate="title" module="iifire_cps">
34
+ <title>CPS Problem Report</title>
35
+ <action>adminhtml/cps_report/index</action>
36
+ </iifire_cps_report-->
37
+ </children>
38
+ </iifire_cps>
39
+ </children>
40
+ </customer>
41
+ </menu>
42
+ <acl>
43
+ <resources>
44
+ <admin>
45
+ <children>
46
+ <iifire_cps translate="title" module="iifire_cps">
47
+ <title>Cps Management</title>
48
+ <sort_order>1</sort_order>
49
+ <children>
50
+ <iifire_cps_cps translate="title" module="iifire_cps">
51
+ <title>All Cps</title>
52
+ <sort_order>1</sort_order>
53
+ </iifire_cps_cps>
54
+ <iifire_cps_draw translate="title" module="iifire_cps">
55
+ <title>CPS Withdraw</title>
56
+ <sort_order>10</sort_order>
57
+ </iifire_cps_draw>
58
+ <iifire_cps_partner translate="title" module="iifire_cps">
59
+ <title>Cps Partner</title>
60
+ <sort_order>20</sort_order>
61
+ </iifire_cps_partner>
62
+ <iifire_cps_log translate="title" module="iifire_cps">
63
+ <title>Cps Log</title>
64
+ <sort_order>30</sort_order>
65
+ </iifire_cps_log>
66
+ </children>
67
+ </iifire_cps>
68
+ </children>
69
+ </admin>
70
+ </resources>
71
+ </acl>
72
+ </config>
app/code/community/Iifire/Cps/etc/config.xml ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Joy <yanggaojiao@qq.com> (http://www.iifire.com)
5
+ * @copyright Copyright &copy; 2012, Iifire (http://www.iifire.com)
6
+ * @version 1.0.0
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Iifire_Cps>
12
+ <version>1.3.0</version>
13
+ </Iifire_Cps>
14
+ </modules>
15
+ <global>
16
+ <blocks>
17
+ <iifire_cps>
18
+ <class>Iifire_Cps_Block</class>
19
+ </iifire_cps>
20
+ </blocks>
21
+ <helpers>
22
+ <iifire_cps>
23
+ <class>Iifire_Cps_Helper</class>
24
+ </iifire_cps>
25
+ </helpers>
26
+ <rewrite>
27
+ </rewrite>
28
+ <models>
29
+ <iifire_cps>
30
+ <class>Iifire_Cps_Model</class>
31
+ <resourceModel>iifire_cps_mysql4</resourceModel>
32
+ </iifire_cps>
33
+ <iifire_cps_mysql4>
34
+ <class>Iifire_Cps_Model_Mysql4</class>
35
+ <entities>
36
+ <cps>
37
+ <table>iifire_cps</table>
38
+ </cps>
39
+ <log>
40
+ <table>iifire_cps_log</table>
41
+ </log>
42
+ <draw>
43
+ <table>iifire_cps_draw</table>
44
+ </draw>
45
+ <report>
46
+ <table>iifire_cps_report</table>
47
+ </report>
48
+ </entities>
49
+ </iifire_cps_mysql4>
50
+ </models>
51
+ <resources>
52
+ <iifire_cps_setup>
53
+ <setup>
54
+ <module>Iifire_Cps</module>
55
+ </setup>
56
+ </iifire_cps_setup>
57
+ </resources>
58
+ <rewrite>
59
+ <cps_url>
60
+ <from><![CDATA[/cps-partner/]]></from>
61
+ <to><![CDATA[/cps/partner/index/]]></to>
62
+ <complete>1</complete>
63
+ </cps_url>
64
+ </rewrite>
65
+ </global>
66
+ <frontend>
67
+ <layout>
68
+ <updates>
69
+ <iifire_cps>
70
+ <file>iifire_cps.xml</file>
71
+ </iifire_cps>
72
+ </updates>
73
+ </layout>
74
+ <translate>
75
+ <modules>
76
+ <iifire_cps>
77
+ <files>
78
+ <default>Iifire_Cps.csv</default>
79
+ </files>
80
+ </iifire_cps>
81
+ </modules>
82
+ </translate>
83
+ <routers>
84
+ <iifire_cps module="Iifire_Cps">
85
+ <use>standard</use>
86
+ <args>
87
+ <module>Iifire_Cps</module>
88
+ <frontName>cps</frontName>
89
+ </args>
90
+ </iifire_cps>
91
+ </routers>
92
+ <events>
93
+ <checkout_submit_all_after>
94
+ <observers>
95
+ <iifire_cps_observer>
96
+ <class>iifire_cps/observer</class>
97
+ <method>createNewOrder</method>
98
+ </iifire_cps_observer>
99
+ </observers>
100
+ </checkout_submit_all_after>
101
+ </events>
102
+ </frontend>
103
+ <admin>
104
+ <routers>
105
+ <adminhtml>
106
+ <args>
107
+ <modules>
108
+ <Iifire_Cps before="Mage_Adminhtml">Iifire_Cps_Adminhtml</Iifire_Cps>
109
+ </modules>
110
+ </args>
111
+ </adminhtml>
112
+ </routers>
113
+ </admin>
114
+ <adminhtml>
115
+ <translate>
116
+ <modules>
117
+ <Iifire_Cps>
118
+ <files>
119
+ <default>Iifire_Cps.csv</default>
120
+ </files>
121
+ </Iifire_Cps>
122
+ </modules>
123
+ </translate>
124
+ <acl>
125
+ <resources>
126
+ <admin>
127
+ <children>
128
+ <system>
129
+ <children>
130
+ <config>
131
+ <children>
132
+ <iifire_cps>
133
+ <title>Iifire Cps Setting</title>
134
+ </iifire_cps>
135
+ </children>
136
+ </config>
137
+ </children>
138
+ </system>
139
+ </children>
140
+ </admin>
141
+ </resources>
142
+ </acl>
143
+ </adminhtml>
144
+ </config>
app/code/community/Iifire/Cps/etc/system.xml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Galey <yanggaojiao@qq.com> (http://www.hifasion.org)
5
+ * @copyright Copyright &copy; 2011, Hifashion (http://www.magentokey.com, http://www.hifasion.org)
6
+ * @version 1.0
7
+ */
8
+ -->
9
+ <config>
10
+ <sections>
11
+ <iifire_cps translate="label" module="iifire_cps">
12
+ <label>CPS Setting</label>
13
+ <tab>customer</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>1</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <cps translate="label">
21
+ <label>CPS General Setting</label>
22
+ <frontend_type>text</frontend_type>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <group_id translate="label">
29
+ <label>CPS Partner Group ID</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </group_id>
36
+ <status_valid translate="label">
37
+ <label>Avaiable Order Status</label>
38
+ <frontend_type>multiselect</frontend_type>
39
+ <source_model>iifire_cps/system_status</source_model>
40
+ <sort_order>3</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <can_be_empty>1</can_be_empty>
45
+ </status_valid>
46
+ <!--cookie_reset translate="label">
47
+ <label>Reset Cookie When Admin Approved</label>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </cookie_reset-->
55
+ <cookie_life_time>
56
+ <label>Cookie Life Time(s)</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>20</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </cookie_life_time>
63
+
64
+ </fields>
65
+ </cps>
66
+ <draw translate="label">
67
+ <label>Drawing Setting</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>10</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ <fields>
74
+ <min_draw>
75
+ <label>Drawing Min Amount</label>
76
+ <frontend_type>text</frontend_type>
77
+ <sort_order>2</sort_order>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ </min_draw>
82
+ <max_draw translate="label">
83
+ <label>Drawing Max Amount</label>
84
+ <frontend_type>text</frontend_type>
85
+ <sort_order>3</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ <can_be_empty>1</can_be_empty>
90
+ </max_draw>
91
+ </fields>
92
+ </draw>
93
+ </groups>
94
+ </iifire_cps>
95
+ </sections>
96
+ </config>
app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->run("
5
+ DROP TABLE IF EXISTS {$this->getTable('iifire_cps')};
6
+ CREATE TABLE {$this->getTable('iifire_cps')} (
7
+ `cps_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
8
+ `partner_id` int(10) unsigned NOT NULL,
9
+ `log_id` int(10) unsigned DEFAULT NULL,
10
+ `sku` varchar(64) DEFAULT NULL,
11
+ `order_id` int(10) unsigned NOT NULL,
12
+ `commission` decimal(12,4) DEFAULT NULL,
13
+ `status` smallint(6) DEFAULT '0' COMMENT 'CPS Status',
14
+ `created_at` datetime DEFAULT NULL COMMENT 'Created At',
15
+ PRIMARY KEY (`cps_id`),
16
+ KEY `IDX_IIFIRE_CPS_PAERTNER_ID` (`partner_id`),
17
+ KEY `IDX_IIFIRE_CPS_PAERTNER_SKU` (`sku`),
18
+ KEY `IDX_IIFIRE_CPS_PAERTNER_CREATED_AT` (`created_at`)
19
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='IIFIRE CPS';
20
+
21
+ DROP TABLE IF EXISTS {$this->getTable('iifire_cps_log')};
22
+ CREATE TABLE {$this->getTable('iifire_cps_log')} (
23
+ `log_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
24
+ `store_id` smallint(5) unsigned NOT NULL,
25
+ `partner_id` int(10) unsigned NOT NULL,
26
+ `sku` varchar(64) DEFAULT NULL,
27
+ `ip` varchar(64) DEFAULT NULL,
28
+ `created_at` datetime DEFAULT NULL COMMENT 'Created At',
29
+ PRIMARY KEY (`log_id`),
30
+ KEY `FK_IIFIRE_CPS_LOG_STORE` (`store_id`),
31
+ KEY `IDX_IIFIRE_CPS_LOG_ID` (`partner_id`),
32
+ KEY `IDX_IIFIRE_CPS_LOG_CREATED_AT` (`created_at`),
33
+ CONSTRAINT `FK_IIFIRE_CPS_LOG_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`)
34
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='IIFIRE CPS LOG';
35
+
36
+
37
+ DROP TABLE IF EXISTS {$this->getTable('iifire_cps_draw')};
38
+ CREATE TABLE {$this->getTable('iifire_cps_draw')} (
39
+ `draw_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
40
+ `partner_id` int(10) unsigned NOT NULL,
41
+ `draw_amount` decimal(12,4) NOT NULL DEFAULT '0.0000',
42
+ `draw_description` text,
43
+ `draw_status` smallint(6) DEFAULT '0' COMMENT 'Status',
44
+ `partner_email` varchar(255) DEFAULT NULL,
45
+ `is_email` smallint(6) DEFAULT '0' COMMENT 'Is Email',
46
+ `confirm` smallint(6) DEFAULT '0' COMMENT 'Is Confirm',
47
+ `ip` varchar(64) DEFAULT NULL,
48
+ `confirm_code` varchar(64) DEFAULT NULL COMMENT 'Confirm code',
49
+ `updated_at` datetime DEFAULT NULL COMMENT 'Updated At',
50
+ `confirm_at` datetime DEFAULT NULL COMMENT 'Confirm At',
51
+ `created_at` datetime DEFAULT NULL COMMENT 'Created At',
52
+ PRIMARY KEY (`draw_id`),
53
+ KEY `IDX_IIFIRE_CPS_DRAW_PARTNER` (`partner_id`),
54
+ KEY `IDX_IIFIRE_CPS_DRAW_STATUS` (`draw_status`),
55
+ KEY `IDX_IIFIRE_CPS_DRAW_UPDATED_AT` (`updated_at`),
56
+ KEY `IDX_IIFIRE_CPS_DRAW_CONFIRM_AT` (`confirm_at`),
57
+ KEY `IDX_IIFIRE_CPS_DRAW_CREATED_AT` (`created_at`)
58
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='IIFIRE CPS DRAW';
59
+ "
60
+ );
app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.0.0-1.1.0.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = new Mage_Customer_Model_Entity_Setup('customer_setup');
3
+ /* @var $installer Mage_Customer_Model_Entity_Setup */
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute('customer', 'cps_commission', array(
7
+ 'type' => 'decimal',
8
+ 'label' => 'CPS Commission',
9
+ 'visible' => false,
10
+ 'required' => false,
11
+ 'input' => 'text',
12
+ ));
13
+ $installer->addAttribute('customer', 'cps_description', array(
14
+ 'type' => 'text',
15
+ 'label' => 'CPS Description',
16
+ 'visible' => false,
17
+ 'required' => false,
18
+ 'input' => 'text',
19
+ ));
20
+ $installer->endSetup();
app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.1.0-1.2.0.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = new Mage_Customer_Model_Entity_Setup('customer_setup');
3
+ /* @var $installer Mage_Customer_Model_Entity_Setup */
4
+ $installer->startSetup();
5
+
6
+ $installer->addAttribute('customer', 'cps_account', array(
7
+ 'type' => 'decimal',
8
+ 'label' => 'CPS Account',
9
+ 'visible' => false,
10
+ 'required' => false,
11
+ 'input' => 'text',
12
+ ));
13
+ $installer->addAttribute('customer', 'cps_draw', array(
14
+ 'type' => 'decimal',
15
+ 'label' => 'CPS Draw',
16
+ 'visible' => false,
17
+ 'required' => false,
18
+ 'input' => 'text',
19
+ ));
20
+ $installer->endSetup();
app/code/community/Iifire/Cps/sql/iifire_cps_setup/mysql4-upgrade-1.2.0-1.3.0.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->run("
4
+ ALTER TABLE `{$this->getTable('iifire_cps')}` change status cps_status smallint(6) DEFAULT '0';
5
+ ");
app/design/frontend/default/default/layout/iifire_cps.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_css</type><file>css/iifire/cps.css</file></action>
6
+ </reference>
7
+ </default>
8
+ <customer_account translate="label">
9
+ <!--<reference name="customer_account_navigation">
10
+ <action method="addLink" translate="label" module="iifire_cps"><name>cps</name><path>cps/index/</path><label>CPS Account</label></action>
11
+ </reference-->
12
+ </customer_account>
13
+ <iifire_cps_index_index>
14
+ <label>CPS Account</label>
15
+ <update handle="customer_account"/>
16
+ <reference name="my.account.wrapper">
17
+ <block type="iifire_cps/account" name="cps.account">
18
+ <block type="core/template" name="headline" as="headline" template="iifire/cps/account/headline.phtml" />
19
+ <block type="core/text_list" name="cps.account.info" as="info" translate="label">
20
+ <label>CPS Account Info</label>
21
+ </block>
22
+ </block>
23
+ </reference>
24
+ </iifire_cps_index_index>
25
+ <iifire_cps_index_history>
26
+ <label>CPS Account History</label>
27
+ <update handle="customer_account"/>
28
+ <reference name="head">
29
+ <action method="addItem"><type>js</type><file>calendar/calendar.js</file></action>
30
+ <action method="addItem"><type>js</type><file>calendar/calendar-setup.js</file></action>
31
+ <action method="addItem"><type>skin_css</type><file>css/iifire/cps/calendar-win2k-1.css</file></action>
32
+ </reference>
33
+ <reference name="my.account.wrapper">
34
+ <block type="iifire_cps/account_history" name="cps.account.history">
35
+ <block type="core/template" name="headline" as="headline" template="iifire/cps/account/headline.phtml" />
36
+ <block type="iifire_cps/account_filter" name="datefilter" as="datefilter" template="iifire/cps/account/datefilter.phtml" />
37
+ <block type="core/html_calendar" name="calendar" as="calendar" template="page/js/calendar.phtml" />
38
+ <block type="core/text_list" name="cps.account.info" as="info" translate="label">
39
+ <label>CPS Account History</label>
40
+ </block>
41
+ </block>
42
+ </reference>
43
+ </iifire_cps_index_history>
44
+ <iifire_cps_draw_index>
45
+ <label>CPS Draw History</label>
46
+ <update handle="customer_account"/>
47
+ <reference name="my.account.wrapper">
48
+ <block type="iifire_cps/account_draw" name="cps.account.draw">
49
+ <block type="core/template" name="headline" as="headline" template="iifire/cps/account/headline.phtml" />
50
+ <block type="core/text_list" name="cps.account.draw.info" as="draw-info" translate="label">
51
+ <label>CPS Draw History Info</label>
52
+ </block>
53
+ </block>
54
+ </reference>
55
+ </iifire_cps_draw_index>
56
+ <iifire_cps_draw_new>
57
+ <label>New Drawing</label>
58
+ <update handle="customer_account"/>
59
+ <reference name="my.account.wrapper">
60
+ <block type="iifire_cps/account_draw_new" name="cps.account.draw.new">
61
+ <block type="core/template" name="headline" as="headline" template="iifire/cps/account/headline.phtml" />
62
+ </block>
63
+ </reference>
64
+ </iifire_cps_draw_new>
65
+ <iifire_cps_draw_history>
66
+ <label>CPS Withdraw History</label>
67
+ <update handle="customer_account"/>
68
+ <reference name="head">
69
+ <action method="addItem"><type>js</type><file>calendar/calendar.js</file></action>
70
+ <action method="addItem"><type>js</type><file>calendar/calendar-setup.js</file></action>
71
+ <action method="addItem"><type>skin_css</type><file>css/iifire/cps/calendar-win2k-1.css</file></action>
72
+ </reference>
73
+ <reference name="my.account.wrapper">
74
+ <block type="iifire_cps/account_draw_history" name="cps.draw.history">
75
+ <block type="core/template" name="headline" as="headline" template="iifire/cps/account/headline.phtml" />
76
+ <block type="iifire_cps/account_filter" name="datefilter" as="datefilter" template="iifire/cps/account/datefilter.phtml" />
77
+ <block type="core/html_calendar" name="calendar" as="calendar" template="page/js/calendar.phtml" />
78
+ </block>
79
+ </reference>
80
+ </iifire_cps_draw_history>
81
+ </layout>
app/design/frontend/default/default/template/iifire/cps/account/datefilter.phtml ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <form action="" method="get" id="cps-history-form">
2
+ <fieldset class="cps-date">
3
+ <p><span><input type="radio" <?php if($this->getCurrentDateOption()!='dateselect'): ?> checked <?php endif; ?>onclick="iifire_cps_dateoption.dateSelect('timeperiod');" value="timeperiod" id="cps-timeperiod" name="dateoption" class="daterange"></span></p>
4
+ <p>
5
+ <span>
6
+ <?php $currentPeriod = $this->getCurrentTimePeriod(); ?>
7
+ <select name="transactionperiod" id="transactionperiod" onchange="iifire_cps_dateoption.filterHistory('transactionperiod');" <?php if($this->getCurrentDateOption()=='dateselect'): ?> disabled class="disabled" <?php endif; ?>>
8
+ <option value="0"><?php echo $this->__('Select'); ?></option>
9
+ <?php foreach($this->getTimePeriodAsOptions() as $key => $value): ?>
10
+ <option value="<?php echo $key; ?>" <?php if ($currentPeriod==$key):?>selected<?php endif; ?>><?php echo $value; ?></option>
11
+ <?php endforeach; ?>
12
+ </select>
13
+ </span>
14
+ </p>
15
+ <p><span><input type="radio" onclick="iifire_cps_dateoption.dateSelect(true);" value="dateselect" id="cps-dateselect" name="dateoption" class="daterange" <?php if($this->getCurrentDateOption()=='dateselect'): ?> checked <?php endif; ?>></span></p>
16
+ <p><span>
17
+ <input name="from_date" id="from_date" onclick="" value="<?php echo $this->getDefaultFromDate(); ?>" class="input-text" style="width:88px !important;" type="text"> <img src="http://magento1610.com/skin/adminhtml/default/default/images/grid-cal.gif" alt="" class="v-middle" id="from_date_trig" title="Select Date" style="">
18
+ <script type="text/javascript">
19
+ //<![CDATA[
20
+ Calendar.setup({
21
+ inputField: "from_date",
22
+ ifFormat: "%Y-%m-%d",
23
+ showsTime: false,
24
+ button: "from_date_trig",
25
+ align: "Bl",
26
+ singleClick : true
27
+ });
28
+ //]]>
29
+ </script>
30
+ </span></p>
31
+ <p><span><label><?php echo $this->__('to'); ?></label></span></p>
32
+ <p><span>
33
+ <input name="to_date" id="to_date" value="<?php echo $this->getDefaultToDate(); ?>" class="input-text" style="width:88px !important;" type="text"> <img src="http://magento1610.com/skin/adminhtml/default/default/images/grid-cal.gif" alt="" class="v-middle" id="to_date_trig" title="Select Date" style="">
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ Calendar.setup({
37
+ inputField: "to_date",
38
+ ifFormat: "%Y-%m-%d",
39
+ showsTime: false,
40
+ button: "to_date_trig",
41
+ align: "Bl",
42
+ singleClick : true
43
+ });
44
+ //]]>
45
+ </script>
46
+ </span></p>
47
+ <input type="button" <?php if($this->getCurrentDateOption()!='dateselect'): ?> class="disabled" <?php endif; ?> onclick="iifire_cps_dateoption.filterHistory('dateselect');" id="cps-date-btn" name="" value="<?php echo $this->__('Show'); ?>" <?php if($this->getCurrentDateOption()!='dateselect'): ?> disabled <?php endif; ?> />
48
+ <script type="text/javascript">
49
+ //<![CDATA[
50
+ iifire_cps_dateoption = {
51
+ dateSelect: function(type) {
52
+ if(type=='timeperiod') {
53
+ $('cps-date-btn').addClassName('disabled');
54
+ $('cps-date-btn').writeAttribute('disabled',true);
55
+ $('transactionperiod').writeAttribute('disabled',false);
56
+ $('transactionperiod').removeClassName('disabled');
57
+ } else {
58
+ $('cps-date-btn').removeClassName('disabled');
59
+ $('cps-date-btn').writeAttribute('disabled',false);
60
+ $('transactionperiod').writeAttribute('disabled',true);
61
+ $('transactionperiod').addClassName('disabled');
62
+ }
63
+ },
64
+ filterHistory: function(type) {
65
+ if(type=='transactionperiod') {
66
+ if ($('transactionperiod').value) {
67
+ $('cps-history-form').submit();
68
+ }
69
+ } else if (type=='dateselect') {
70
+ if ($('from_date').value) {
71
+ $('cps-history-form').submit();
72
+ }
73
+ }
74
+
75
+ },
76
+ }
77
+ //]]>
78
+ </script>
79
+ </fieldset>
80
+ </form>
app/design/frontend/default/default/template/iifire/cps/account/draw.phtml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
2
+ <div class="page-title">
3
+ <h1><?php echo $this->__('My CPS Draw History') ?></h1>
4
+ </div>
5
+ <?php echo $this->getChildHtml('headline'); ?>
6
+ <?php $_draws = $this->getDraws(); ?>
7
+ <?php $helper = Mage::helper('core'); ?>
8
+ <?php echo $this->getPagerHtml(); ?>
9
+ <?php if($_draws->getSize()): ?>
10
+ <table class="data-table" id="my-cps-draw-table">
11
+ <col width="1" />
12
+ <col width="1" />
13
+ <col width="1" />
14
+ <col width="1" />
15
+ <col width="1" />
16
+ <col width="1" />
17
+ <col width="1" />
18
+ <thead>
19
+ <tr>
20
+ <th><?php echo $this->__('Draw ID') ?></th>
21
+ <th><?php echo $this->__('Date') ?></th>
22
+ <th><?php echo $this->__('Amount') ?></th>
23
+ <th><?php echo $this->__('Status') ?></th>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <?php $_odd = ''; ?>
28
+ <?php $total = 0; ?>
29
+ <?php foreach ($_draws as $_d): ?>
30
+ <tr>
31
+ <td><?php echo $_d->getDrawId() ?></td>
32
+ <td><span class="nobr"><?php echo $this->formatDate($_d->getCreatedAt()) ?></span></td>
33
+ <td><?php echo $_d->getAmount(); ?></td>
34
+ <td><?php echo $_d->getStatus(); ?></td>
35
+ </tr>
36
+ <?php $total += $_d->getAmount(); ?>
37
+ <?php endforeach; ?>
38
+ </tbody>
39
+ <tfoot>
40
+ <tr>
41
+ <td colspan="4" class="a-right">
42
+ <span class="balance"></span>
43
+ <span></span>
44
+ <span class="total"><?php echo $this->__('Total') ?>:&nbsp;<?php echo $helper->formatPrice($total) ?></span>
45
+ </td>
46
+ </tr>
47
+ </tfoot>
48
+ </table>
49
+ <script type="text/javascript">decorateTable('my-cps-draw-table');</script>
50
+ <?php echo $this->getPagerHtml(); ?>
51
+ <?php else: ?>
52
+ <p><?php echo $this->__('You have no CPS draw record.'); ?></p>
53
+ <?php endif ?>
app/design/frontend/default/default/template/iifire/cps/account/draw/form.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $customerInfo = Mage::helper('iifire_cps')->getCustomer(); ?>
2
+ <?php $helper = Mage::helper('core'); ?>
3
+ <div class="cps-account cps-new-draw">
4
+ <div class="page-title">
5
+ <h1 style="float:left;"><?php echo $this->__('My CPS Account') ?></h1><span style="float:right;line-height: 25px;padding-right: 30px;"><a href="<?php echo $this->getUrl('cps/index/'); ?>">&lt;&lt;&nbsp;<?php echo $this->__('Back To CPS Acount'); ?></a></span>
6
+ </div>
7
+ <?php echo $this->getChildHtml('headline'); ?>
8
+ <?php echo $this->getChildHtml('form_fields_before')?>
9
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
10
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
11
+ <div class="fieldset">
12
+ <ul class="form-list">
13
+ <li>
14
+ <label for="draw_amount" class="required"><em>*</em><?php echo $this->__('Withdraw Amount') ?></label>
15
+ <div class="input-box">
16
+ <input type="text" name="draw_amount" id="draw_amount" title="<?php echo $this->__('Withdraw Amount') ?>" class="input-text validate-greater-than-zero required-entry" />
17
+ </div>
18
+ </li>
19
+ <li>
20
+ <label for="draw_description" class="required"><em>*</em><?php echo $this->__('Withdraw Description') ?></label>
21
+ <div class="input-box">
22
+ <textarea name="draw_description" id="draw_description" title="<?php echo $this->__('Withdraw Description') ?>" class="input-text required-entry"></textarea>
23
+ </div>
24
+ </li>
25
+ </ul>
26
+ </div>
27
+ <div class="buttons-set">
28
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
29
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
30
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
31
+ </div>
32
+ </form>
33
+ <script type="text/javascript">
34
+ //<![CDATA[
35
+ var dataForm = new VarienForm('form-validate', true);
36
+ //]]>
37
+ </script>
38
+ </div>
app/design/frontend/default/default/template/iifire/cps/account/draw/history.phtml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getChildHtml('calendar'); ?>
2
+ <div class="cps-account">
3
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
4
+ <?php $customerInfo = Mage::helper('iifire_cps')->getCustomer(); ?>
5
+ <?php $helper = Mage::helper('core'); ?>
6
+ <div class="page-title">
7
+ <h1 style="float:left;"><?php echo $this->__('My CPS Account') ?></h1><span style="float:right;line-height: 25px;padding-right: 30px;"><a href="<?php echo $this->getUrl('cps/index/'); ?>">&lt;&lt;&nbsp;<?php echo $this->__('Back To CPS Acount'); ?></a></span>
8
+ </div>
9
+ <?php echo $this->getChildHtml('headline'); ?>
10
+ <div class="sub-title">
11
+ <h3><?php echo $this->__('Withdraw History') ?></h3>
12
+ </div>
13
+ <?php echo $this->getChildHtml('datefilter'); ?>
14
+ <?php $_draw = $this->getDraw(); ?>
15
+ <div class="cps-datatable">
16
+ <div class="title">
17
+ <h3><?php echo $this->__('My recent withdraw'); ?></h3></div>
18
+ <?php echo $this->getPagerHtml(); ?>
19
+ <?php if($_draw->getSize()): ?>
20
+ <table class="data-table" id="my-cps-table">
21
+ <col width="1" />
22
+ <col width="1" />
23
+ <col width="1" />
24
+ <col width="1" />
25
+ <col width="1" />
26
+ <col width="1" />
27
+ <col width="1" />
28
+ <thead>
29
+ <tr>
30
+ <th><?php echo $this->__('Draw #') ?></th>
31
+ <th><?php echo $this->__('Date') ?></th>
32
+ <th><?php echo $this->__('Description') ?></th>
33
+ <th><?php echo $this->__('Updated Date') ?></th>
34
+ <th><?php echo $this->__('Status') ?></th>
35
+ <th><?php echo $this->__('Amount') ?></th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ <?php $_odd = ''; ?>
40
+ <?php $total = 0; ?>
41
+ <?php foreach ($_draw as $_d): ?>
42
+ <tr>
43
+ <td><?php echo $_d->getDrawId() ?></td>
44
+ <td><span class="nobr"><?php echo $this->formatDate($_d->getCreatedAt()) ?></span></td>
45
+ <td><?php echo $_d->getDrawDescription(); ?></td>
46
+ <td><?php echo $this->formatDate($_d->getUpdatedAt()); ?></td>
47
+ <td><?php echo Mage::helper('iifire_cps')->getDrawStatus($_d->getDrawStatus()); ?></td>
48
+ <td class="a-right"><?php if(!$_d->isDrawAvaiable()): ?>--<?php else: ?><?php echo $helper->formatPrice($_d->getDrawAmount()); ?><?php endif; ?></td>
49
+ </tr>
50
+ <?php if($_d->isDrawAvaiable()): ?>
51
+ <?php $total += sprintf("%.2f", $_d->getDrawAmount()); ?>
52
+ <?php endif; ?>
53
+ <?php endforeach; ?>
54
+ </tbody>
55
+ <tfoot>
56
+ <tr>
57
+ <td colspan="8" class="a-right">
58
+ <span class="balance"></span>
59
+ <span></span>
60
+ <span class="total"><?php echo $this->__('Subtotal') ?>:&nbsp;<?php echo $helper->formatPrice($total) ?></span>
61
+ </td>
62
+ </tr>
63
+ </tfoot>
64
+ </table>
65
+ <?php echo $this->getPagerHtml(); ?>
66
+ <?php else: ?>
67
+ <p><?php echo $this->__('No CPS record found.'); ?></p>
68
+ <?php endif ?>
69
+ </div>
70
+ <script type="text/javascript">decorateTable('my-cps-table');</script>
71
+
72
+ </div>
app/design/frontend/default/default/template/iifire/cps/account/headline.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $helper = Mage::helper('core'); ?>
2
+ <?php $customerInfo = Mage::helper('iifire_cps')->getCustomer(); ?>
3
+ <div class="cps-headline">
4
+ <?php $cpsAcctount = $customerInfo->getCpsAccount(); ?>
5
+ <?php $cpsDraw = $customerInfo->getCpsDraw()?$customerInfo->getCpsDraw():0; ?>
6
+ <?php $balance = $cpsAcctount-$cpsDraw; ?>
7
+ <ul>
8
+ <li><?php echo $this->__('Account Total'); ?>:<?php echo $helper->formatPrice($cpsAcctount); ?></li>
9
+ <li><?php echo $this->__('Withdraw'); ?>:<?php echo $helper->formatPrice($cpsDraw); ?></li>
10
+ <li><?php echo $this->__('Balance'); ?>:<?php echo $helper->formatPrice($balance); ?></li>
11
+
12
+ <li><a title="<?php echo $this->__('Withdraw'); ?>" href="<?php echo $this->getUrl('cps/draw/new/'); ?>"><?php echo $this->__('Withdraw'); ?></a></li>
13
+ <li><a title="<?php echo $this->__('History'); ?>" href="<?php echo $this->getUrl('cps/draw/history/'); ?>"><?php echo $this->__('Withdraw History'); ?></a></li>
14
+ </ul>
15
+ <br class="clear">
16
+ <p><?php echo $this->__('My CPS Url Link '); ?>:<?php echo Mage::getBaseUrl().'cps-partner/?aff='.$customerInfo->getId(); ?></p>
17
+ <br class="clear">
18
+ </div>
app/design/frontend/default/default/template/iifire/cps/account/history.phtml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->getChildHtml('calendar'); ?>
2
+ <div class="cps-account">
3
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
4
+ <?php $customerInfo = Mage::helper('iifire_cps')->getCustomer(); ?>
5
+ <?php $helper = Mage::helper('core'); ?>
6
+ <div class="page-title">
7
+ <h1 style="float:left;"><?php echo $this->__('My CPS Account') ?></h1><span style="float:right;line-height: 25px;padding-right: 30px;"><a href="<?php echo $this->getUrl('cps/index/'); ?>">&lt;&lt;&nbsp;<?php echo $this->__('Back To CPS Acount'); ?></a></span>
8
+ </div>
9
+ <?php echo $this->getChildHtml('headline'); ?>
10
+ <div class="sub-title">
11
+ <h3><?php echo $this->__('CPS History') ?></h3>
12
+ </div>
13
+ <?php echo $this->getChildHtml('datefilter'); ?>
14
+ <?php $_cps = $this->getCps(); ?>
15
+ <div class="cps-datatable">
16
+ <div class="title">
17
+ <h3><?php echo $this->__('My recent activity'); ?></h3></div>
18
+ <?php echo $this->getPagerHtml(); ?>
19
+ <?php if($_cps->getSize()): ?>
20
+ <table class="data-table" id="my-cps-table">
21
+ <col width="1" />
22
+ <col width="1" />
23
+ <col width="1" />
24
+ <col width="1" />
25
+ <col width="1" />
26
+ <col width="1" />
27
+ <col width="1" />
28
+ <thead>
29
+ <tr>
30
+ <th><?php echo $this->__('CPS #') ?></th>
31
+ <th><?php echo $this->__('Date') ?></th>
32
+ <th><?php echo $this->__('SKU') ?></th>
33
+ <th><?php echo $this->__('Order #') ?></th>
34
+ <th><?php echo $this->__('Order Status') ?></th>
35
+ <th><?php echo $this->__('Order Total') ?></th>
36
+ <th><?php echo $this->__('Commission') ?></th>
37
+ <th><?php echo $this->__('CPS Status') ?></th>
38
+ <th><?php echo $this->__('Account') ?></th>
39
+ </tr>
40
+ </thead>
41
+ <tbody>
42
+ <?php $_odd = ''; ?>
43
+ <?php $total = 0; ?>
44
+ <?php foreach ($_cps as $_c): ?>
45
+ <tr>
46
+ <td><?php echo $_c->getCpsId() ?></td>
47
+ <td><span class="nobr"><?php echo $this->formatDate($_c->getCreatedAt()) ?></span></td>
48
+ <td><?php echo $_c->getSku(); ?></td>
49
+ <td><?php echo $_c->getIncrementId(); ?></td>
50
+ <td><?php echo $_c->getStatus(); ?></td>
51
+ <td class="right"><?php echo $helper->formatPrice($_c->getGrandTotal()); ?></td>
52
+ <td class="a-right"><?php echo sprintf("%.2f", $_c->getCommission()).'%'; ?></td>
53
+ <td><?php echo Mage::helper('iifire_cps')->getCpsStatus($_c->getCpsStatus()); ?></td>
54
+ <?php $price = $_c->getGrandTotal()*$_c->getCommission()*0.01; ?>
55
+ <td class="a-right"><?php if(!$_c->isCpsAvaiable()): ?>--<?php else: ?><?php echo $helper->formatPrice($price) ?><?php endif; ?></td>
56
+ </tr>
57
+ <?php if($_c->isCpsAvaiable()): ?>
58
+ <?php $total += sprintf("%.2f", $price); ?>
59
+ <?php endif; ?>
60
+ <?php endforeach; ?>
61
+ </tbody>
62
+ <tfoot>
63
+ <tr>
64
+ <td colspan="9" class="a-right">
65
+ <span class="balance"></span>
66
+ <span></span>
67
+ <span class="total"><?php echo $this->__('Subtotal') ?>:&nbsp;<?php echo $helper->formatPrice($total) ?></span>
68
+ </td>
69
+ </tr>
70
+ </tfoot>
71
+ </table>
72
+ <?php echo $this->getPagerHtml(); ?>
73
+ <?php else: ?>
74
+ <p><?php echo $this->__('No CPS record.'); ?></p>
75
+ <?php endif ?>
76
+ </div>
77
+ <script type="text/javascript">decorateTable('my-cps-table');</script>
78
+
79
+ </div>
app/design/frontend/default/default/template/iifire/cps/account/index.phtml ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="cps-account">
2
+ <?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
3
+ <?php $helper = Mage::helper('core'); ?>
4
+ <div class="page-title">
5
+ <h1><?php echo $this->__('My CPS Account') ?></h1>
6
+ </div>
7
+ <?php echo $this->getChildHtml('headline'); ?>
8
+ <?php $_cps = $this->getCpsCollection(); ?>
9
+ <div class="cps-datatable">
10
+ <div class="title">
11
+ <?php $duration = $this->getDuration(); ?>
12
+ <h3><?php echo $this->__('My recent activity'); ?> - <span><?php echo $this->__('Last 7 days'); ?>&nbsp;(<?php echo substr($duration['from'],0,10); ?> to <?php echo date('Y-m-d') ?>)</span>&nbsp;&nbsp;&nbsp;&nbsp;<span><a href="<?php echo $this->getHistoryUrl(); ?>"><?php echo $this->__('View all of my transactions'); ?></a></span></h3></div>
13
+ <?php echo $this->getPagerHtml(); ?>
14
+ <?php if($_cps->getSize()): ?>
15
+ <table class="data-table" id="my-cps-table">
16
+ <col width="1" />
17
+ <col width="1" />
18
+ <col width="1" />
19
+ <col width="1" />
20
+ <col width="1" />
21
+ <col width="1" />
22
+ <col width="1" />
23
+ <thead>
24
+ <tr>
25
+ <th><?php echo $this->__('CPS #') ?></th>
26
+ <th><?php echo $this->__('Date') ?></th>
27
+ <th><?php echo $this->__('SKU') ?></th>
28
+ <th><?php echo $this->__('Order #') ?></th>
29
+ <th><?php echo $this->__('Order Status') ?></th>
30
+ <th><?php echo $this->__('Order Total') ?></th>
31
+ <th><?php echo $this->__('Commission') ?></th>
32
+ <th><?php echo $this->__('CPS Status') ?></th>
33
+ <th><?php echo $this->__('Account') ?></th>
34
+ </tr>
35
+ </thead>
36
+ <tbody>
37
+ <?php $_odd = ''; ?>
38
+ <?php $total = 0; ?>
39
+ <?php foreach ($_cps as $_c): ?>
40
+ <tr>
41
+ <td><?php echo $_c->getCpsId() ?></td>
42
+ <td><span class="nobr"><?php echo $this->formatDate($_c->getCreatedAt()) ?></span></td>
43
+ <td><?php echo $_c->getSku(); ?></td>
44
+ <td><?php echo $_c->getIncrementId(); ?></td>
45
+ <td><?php echo $_c->getStatus(); ?></td>
46
+ <td><?php echo $helper->formatPrice($_c->getGrandTotal()); ?></td>
47
+ <td><?php echo sprintf("%.2f", $_c->getCommission()).'%'; ?></td>
48
+ <td><?php echo Mage::helper('iifire_cps')->getCpsStatus($_c->getCpsStatus()); ?></td>
49
+ <?php $price = $_c->getGrandTotal()*$_c->getCommission()*0.01; ?>
50
+ <td class="a-right"><?php if(!$_c->isCpsAvaiable()): ?>--<?php else: ?><?php echo $helper->formatPrice($price) ?><?php endif; ?></td>
51
+ </tr>
52
+ <?php if($_c->isCpsAvaiable()): ?>
53
+ <?php $total += sprintf("%.2f", $price); ?>
54
+ <?php endif; ?>
55
+ <?php endforeach; ?>
56
+ </tbody>
57
+ <tfoot>
58
+ <tr>
59
+ <td colspan="9" class="a-right">
60
+ <span class="balance"></span>
61
+ <span></span>
62
+ <span class="total"><?php echo $this->__('Subtotal') ?>:&nbsp;<?php echo $helper->formatPrice($total) ?></span>
63
+ </td>
64
+ </tr>
65
+ </tfoot>
66
+ </table>
67
+ <?php echo $this->getPagerHtml(); ?>
68
+ <?php else: ?>
69
+ <p><?php echo $this->__('No CPS record found.'); ?></p>
70
+ <?php endif ?>
71
+ </div>
72
+ <script type="text/javascript">decorateTable('my-cps-table');</script>
73
+
74
+ </div>
app/etc/modules/Iifire_Cps.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @author Joy <yanggaojiao@qq.com> (http://demo.iifire.com)
5
+ * @copyright Copyright &copy; 2012, Iifire (http://demo.iifire.com)
6
+ * @version 1.0.0
7
+ */
8
+ -->
9
+ <config>
10
+ <modules>
11
+ <Iifire_Cps>
12
+ <active>true</active>
13
+ <codePool>community</codePool>
14
+ <depends>
15
+ <Mage_Core />
16
+ </depends>
17
+ </Iifire_Cps>
18
+ </modules>
19
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>commodity_promotion_solution</name>
4
+ <version>1.3.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Paid advertise commission by percentage of sales income </summary>
10
+ <description>Commodity Promotion Solution&#xD;
11
+ Features&#xD;
12
+ Allow customer register as CPS(Commodity Promotion Solution) Partner&#xD;
13
+ CPS Partner get paid when other customer shopping on your online store&#xD;
14
+ Keep record the orders which submit By clicking on CPS Partner Adversity Links&#xD;
15
+ CPS Partner could check their own records&#xD;
16
+ CPS Partner could withdraw&#xD;
17
+ All withdraw could keep record</description>
18
+ <notes>Customer can subscribe for product price cut and stock available notification which they very interested </notes>
19
+ <authors><author><name>iifire</name><user>yanggaojiao</user><email>yanggaojiao@qq.com</email></author></authors>
20
+ <date>2012-08-22</date>
21
+ <time>09:18:52</time>
22
+ <contents><target name="magecommunity"><dir name="Iifire"><dir name="Cps"><dir name="Block"><dir name="Account"><dir name="Draw"><file name="History.php" hash="b3c7e566fb5fbb1821e29db3a86f5529"/><file name="New.php" hash="7c6a5be1b986e8bdd1d2850e6e815cae"/></dir><file name="Draw.php" hash="1179b9b7c7c1e704b84ca88cce3676a4"/><file name="Filter.php" hash="8fb7ff82af0723747dcb74f04c13d191"/><file name="History.php" hash="e45138ab457cf530b30db4d5d43fdce6"/></dir><file name="Account.php" hash="6bf327d98a577f8780e347c0d99e6b8a"/><dir name="Adminhtml"><dir name="Cps"><dir name="Cps"><file name="Export.php" hash="c4dbeff7a1813514d2089c5ff575e4db"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="844b6059ea099f9bf96953e9d8bc6b12"/><file name="Commission.php" hash="c7136c9a9807796f1b5a765621729694"/></dir></dir><file name="Grid.php" hash="b92f2b10d0ed162ab85ff6e88c2384c5"/></dir><file name="Cps.php" hash="cba9742904b83ae40c20007cf04ca02b"/><dir name="Draw"><file name="Export.php" hash="70f648c0505c7d0cd8e6d15c66d2cb9b"/><dir name="Grid"><dir name="Renderer"><file name="Action.php" hash="35ab0180f97e8bc23659afe372faaa1d"/></dir></dir><file name="Grid.php" hash="826b4d4998accaba2b1626b22bfb01be"/></dir><file name="Draw.php" hash="bd7f3b76e9a0cf90415dbc2fa76e23d4"/><dir name="Log"><file name="Export.php" hash="dd0994601a355c952cc8a474f2a8ff3d"/><file name="Grid.php" hash="0ae35ad30bcf95d398d037679fd62d52"/></dir><file name="Log.php" hash="b8abeb9483672d8831efd31610b7d7cf"/><dir name="Partner"><dir name="Edit"><file name="Form.php" hash="d63615d7c550e47d1071e3c2d90bd002"/></dir><file name="Edit.php" hash="833ca7fd16b9ff0e378dd5705abf38e2"/><file name="Export.php" hash="946462af99e1de004be0a02fcfd1a366"/><dir name="Grid"><dir name="Renderer"><file name="Commission.php" hash="7cc6999a5da7dc7fba7fa21e583a5a13"/></dir></dir><file name="Grid.php" hash="b117326237e833a6fe823ce598208993"/><dir name="New"><file name="Form.php" hash="f3751ee1aaa11e9ba5d064f9f54273ff"/></dir><file name="New.php" hash="46e34824af0ce8771c8cdd4b884f1c43"/></dir><file name="Partner.php" hash="b3fc49d0ba91570d763e6982218cb250"/><dir name="Report"><file name="Export.php" hash="570098f5d0c41d21255b2e35aba5b722"/><file name="Grid.php" hash="7c893256bf2ded6636c134598d1069ae"/></dir><file name="Report.php" hash="ea41b822864a14d6046d44f8098d6e00"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="c308da48889c89ba8094c4eaade68930"/></dir><dir name="Model"><file name="Cps.php" hash="56cdad58aa0743091b9b2ebd61ec5cda"/><file name="Draw.php" hash="71fbfc8971b013e6974e01398c154b1e"/><file name="Log.php" hash="e66bac305707f6033f487ed317c3164b"/><dir name="Mysql4"><dir name="Cps"><file name="Collection.php" hash="77be6bd2ec452244236c2a1e048f385e"/></dir><file name="Cps.php" hash="0ea297b62dfb51ced7a1b6ea8aa520e1"/><dir name="Draw"><file name="Collection.php" hash="9e8239401742c7cb4c54889711ff1bed"/></dir><file name="Draw.php" hash="122e7bdbd905373874bf5b9ba6141b46"/><dir name="Log"><file name="Collection.php" hash="6fb19a6408992421487620590afec90e"/></dir><file name="Log.php" hash="ed4bb08565dfb0498f5a6c53ad49f97b"/><dir name="Partner"><file name="Collection.php" hash="2bf8d7fc9e65d4121a63cb3b3126d5a3"/></dir><file name="Partner.php" hash="f66644c73db3e4340dd1afd86a10d820"/><dir name="Report"><file name="Collection.php" hash="3c8c885c61a712a22f3367f9f046ea03"/></dir><file name="Report.php" hash="3517553aec5eff9253b502abcf385155"/></dir><file name="Observer.php" hash="a35708d2429540525e51536deaf69dd6"/><file name="Partner.php" hash="a9a30d8eacad5524f09099c430d23639"/><file name="Report.php" hash="75cb906f70f7988433b03ffba66d3c13"/><dir name="System"><file name="Status.php" hash="daa71f99a38ac2a288c5f7315a22979e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Cps"><file name="CpsController.php" hash="0b76fbb56cf191ce544b74b8cd6cd666"/><file name="DrawController.php" hash="a44d8d68036d0a3b87a435ae2e8552a3"/><file name="LogController.php" hash="a6f78bcc324471b294d3c0c4bffd71ec"/><file name="PartnerController.php" hash="d34429067213ab483e3038cc8a389299"/><file name="ReportController.php.bak" hash="dba6cf748974e92f6510214a00772a13"/></dir></dir><file name="DrawController.php" hash="b9d363264314d7f85a4f90bd1b9f5160"/><file name="IndexController.php" hash="b4f243af94bc2784f4ba04fd08b282a6"/><file name="PartnerController.php" hash="a647c6dafd76587343b5e60dd92a0fe7"/></dir><dir name="etc"><file name="adminhtml.xml" hash="48f68900197f89e5d83e74f717b277dd"/><file name="config.xml" hash="efb0ea661b47bb244ec30ce9dbefb6d4"/><file name="system.xml" hash="652560f5ef45c5b54e6b1ea9d5ebfb15"/></dir><dir name="sql"><dir name="iifire_cps_setup"><file name="mysql4-install-1.0.0.php" hash="8c28ca45292ab170fdf7413b82cd3e24"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="d5697effedf40ba4712ff34238abd2a6"/><file name="mysql4-upgrade-1.1.0-1.2.0.php" hash="c43732b80cd3393892ac059d9aa4f286"/><file name="mysql4-upgrade-1.2.0-1.3.0.php" hash="db853c0ab439717563bd25fd5069ae51"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Iifire_Cps.xml" hash="31b85fbd6a3d1b00be44786fea5f46a6"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="iifire_cps.xml" hash="f8a7859efda50f1bee55d69b69eb23f1"/></dir><dir name="template"><dir name="iifire"><dir name="cps"><dir name="account"><file name="datefilter.phtml" hash="3809bd9fa4f8bca454205ba8547ea1e2"/><dir name="draw"><file name="form.phtml" hash="a681de1cc4c9662953d8279228933ed4"/><file name="history.phtml" hash="470eb6a105f425d19a2e08cc1dab2070"/></dir><file name="draw.phtml" hash="ccc497b430f440069ffcaa59b5b8d17a"/><file name="headline.phtml" hash="d17e77b5d6781c0d30be1369636be779"/><file name="history.phtml" hash="0fdeca25bab08ba9cf51687fb1a81edd"/><file name="index.phtml" hash="8585b29dc67eea8c3e3045f68df01ec5"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
25
+ </package>