Ifuturz_Productcomment - Version 0.3.0

Version Notes

Third Product Comment Extension

Download this release

Release Info

Developer Iverve
Extension Ifuturz_Productcomment
Version 0.3.0
Comparing to
See all releases


Code changes from version 0.2.1 to 0.3.0

Files changed (71) hide show
  1. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme.php +0 -13
  2. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit.php +0 -46
  3. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Form.php +0 -19
  4. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Tab/Form.php +0 -61
  5. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Tabs.php +0 -24
  6. app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Grid.php +0 -187
  7. app/code/local/Ifuturz/Payme/Block/Payme.php +0 -45
  8. app/code/local/Ifuturz/Payme/Helper/Data.php +0 -6
  9. app/code/local/Ifuturz/Payme/Model/Mysql4/Payme.php +0 -10
  10. app/code/local/Ifuturz/Payme/Model/Mysql4/Payme/Collection.php +0 -22
  11. app/code/local/Ifuturz/Payme/Model/Payme.php +0 -17
  12. app/code/local/Ifuturz/Payme/Model/Status.php +0 -15
  13. app/code/local/Ifuturz/Payme/controllers/Adminhtml/PaymeController.php +0 -269
  14. app/code/local/Ifuturz/Payme/controllers/IndexController.php +0 -133
  15. app/code/local/Ifuturz/Payme/etc/config.xml +0 -120
  16. app/code/local/Ifuturz/Payme/sql/payme_setup/mysql4-install-0.1.0.php +0 -25
  17. app/code/local/Ifuturz/Productcomment/etc/config.xml +1 -1
  18. app/code/local/Ifuturz/Productcomment/sql/productcomment_setup/{mysql4-install-0.2.0.php → mysql4-install-0.3.0.php} +11 -0
  19. app/code/local/Ifuturz/Productcomment/sql/productcomment_setup/mysql4-upgrade-0.2.0-0.2.1.php +0 -18
  20. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Catalog/Product/Tab.php +0 -103
  21. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Customer/Grid.php +0 -125
  22. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup.php +0 -13
  23. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit.php +0 -49
  24. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Form.php +0 -19
  25. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Tab/Form.php +0 -51
  26. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Tabs.php +0 -23
  27. app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Grid.php +0 -68
  28. app/code/local/Ifuturz/Sellergroup/Block/Bankaccount.php +0 -13
  29. app/code/local/Ifuturz/Sellergroup/Block/Editproduct.php +0 -89
  30. app/code/local/Ifuturz/Sellergroup/Block/Publish.php +0 -54
  31. app/code/local/Ifuturz/Sellergroup/Block/Salesreport.php +0 -121
  32. app/code/local/Ifuturz/Sellergroup/Block/Sellergroup.php +0 -61
  33. app/code/local/Ifuturz/Sellergroup/Helper/Data.php +0 -23
  34. app/code/local/Ifuturz/Sellergroup/Model/Checkout/Type/Onepage.php +0 -146
  35. app/code/local/Ifuturz/Sellergroup/Model/Customerbalance.php +0 -10
  36. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Customerbalance.php +0 -10
  37. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Customerbalance/Collection.php +0 -10
  38. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellercommission.php +0 -10
  39. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellercommission/Collection.php +0 -10
  40. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellergroup.php +0 -10
  41. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellergroup/Collection.php +0 -35
  42. app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Setup.php +0 -5
  43. app/code/local/Ifuturz/Sellergroup/Model/Observer-8-7-2013.php +0 -287
  44. app/code/local/Ifuturz/Sellergroup/Model/Observer.php +0 -289
  45. app/code/local/Ifuturz/Sellergroup/Model/Observer.php-original +0 -161
  46. app/code/local/Ifuturz/Sellergroup/Model/Sellercommission.php +0 -10
  47. app/code/local/Ifuturz/Sellergroup/Model/Sellergroup.php +0 -10
  48. app/code/local/Ifuturz/Sellergroup/Model/Sellergroup/Attribute/Source/Sellergroup.php +0 -14
  49. app/code/local/Ifuturz/Sellergroup/controllers/Adminhtml/SellergroupController.php +0 -154
  50. app/code/local/Ifuturz/Sellergroup/controllers/Catalog/ProductController.php +0 -106
  51. app/code/local/Ifuturz/Sellergroup/controllers/IndexController.php +0 -687
  52. app/code/local/Ifuturz/Sellergroup/etc/config.xml +0 -221
  53. app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-install-0.1.0.php +0 -128
  54. app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-upgrade-0.1.0-0.1.1.php +0 -53
  55. app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-upgrade-0.1.1-0.1.2.php +0 -32
  56. app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Form.php +0 -19
  57. app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Tab/Uploadpdf.php +0 -41
  58. app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Tabs.php +0 -186
  59. app/code/local/Ifuturz/Uploadpdf/Helper/Data.php +0 -4
  60. app/code/local/Ifuturz/Uploadpdf/Model/Mysql4/Uploadpdf.php +0 -10
  61. app/code/local/Ifuturz/Uploadpdf/Model/Mysql4/Uploadpdf/Collection.php +0 -25
  62. app/code/local/Ifuturz/Uploadpdf/Model/Observer.php +0 -255
  63. app/code/local/Ifuturz/Uploadpdf/Model/Uploadpdf.php +0 -10
  64. app/code/local/Ifuturz/Uploadpdf/controllers/Adminhtml/UploadpdfController.php +0 -66
  65. app/code/local/Ifuturz/Uploadpdf/controllers/IndexController.php +0 -9
  66. app/code/local/Ifuturz/Uploadpdf/etc/config.xml +0 -108
  67. app/code/local/Ifuturz/Uploadpdf/sql/uploadpdf_setup/mysql4-install-0.2.0.php +0 -21
  68. app/code/local/Ifuturz/Uploadpdf/sql/uploadpdf_setup/mysql4-upgrade-0.2.0-0.2.1.php +0 -18
  69. app/design/frontend/default/default/layout/productcomment.xml +2 -1
  70. app/etc/modules/Ifuturz_Productcomment.xml +1 -1
  71. package.xml +8 -8
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- class Ifuturz_Payme_Block_Adminhtml_Payme extends Mage_Adminhtml_Block_Widget_Grid_Container
3
- {
4
- public function __construct()
5
- {
6
- $this->_controller = 'adminhtml_payme';
7
- $this->_blockGroup = 'payme';
8
- $this->_headerText = Mage::helper('payme')->__('Item Manager');
9
- parent::__construct();
10
- $this->_removeButton('add');
11
- $this->_removeButton('delete');
12
- }
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Block_Adminhtml_Payme_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
-
9
- $this->_objectId = 'id';
10
- $this->_blockGroup = 'payme';
11
- $this->_controller = 'adminhtml_payme';
12
-
13
- $this->_updateButton('save', 'label', Mage::helper('payme')->__('Save Item'));
14
- $this->_updateButton('delete', 'label', Mage::helper('payme')->__('Delete Item'));
15
- // $this->_removeButton('save');
16
-
17
- // $this->_addButton('saveandcontinue', array(
18
- // 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
19
- // 'onclick' => 'saveAndContinueEdit()',
20
- // 'class' => 'save',
21
- // ), -100);
22
-
23
- $this->_formScripts[] = "
24
- function toggleEditor() {
25
- if (tinyMCE.getInstanceById('payme_content') == null) {
26
- tinyMCE.execCommand('mceAddControl', false, 'payme_content');
27
- } else {
28
- tinyMCE.execCommand('mceRemoveControl', false, 'payme_content');
29
- }
30
- }
31
-
32
- function saveAndContinueEdit(){
33
- editForm.submit($('edit_form').action+'back/edit/');
34
- }
35
- ";
36
- }
37
-
38
- public function getHeaderText()
39
- {
40
- if( Mage::registry('payme_data') && Mage::registry('payme_data')->getId() ) {
41
- return Mage::helper('payme')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('payme_data')->getTitle()));
42
- } else {
43
- return Mage::helper('payme')->__('Add Item');
44
- }
45
- }
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Form.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Block_Adminhtml_Payme_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form(array(
8
- 'id' => 'edit_form',
9
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
- 'method' => 'post',
11
- 'enctype' => 'multipart/form-data'
12
- )
13
- );
14
-
15
- $form->setUseContainer(true);
16
- $this->setForm($form);
17
- return parent::_prepareForm();
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Tab/Form.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Block_Adminhtml_Payme_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form();
8
- $this->setForm($form);
9
- $fieldset = $form->addFieldset('payme_form', array('legend'=>Mage::helper('payme')->__('Item information')));
10
-
11
- $payme = Mage::getModel('payme/payme')->load($this->getRequest()->getParam('id'));
12
- $status = $payme->getStatus();
13
- /* $fieldset->addField('title', 'text', array(
14
- 'label' => Mage::helper('payme')->__('Title'),
15
- 'class' => 'required-entry',
16
- 'required' => true,
17
- 'name' => 'title',
18
- ));*/
19
- $fieldset->addField('customer_id', 'text', array(
20
- 'label' => Mage::helper('payme')->__('Customerid'),
21
- 'class' => 'required-entry',
22
- 'required' => true,
23
- // 'name' => 'customer_id',
24
- 'value' => '13'// Mage::getModel('customer/customer')->load('customer_id')->getName()
25
- ));
26
- $fieldset->addField('requested_amount', 'text', array(
27
- 'label' => Mage::helper('payme')->__('Base Amount'),
28
- 'class' => 'required-entry',
29
- 'required' => true,
30
- 'name' => 'requested_amount',
31
- ));
32
- if($status == 1)
33
- {
34
- $fieldset->addField('transition_fee', 'text', array(
35
- 'label' => Mage::helper('payme')->__('Transaction Fee'),
36
- 'class' => 'required-entry',
37
- 'required' => true,
38
- 'name' => 'transition_fee',
39
- ));
40
- }
41
- else
42
- {
43
- $fieldset->addField('transition_fee', 'text', array(
44
- 'label' => Mage::helper('payme')->__('Transaction Fee'),
45
- 'class' => 'required-entry',
46
- 'required' => true,
47
- 'name' => 'transition_fee',
48
- 'readonly' => 'readonly'
49
- ));
50
- }
51
-
52
- if ( Mage::getSingleton('adminhtml/session')->getPaymeData() )
53
- {
54
- $form->setValues(Mage::getSingleton('adminhtml/session')->getPaymeData());
55
- Mage::getSingleton('adminhtml/session')->setPaymeData(null);
56
- } elseif ( Mage::registry('payme_data') ) {
57
- $form->setValues(Mage::registry('payme_data')->getData());
58
- }
59
- return parent::_prepareForm();
60
- }
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Edit/Tabs.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Block_Adminhtml_Payme_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
- {
5
-
6
- public function __construct()
7
- {
8
- parent::__construct();
9
- $this->setId('payme_tabs');
10
- $this->setDestElementId('edit_form');
11
- $this->setTitle(Mage::helper('payme')->__('Amount Information'));
12
- }
13
-
14
- protected function _beforeToHtml()
15
- {
16
- $this->addTab('form_section', array(
17
- 'label' => Mage::helper('payme')->__('Amount Information'),
18
- 'title' => Mage::helper('payme')->__('Amount Information'),
19
- 'content' => $this->getLayout()->createBlock('payme/adminhtml_payme_edit_tab_form')->toHtml(),
20
- ));
21
-
22
- return parent::_beforeToHtml();
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Adminhtml/Payme/Grid.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Block_Adminhtml_Payme_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('paymeGrid');
9
- $this->setDefaultSort('payme_id');
10
- $this->setDefaultDir('desc');
11
- $this->setSaveParametersInSession(true);
12
- }
13
-
14
-
15
- protected function _prepareCollection()
16
- {
17
- $collection = Mage::getModel('payme/payme')->getCollection();
18
-
19
- $collection->getSelect()->join( array('ce1' => 'customer_entity'), 'ce1.entity_id=main_table.customer_id', array('registered_email' => 'email'));
20
- $methodWhereFirstname = "ce2.attribute_id = '1'";
21
- $collection->getSelect()->join( array('ce2' => 'customer_entity_varchar'),'ce2.entity_id=main_table.customer_id',array('firstname' => 'value'))->where($methodWhereFirstname);
22
- $collection->getSelect()->join( array('ce3' => 'customer_entity'), 'ce3.entity_id=main_table.customer_id', array('account_customer' => 'paypal'));
23
-
24
- $this->setCollection($collection);
25
-
26
- return parent::_prepareCollection();
27
- }
28
-
29
- protected function _prepareColumns()
30
- {
31
- $this->addColumn('payme_id', array(
32
- 'header' => Mage::helper('payme')->__('ID'),
33
- 'align' =>'right',
34
- 'width' => '50px',
35
- 'index' => 'payme_id',
36
- ));
37
-
38
- $this->addColumn('customer_id', array(
39
- 'header' => Mage::helper('payme')->__('Customerid'),
40
- 'align' =>'left',
41
- 'index' => 'customer_id',
42
- ));
43
-
44
- $this->addColumn('firstname', array(
45
- 'header' => Mage::helper('payme')->__('Customer Name'),
46
- 'align' =>'left',
47
- 'index' => 'firstname',
48
- ));
49
-
50
- $this->addColumn('registered_email', array(
51
- 'header' => Mage::helper('payme')->__('Registered Email'),
52
- 'align' =>'left',
53
- 'index' => 'registered_email',
54
- ));
55
-
56
-
57
-
58
- $this->addColumn('requested_amount', array(
59
- 'header' => Mage::helper('payme')->__('Requested Amount'),
60
- 'align' =>'left',
61
- //'type' => 'price',
62
- 'type' => 'currency',
63
- 'currency' => 'currency', /* here order currency is field name */
64
- 'index' => 'requested_amount',
65
- ));
66
-
67
-
68
- $this->addColumn('transition_fee', array(
69
- 'header' => Mage::helper('payme')->__('Transition Fee(%)'),
70
- 'align' =>'center',
71
- 'type' => 'text',
72
- 'index' => 'transition_fee',
73
- ));
74
- $this->addColumn('refund', array(
75
- 'header' => Mage::helper('payme')->__('Paid Amount'),
76
- 'align' =>'left',
77
- 'type' => 'currency',
78
- 'currency' => 'currency', /* here currency is field name */
79
- 'index' => 'refund',
80
- ));
81
-
82
- $this->addColumn('currency', array(
83
- 'header' => Mage::helper('payme')->__('Target Currency'),
84
- 'align' =>'left',
85
- 'type' => 'text',
86
- 'index' => 'currency',
87
- ));
88
-
89
- $this->addColumn('payment_method', array(
90
- 'header' => Mage::helper('payme')->__('Payment Method'),
91
- 'align' =>'left',
92
- 'index' => 'payment_method',
93
- ));
94
-
95
- $this->addColumn('account_customer', array(
96
- 'header' => Mage::helper('payme')->__('account customer'),
97
- 'align' =>'left',
98
- 'index' => 'account_customer',
99
- ));
100
-
101
- $this->addColumn('created_time', array(
102
- 'header' => Mage::helper('payme')->__('Requested On'),
103
- 'align' =>'left',
104
- 'index' => 'created_time',
105
- ));
106
- $this->addColumn('update_time', array(
107
- 'header' => Mage::helper('payme')->__('Paid On'),
108
- 'align' =>'left',
109
- 'index' => 'update_time',
110
- ));
111
-
112
- $this->addColumn('status', array(
113
- 'header' => Mage::helper('payme')->__('Status'),
114
- 'align' => 'left',
115
- 'width' => '80px',
116
- 'index' => 'status',
117
- 'type' => 'options',
118
- 'options' => array(
119
- 1 => 'Requested',
120
- 2 => 'Paid',
121
- ),
122
- ));
123
-
124
- // $this->addColumn('action',
125
- // array(
126
- // 'header' => Mage::helper('payme')->__('Action'),
127
- // 'width' => '100',
128
- // 'type' => 'action',
129
- // 'getter' => 'getId',
130
- // 'actions' => array(
131
- // array(
132
- // 'caption' => Mage::helper('payme')->__('Edit'),
133
- // 'url' => array('base'=> '*/*/edit'),
134
- // 'field' => 'id'
135
- // )
136
- // ),
137
- // 'filter' => false,
138
- // 'sortable' => false,
139
- // 'index' => 'stores',
140
- // 'is_system' => true,
141
- // ));
142
-
143
- $this->addExportType('*/*/exportCsv', Mage::helper('payme')->__('CSV'));
144
- $this->addExportType('*/*/exportXml', Mage::helper('payme')->__('XML'));
145
-
146
- return parent::_prepareColumns();
147
- }
148
-
149
- protected function _prepareMassaction()
150
- {
151
- $this->setMassactionIdField('payme_id');
152
- $this->getMassactionBlock()->setFormFieldName('payme');
153
-
154
- // $this->getMassactionBlock()->addItem('delete', array(
155
- // 'label' => Mage::helper('payme')->__('Delete'),
156
- // 'url' => $this->getUrl('*/*/massDelete'),
157
- // 'confirm' => Mage::helper('payme')->__('Are you sure?')
158
- // ));
159
-
160
- //$statuses = Mage::getSingleton('payme/status')->getOptionArray();
161
- $statuses = array(
162
- 1 => 'Requested',
163
- 2 => 'Paid',
164
- );
165
- array_unshift($statuses, array('label'=>'', 'value'=>''));
166
- $this->getMassactionBlock()->addItem('status', array(
167
- 'label'=> Mage::helper('payme')->__('Change status'),
168
- 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
169
- 'additional' => array(
170
- 'visibility' => array(
171
- 'name' => 'status',
172
- 'type' => 'select',
173
- 'class' => 'required-entry',
174
- 'label' => Mage::helper('payme')->__('Status'),
175
- 'values' => $statuses
176
- )
177
- )
178
- ));
179
- return $this;
180
- }
181
-
182
- public function getRowUrl($row)
183
- {
184
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
185
- }
186
-
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Block/Payme.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- class Ifuturz_Payme_Block_Payme extends Mage_Core_Block_Template
3
- {
4
- public function _prepareLayout()
5
- {
6
- return parent::_prepareLayout();
7
- }
8
-
9
- public function getCustomer()
10
- {
11
- return Mage::getSingleton('customer/session')->getCustomer();
12
- }
13
-
14
- public function getPayme()
15
- {
16
- if (!$this->hasData('payme')) {
17
- $this->setData('payme', Mage::registry('payme'));
18
- }
19
- return $this->getData('payme');
20
-
21
- }
22
-
23
-
24
- public function getAddmoney()
25
- {
26
- $cidvar = $this->getCustomer()->getId();
27
- $payme = Mage::getModel('sellergroup/customerbalance')->getCollection()->addFieldTofilter('customer_id',$cidvar);
28
- $paydata = $payme->getData();
29
- $money = $paydata[0]['balance'];
30
- //$money = array_sum($money);
31
- return $money;
32
- }
33
-
34
-
35
-
36
- public function getBalance(){
37
- $money = $this->getAddmoney();
38
- $balance = $money;
39
- return $balance;
40
-
41
-
42
- }
43
-
44
-
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Helper/Data.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Helper_Data extends Mage_Core_Helper_Abstract
4
- {
5
-
6
- }
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Model/Mysql4/Payme.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Model_Mysql4_Payme extends Mage_Core_Model_Mysql4_Abstract
4
- {
5
- public function _construct()
6
- {
7
- // Note that the payme_id refers to the key field in your database table.
8
- $this->_init('payme/payme', 'payme_id');
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Model/Mysql4/Payme/Collection.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Model_Mysql4_Payme_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
- {
5
- public function _construct()
6
- {
7
- parent::_construct();
8
- $this->_init('payme/payme');
9
- }
10
-
11
-
12
-
13
- public function addCustomer($id)
14
- {
15
- // $this->getSelect()->reset();
16
- // $this->getSelect()->from(array("main_table"=>'payme/payme'),array("*"));
17
- //$this->getSelect()->where(" main_table.customer_id = {$id}");
18
- $this->getSelect()->where(" customer_id = {$id}");
19
- return $this;
20
-
21
- }
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Model/Payme.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Model_Payme extends Mage_Core_Model_Abstract
4
- {
5
- private $_statuses = array(1=>"Requested","2"=>"Completed");
6
-
7
- public function _construct()
8
- {
9
- parent::_construct();
10
- $this->_init('payme/payme');
11
- }
12
-
13
-
14
- public function getStatusLabel(){
15
- return $this->_statuses[$this->getStatus()];
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/Model/Status.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Model_Status extends Varien_Object
4
- {
5
- const STATUS_ENABLED = 1;
6
- const STATUS_DISABLED = 2;
7
-
8
- static public function getOptionArray()
9
- {
10
- return array(
11
- self::STATUS_ENABLED => Mage::helper('payme')->__('Enabled'),
12
- self::STATUS_DISABLED => Mage::helper('payme')->__('Disabled')
13
- );
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/controllers/Adminhtml/PaymeController.php DELETED
@@ -1,269 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Payme_Adminhtml_PaymeController extends Mage_Adminhtml_Controller_action
4
- {
5
-
6
- protected function _initAction() {
7
- $this->loadLayout()
8
- ->_setActiveMenu('payme/items')
9
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
-
11
- return $this;
12
- }
13
-
14
- public function indexAction() {
15
- $this->_initAction()
16
- ->renderLayout();
17
- }
18
-
19
- public function editAction() {
20
- $id = $this->getRequest()->getParam('id');
21
- $model = Mage::getModel('payme/payme')->load($id);
22
-
23
- if ($model->getId() || $id == 0) {
24
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
- if (!empty($data)) {
26
- $model->setData($data);
27
- }
28
-
29
- Mage::register('payme_data', $model);
30
-
31
- $this->loadLayout();
32
- $this->_setActiveMenu('payme/items');
33
-
34
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
-
37
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
-
39
- $this->_addContent($this->getLayout()->createBlock('payme/adminhtml_payme_edit'))
40
- ->_addLeft($this->getLayout()->createBlock('payme/adminhtml_payme_edit_tabs'));
41
-
42
- $this->renderLayout();
43
- } else {
44
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payme')->__('Item does not exist'));
45
- $this->_redirect('*/*/');
46
- }
47
- }
48
-
49
- public function newAction() {
50
- $this->_forward('edit');
51
- }
52
-
53
- public function saveAction() {
54
- if ($data = $this->getRequest()->getPost()) {
55
-
56
- $trnsfee = $this->getRequest()->getParam('transition_fee');
57
- $taskprice = $this->getRequest()->getParam('requested_amount');
58
- $refund = $taskprice-(($taskprice*$trnsfee)/100);
59
- $data['refund']=$refund;
60
-
61
-
62
- $model = Mage::getModel('payme/payme');
63
- $model->setData($data)
64
- ->setId($this->getRequest()->getParam('id'));
65
-
66
- try {
67
- /*if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
68
- $model->setCreatedTime(now())
69
- ->setUpdateTime(now());
70
- } else {
71
- $model->setUpdateTime(now());
72
- }*/
73
-
74
- $model->save();
75
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('payme')->__('Item was successfully saved'));
76
- Mage::getSingleton('adminhtml/session')->setFormData(false);
77
-
78
- if ($this->getRequest()->getParam('back')) {
79
- $this->_redirect('*/*/edit', array('id' => $model->getId()));
80
- return;
81
- }
82
- $this->_redirect('*/*/');
83
- return;
84
- } catch (Exception $e) {
85
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
86
- Mage::getSingleton('adminhtml/session')->setFormData($data);
87
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
88
- return;
89
- }
90
- }
91
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payme')->__('Unable to find item to save'));
92
- $this->_redirect('*/*/');
93
- }
94
-
95
- public function deleteAction() {
96
- if( $this->getRequest()->getParam('id') > 0 ) {
97
- try {
98
- $model = Mage::getModel('payme/payme');
99
-
100
- $model->setId($this->getRequest()->getParam('id'))
101
- ->delete();
102
-
103
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
104
- $this->_redirect('*/*/');
105
- } catch (Exception $e) {
106
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
107
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
108
- }
109
- }
110
- $this->_redirect('*/*/');
111
- }
112
-
113
- public function massDeleteAction() {
114
- $paymeIds = $this->getRequest()->getParam('payme');
115
- if(!is_array($paymeIds)) {
116
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
117
- } else {
118
- try {
119
- foreach ($paymeIds as $paymeId) {
120
- $payme = Mage::getModel('payme/payme')->load($paymeId);
121
- $payme->delete();
122
- }
123
- Mage::getSingleton('adminhtml/session')->addSuccess(
124
- Mage::helper('adminhtml')->__(
125
- 'Total of %d record(s) were successfully deleted', count($paymeIds)
126
- )
127
- );
128
- } catch (Exception $e) {
129
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
130
- }
131
- }
132
- $this->_redirect('*/*/index');
133
- }
134
-
135
- public function massStatusAction()
136
- {
137
- if($this->getRequest()->getParam('status') == 1)
138
- {
139
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('You can not change the status to Requested as the selected task is already Refunded'));
140
-
141
- }
142
- else
143
- {
144
- $paymeIds = $this->getRequest()->getParam('payme');
145
- if(!is_array($paymeIds))
146
- {
147
- Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
148
- }
149
- else
150
- {
151
- try
152
- {
153
-
154
- foreach ($paymeIds as $paymeId)
155
- {
156
- $payme = Mage::getSingleton('payme/payme')->load($paymeId);
157
-
158
- if ( $this->getRequest()->getParam('status') == 2 && $payme->getStatus() == 1 )
159
- {
160
- $payme->setStatus($this->getRequest()->getParam('status'))
161
- ->setUpdateTime(now())
162
- ->setIsMassupdate(true)
163
- ->save();
164
-
165
- //$paymentObj = Mage::getSingleton('payme/payme')->load($paymeId);
166
- $sellerbalancemodel = Mage::getModel('sellergroup/customerbalance');
167
-
168
- $sellerbalance_load = $sellerbalancemodel->getCollection()->addFieldToFilter('customer_id',$payme->getCustomerId());
169
- $balancedata = $sellerbalance_load->getData();
170
-
171
- //echo "<pre>"; print_r($balancedata); die;
172
- $updatedbal = $balancedata[0]['balance']-$payme->getRefund();
173
-
174
- $sellerbalancemodel->load($balancedata[0]['balance_id']);
175
- $sellerbalancemodel->setBalance($updatedbal)->save();
176
-
177
- }
178
- else
179
- {
180
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('You can not change the status of Refunded Task'));
181
- return $this->_redirect('*/*/index');
182
- }
183
-
184
- }
185
- $this->_getSession()->addSuccess(
186
- $this->__('Total of %d record(s) were successfully updated', count($paymeIds))
187
- );
188
- }
189
- catch (Exception $e)
190
- {
191
- $this->_getSession()->addError($e->getMessage());
192
- }
193
- }
194
- }
195
- $this->_redirect('*/*/index');
196
- }
197
-
198
- public function exportCsvAction()
199
- {
200
- $fileName = 'payme.csv';
201
- $content = $this->getLayout()->createBlock('payme/adminhtml_payme_grid')
202
- ->getCsv();
203
-
204
- $this->_sendUploadResponse($fileName, $content);
205
- }
206
-
207
- public function exportXmlAction()
208
- {
209
- $fileName = 'payme.xml';
210
- $content = $this->getLayout()->createBlock('payme/adminhtml_payme_grid')
211
- ->getXml();
212
-
213
- $this->_sendUploadResponse($fileName, $content);
214
- }
215
-
216
- protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
217
- {
218
- $response = $this->getResponse();
219
- $response->setHeader('HTTP/1.1 200 OK','');
220
- $response->setHeader('Pragma', 'public', true);
221
- $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
222
- $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
223
- $response->setHeader('Last-Modified', date('r'));
224
- $response->setHeader('Accept-Ranges', 'bytes');
225
- $response->setHeader('Content-Length', strlen($content));
226
- $response->setHeader('Content-type', $contentType);
227
- $response->setBody($content);
228
- $response->sendResponse();
229
- die;
230
- }
231
-
232
- public function viewAction() {
233
- $id = $this->getRequest()->getParam('id');
234
- $model = Mage::getModel('payme/payme')->load($id);
235
-
236
- if ($model->getId() || $id == 0) {
237
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
238
- if (!empty($data)) {
239
- $model->setData($data);
240
- }
241
-
242
- Mage::register('payme_data', $model);
243
-
244
- $this->loadLayout();
245
- $this->_setActiveMenu('payme/items');
246
-
247
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
248
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
249
-
250
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
251
-
252
- $this->_addContent($this->getLayout()->createBlock('payme/adminhtml_payme_view')->setTemplate('payme/view.phtml'))
253
- ->_addLeft($this->getLayout()->createBlock('payme/adminhtml_payme_view_tabs'));
254
-
255
- $this->renderLayout();
256
- } else {
257
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('payme')->__('Item does not exist'));
258
- $this->_redirect('*/*/');
259
- }
260
- }
261
-
262
-
263
- public function view2Action(){
264
- $this->loadLayout();
265
- $this->renderLayout();
266
- }
267
-
268
-
269
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/controllers/IndexController.php DELETED
@@ -1,133 +0,0 @@
1
- <?php
2
- require_once("app/code/core/Mage/Customer/controllers/AccountController.php");
3
- class Ifuturz_Payme_IndexController extends Mage_Customer_AccountController
4
- {
5
-
6
- protected function _getSession()
7
- {
8
- return Mage::getSingleton('customer/session');
9
- }
10
-
11
- public function preDispatch()
12
- {
13
- parent::preDispatch();
14
- if (!$this->_getSession()->isLoggedIn()) {
15
-
16
- $session = Mage::getSingleton("customer/session");
17
- // Store The Current Page Url Where User will be redirected once loggedin
18
- $session->setBeforeAuthUrl(Mage::helper("core/url")->getCurrentUrl());
19
-
20
- $this->_redirect('customer/account/login');
21
- return;
22
- }
23
- }
24
-
25
- public function indexAction()
26
- {
27
- if($this->getRequest()->getParam('id')=='error')
28
- {
29
- // Mage::getSingleton('core/session')->addError('Error');
30
- $button = "<input type='button' name='button' value='Close' id='button' onclick='Modalbox.hide();box();' />" ;
31
- die("Please Enter Withdraw Money..<div class='rightClose'>{$button}</div>");
32
-
33
- }
34
- if($this->getRequest()->getParam('id')=='balance')
35
- {
36
- Mage::getSingleton('core/session')->addError('You don`t have enough money for this operation.');
37
-
38
- }
39
- if($this->getRequest()->getParam('id')=='invalidaccount')
40
- {
41
- $button = "<input type='button' name='button' value='Close' id='button' onclick='Modalbox.hide();box();' />" ;
42
- die("You don't have an account for the selected payment method, therefore you can not withdraw the money. Please define your payment account to the Bank account settings->Received by section on this page..<div class='rightClose'>{$button}</div>");
43
-
44
- }
45
-
46
- $this->loadLayout();
47
- $this->renderLayout();
48
- }
49
-
50
- public function requestAction()
51
- {
52
-
53
- try {
54
- $url = 'payme/index/index/id/error';
55
-
56
- //echo "<pre>"; print_r($this->getRequest()->getParams()); die;
57
- if($this->getRequest()->isPost())
58
- {
59
-
60
- $params = $this->getRequest()->getParam("payme");
61
- $currency = $this->getRequest()->getParam("currency");
62
- $amount = (float) $params["amount"];
63
- $reqmethod = $params["method"];
64
-
65
- $conn = Mage::getSingleton('core/resource')->getConnection('core_write');
66
-
67
- $useracc = $conn->query("select $reqmethod from customer_entity where entity_id='".$this->_getSession()->getCustomerId()."'");
68
- $useracdetail = $useracc->fetch();
69
-
70
- if($amount <= 0){
71
- $this->_redirect('payme/index/index/id/error');
72
- }
73
-
74
- elseif($useracdetail[$reqmethod]=='')
75
- {
76
- $this->_redirect('payme/index/index/id/invalidaccount');
77
- }
78
- else
79
- {
80
- $balance = $this->getBalance();
81
- if(Mage::helper('core')->currency($balance,false)<=0 || (Mage::helper('core')->currency($balance,false)-$amount)<0){
82
- die("You cant withdraw ".(Mage::helper('core')->currency($amount)));
83
- } else {
84
-
85
- $model = Mage::getModel("payme/payme");
86
- $if = $model->setData(array(
87
- "customer_id"=>Mage::getSingleton('customer/session')->getCustomer()->getId(),
88
- "requested_amount"=>$amount,
89
- "payment_method"=>$reqmethod,
90
- "currency"=>strtoupper($currency),
91
- "status"=>1,
92
- "created_time"=>now()
93
- ));
94
-
95
-
96
- // Mage::getSingleton('core/session')->addSuccess('Your request has been sent!');
97
- $idAmmount = $model->save();
98
-
99
- $button = "<input type='button' name='button' value='Close' id='button' onclick='Modalbox.hide();box();' />" ;
100
- die(" We received your withdrawal request for ".(Mage::helper('core')->currency(number_format($amount,2),true,false)).". Please allow 1-3 business days for the delivery of your funds. If you have any questions regarding this transaction, please contact us at <a href=''>contacts</a><div class='rightClose'>{$button}</div>");
101
-
102
-
103
- }
104
-
105
-
106
- }
107
- }
108
- }catch(Exception $ex)
109
- {
110
-
111
-
112
- }
113
-
114
- }
115
- public function getAddmoney()
116
- {
117
- $cidvar = Mage::getSingleton('customer/session')->getCustomer()->getId();
118
- $payme = Mage::getModel('sellergroup/customerbalance')->getCollection()->addFieldTofilter('customer_id',$cidvar);
119
- $paydata = $payme->getData();
120
- $money = $paydata[0]['balance'];
121
- //$money = array_sum($money);
122
- return $money;
123
- }
124
-
125
- public function getBalance(){
126
- $money = $this->getAddmoney();
127
- $balance = $money;
128
- return $balance;
129
-
130
-
131
- }
132
-
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/etc/config.xml DELETED
@@ -1,120 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Ifuturz_Payme>
5
- <version>0.1.0</version>
6
- </Ifuturz_Payme>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <payme>
11
- <use>standard</use>
12
- <args>
13
- <module>Ifuturz_Payme</module>
14
- <frontName>payme</frontName>
15
- </args>
16
- </payme>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <payme>
21
- <file>payme.xml</file>
22
- </payme>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <admin>
27
- <routers>
28
- <payme>
29
- <use>admin</use>
30
- <args>
31
- <module>Ifuturz_Payme</module>
32
- <frontName>payme</frontName>
33
- </args>
34
- </payme>
35
- </routers>
36
- </admin>
37
- <adminhtml>
38
- <menu>
39
- <payme module="payme">
40
- <title>Payme</title>
41
- <sort_order>71</sort_order>
42
- <children>
43
- <items module="payme">
44
- <title>Manage Withdrwals</title>
45
- <sort_order>0</sort_order>
46
- <action>payme/adminhtml_payme</action>
47
- </items>
48
- </children>
49
- </payme>
50
- </menu>
51
- <acl>
52
- <resources>
53
- <all>
54
- <title>Allow Everything</title>
55
- </all>
56
- <admin>
57
- <children>
58
- <Ifuturz_Payme>
59
- <title>Payme Module</title>
60
- <sort_order>10</sort_order>
61
- </Ifuturz_Payme>
62
- </children>
63
- </admin>
64
- </resources>
65
- </acl>
66
- <layout>
67
- <updates>
68
- <payme>
69
- <file>payme.xml</file>
70
- </payme>
71
- </updates>
72
- </layout>
73
- </adminhtml>
74
- <global>
75
- <models>
76
- <payme>
77
- <class>Ifuturz_Payme_Model</class>
78
- <resourceModel>payme_mysql4</resourceModel>
79
- </payme>
80
- <payme_mysql4>
81
- <class>Ifuturz_Payme_Model_Mysql4</class>
82
- <entities>
83
- <payme>
84
- <table>payme</table>
85
- </payme>
86
- </entities>
87
- </payme_mysql4>
88
- </models>
89
- <resources>
90
- <payme_setup>
91
- <setup>
92
- <module>Ifuturz_Payme</module>
93
- </setup>
94
- <connection>
95
- <use>core_setup</use>
96
- </connection>
97
- </payme_setup>
98
- <payme_write>
99
- <connection>
100
- <use>core_write</use>
101
- </connection>
102
- </payme_write>
103
- <payme_read>
104
- <connection>
105
- <use>core_read</use>
106
- </connection>
107
- </payme_read>
108
- </resources>
109
- <blocks>
110
- <payme>
111
- <class>Ifuturz_Payme_Block</class>
112
- </payme>
113
- </blocks>
114
- <helpers>
115
- <payme>
116
- <class>Ifuturz_Payme_Helper</class>
117
- </payme>
118
- </helpers>
119
- </global>
120
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Payme/sql/payme_setup/mysql4-install-0.1.0.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
-
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
-
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('payme')};
10
- CREATE TABLE {$this->getTable('payme')} (
11
- `payme_id` int(11) unsigned NOT NULL auto_increment,
12
- `customer_id` int(10) unsigned NOT NULL,
13
- `requested_amount` decimal(10,2) NULL,
14
- `payment_method` varchar(255) NULL,
15
- `currency` varchar(255) NULL,
16
- `transition_fee` decimal(10,2) NULL,
17
- `refund` decimal(10,4) NULL,
18
- `status` smallint(6) NOT NULL default '0',
19
- `created_time` datetime NULL,
20
- `update_time` datetime NULL,
21
- PRIMARY KEY (`payme_id`)
22
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
23
- ");
24
-
25
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Productcomment/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Ifuturz_Productcomment>
6
- <version>0.2.1</version>
7
  </Ifuturz_Productcomment>
8
  </modules>
9
  <frontend>
3
  <config>
4
  <modules>
5
  <Ifuturz_Productcomment>
6
+ <version>0.3.0</version>
7
  </Ifuturz_Productcomment>
8
  </modules>
9
  <frontend>
app/code/local/Ifuturz/Productcomment/sql/productcomment_setup/{mysql4-install-0.2.0.php → mysql4-install-0.3.0.php} RENAMED
@@ -17,5 +17,16 @@ CREATE TABLE {$this->getTable('productcomment')} (
17
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
 
19
  ");
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  $installer->endSetup();
17
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
 
19
  ");
20
+ $installer->run("
21
+
22
+ -- DROP TABLE IF EXISTS {$this->getTable('productcomment_lck')};
23
+ CREATE TABLE {$this->getTable('productcomment_lck')} (
24
+ `flag` varchar(4),
25
+ `value` ENUM('0','1') DEFAULT 0
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+
28
+ INSERT INTO `{$installer->getTable('productcomment_lck')}` VALUES ('LCK','1');
29
+ ");
30
+
31
 
32
  $installer->endSetup();
app/code/local/Ifuturz/Productcomment/sql/productcomment_setup/mysql4-upgrade-0.2.0-0.2.1.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
-
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('productcomment_lck')};
10
- CREATE TABLE {$this->getTable('productcomment_lck')} (
11
- `flag` varchar(4),
12
- `value` ENUM('0','1') DEFAULT 0
13
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
-
15
- INSERT INTO `{$installer->getTable('productcomment_lck')}` VALUES ('LCK','1');
16
- ");
17
-
18
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Catalog/Product/Tab.php DELETED
@@ -1,103 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Catalog_Product_Tab
4
- extends Mage_Adminhtml_Block_Template
5
- implements Mage_Adminhtml_Block_Widget_Tab_Interface {
6
-
7
- /**
8
- * Set the template for the block
9
- *
10
- */
11
- public function _construct()
12
- {
13
- parent::_construct();
14
-
15
- $this->setTemplate('sellergroup/catalog/product/tab.phtml');
16
- }
17
-
18
-
19
- /**
20
- * Retrieve the label used for the tab relating to this block
21
- *
22
- * @return string
23
- */
24
- public function getTabLabel()
25
- {
26
- return $this->__('Video');
27
- }
28
-
29
- /**
30
- * Retrieve the title used by this tab
31
- *
32
- * @return string
33
- */
34
- public function getTabTitle()
35
- {
36
- return $this->__('Click here to view your Video');
37
- }
38
-
39
- /**
40
- * Determines whether to display the tab
41
- * Add logic here to decide whether you want the tab to display
42
- *
43
- * @return bool
44
- */
45
- public function canShowTab()
46
- {
47
- return true;
48
- }
49
-
50
- /**
51
- * Stops the tab being hidden
52
- *
53
- * @return bool
54
- */
55
- public function isHidden()
56
- {
57
- return false;
58
- }
59
-
60
-
61
- /**
62
- * AJAX TAB's
63
- * If you want to use an AJAX tab, uncomment the following functions
64
- * Please note that you will need to setup a controller to recieve
65
- * the tab content request
66
- *
67
- */
68
- /**
69
- * Retrieve the class name of the tab
70
- * Return 'ajax' here if you want the tab to be loaded via Ajax
71
- *
72
- * return string
73
- */
74
- # public function getTabClass()
75
- # {
76
- # return 'my-custom-tab';
77
- # }
78
-
79
- /**
80
- * Determine whether to generate content on load or via AJAX
81
- * If true, the tab's content won't be loaded until the tab is clicked
82
- * You will need to setup a controller to handle the tab request
83
- *
84
- * @return bool
85
- */
86
- # public function getSkipGenerateContent()
87
- # {
88
- # return false;
89
- # }
90
-
91
- /**
92
- * Retrieve the URL used to load the tab content
93
- * Return the URL here used to load the content by Ajax
94
- * see self::getSkipGenerateContent & self::getTabClass
95
- *
96
- * @return string
97
- */
98
- # public function getTabUrl()
99
- # {
100
- # return null;
101
- # }
102
-
103
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Customer/Grid.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
- include_once 'Mage/Adminhtml/Block/Customer/Grid.php';
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Customer_Grid extends Mage_Adminhtml_Block_Customer_Grid
4
- {
5
- protected function _prepareColumns()
6
- {
7
- $this->addColumn('entity_id', array(
8
- 'header' => Mage::helper('customer')->__('ID'),
9
- 'width' => '50px',
10
- 'index' => 'entity_id',
11
- 'type' => 'number',
12
- ));
13
- /*$this->addColumn('firstname', array(
14
- 'header' => Mage::helper('customer')->__('First Name'),
15
- 'index' => 'firstname'
16
- ));
17
- $this->addColumn('lastname', array(
18
- 'header' => Mage::helper('customer')->__('Last Name'),
19
- 'index' => 'lastname'
20
- ));*/
21
- $this->addColumn('name', array(
22
- 'header' => Mage::helper('customer')->__('Name'),
23
- 'index' => 'name'
24
- ));
25
- $this->addColumn('email', array(
26
- 'header' => Mage::helper('customer')->__('Email'),
27
- 'width' => '150',
28
- 'index' => 'email'
29
- ));
30
-
31
- $groups = Mage::getResourceModel('customer/group_collection')
32
- ->addFieldToFilter('customer_group_id', array('gt'=> 0))
33
- ->load()
34
- ->toOptionHash();
35
-
36
- $this->addColumn('group', array(
37
- 'header' => Mage::helper('customer')->__('Group'),
38
- 'width' => '100',
39
- 'index' => 'group_id',
40
- 'type' => 'options',
41
- 'options' => $groups,
42
- ));
43
-
44
- $sellergroups = Mage::getResourceModel('sellergroup/sellergroup_collection')
45
- ->addFieldToFilter('sellergroup_id', array('gt'=> 0))
46
- ->load()
47
- ->toOptionHash();
48
-
49
- $this->addColumn('sellergroup_id', array(
50
- 'header' => Mage::helper('customer')->__('Seller Groups'),
51
- 'width' => '100',
52
- 'index' => 'sellergroup_id',
53
- 'type' => 'options',
54
- 'options' => $sellergroups,
55
- ));
56
-
57
- $this->addColumn('Telephone', array(
58
- 'header' => Mage::helper('customer')->__('Telephone'),
59
- 'width' => '100',
60
- 'index' => 'billing_telephone'
61
- ));
62
-
63
- $this->addColumn('billing_postcode', array(
64
- 'header' => Mage::helper('customer')->__('ZIP'),
65
- 'width' => '90',
66
- 'index' => 'billing_postcode',
67
- ));
68
-
69
- $this->addColumn('billing_country_id', array(
70
- 'header' => Mage::helper('customer')->__('Country'),
71
- 'width' => '100',
72
- 'type' => 'country',
73
- 'index' => 'billing_country_id',
74
- ));
75
-
76
- $this->addColumn('billing_region', array(
77
- 'header' => Mage::helper('customer')->__('State/Province'),
78
- 'width' => '100',
79
- 'index' => 'billing_region',
80
- ));
81
-
82
- $this->addColumn('customer_since', array(
83
- 'header' => Mage::helper('customer')->__('Customer Since'),
84
- 'type' => 'datetime',
85
- 'align' => 'center',
86
- 'index' => 'created_at',
87
- 'gmtoffset' => true
88
- ));
89
-
90
- if (!Mage::app()->isSingleStoreMode()) {
91
- $this->addColumn('website_id', array(
92
- 'header' => Mage::helper('customer')->__('Website'),
93
- 'align' => 'center',
94
- 'width' => '80px',
95
- 'type' => 'options',
96
- 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true),
97
- 'index' => 'website_id',
98
- ));
99
- }
100
-
101
- $this->addColumn('action',
102
- array(
103
- 'header' => Mage::helper('customer')->__('Action'),
104
- 'width' => '100',
105
- 'type' => 'action',
106
- 'getter' => 'getId',
107
- 'actions' => array(
108
- array(
109
- 'caption' => Mage::helper('customer')->__('Edit'),
110
- 'url' => array('base'=> '*/*/edit'),
111
- 'field' => 'id'
112
- )
113
- ),
114
- 'filter' => false,
115
- 'sortable' => false,
116
- 'index' => 'stores',
117
- 'is_system' => true,
118
- ));
119
-
120
- $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
121
- $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
122
- return parent::_prepareColumns();
123
- }
124
-
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup extends Mage_Adminhtml_Block_Widget_Grid_Container
3
- {
4
- public function __construct()
5
- {
6
-
7
- $this->_controller = 'adminhtml_sellergroup';
8
- $this->_blockGroup = 'sellergroup';
9
- $this->_headerText = Mage::helper('sellergroup')->__('Sellergroup Management');
10
- $this->_addButtonLabel = Mage::helper('sellergroup')->__('Add Sellergroup');
11
- parent::__construct();
12
- }
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
-
9
- $this->_objectId = 'id';
10
- $this->_blockGroup = 'sellergroup';
11
- $this->_controller = 'adminhtml_sellergroup';
12
-
13
- $this->_updateButton('save', 'label', Mage::helper('sellergroup')->__('Save Sellergroup'));
14
- $this->_updateButton('delete', 'label', Mage::helper('sellergroup')->__('Delete Sellergroup'));
15
-
16
- $this->_addButton('saveandcontinue', array(
17
- 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
- 'onclick' => 'saveAndContinueEdit()',
19
- 'class' => 'save',
20
- ), -100);
21
-
22
- $this->_formScripts[] = "
23
- function toggleEditor() {
24
- if (tinyMCE.getInstanceById('sellergroup_content') == null) {
25
- tinyMCE.execCommand('mceAddControl', false, 'sellergroup_content');
26
- } else {
27
- tinyMCE.execCommand('mceRemoveControl', false, 'sellergroup_content');
28
- }
29
- }
30
-
31
- function saveAndContinueEdit(){
32
- editForm.submit($('edit_form').action+'back/edit/');
33
- }
34
- ";
35
- }
36
-
37
- public function getHeaderText()
38
- {
39
- if( Mage::registry('sellergroup_data') && Mage::registry('sellergroup_data')->getId() )
40
- {
41
- //$name=Mage::getModel('register')->getCollection()->getCountryName(Mage::registry('register_data')->getCountry());
42
- return Mage::helper('sellergroup')->__("Edit Sellergroup '%s'", $this->htmlEscape(Mage::registry('sellergroup_data')->getSellergroupName()));
43
- }
44
- else
45
- {
46
- return Mage::helper('sellergroup')->__('Add Sellergroup');
47
- }
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Form.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form(array(
8
- 'id' => 'edit_form',
9
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
- 'method' => 'post',
11
- 'enctype' => 'multipart/form-data'
12
- )
13
- );
14
-
15
- $form->setUseContainer(true);
16
- $this->setForm($form);
17
- return parent::_prepareForm();
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Tab/Form.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setTemplate('sellergroup/form.phtml');
9
- }
10
-
11
- protected function _prepareForm()
12
- {
13
- $form = new Varien_Data_Form();
14
- $this->setForm($form);
15
- $fieldset = $form->addFieldset('sellergroup_form', array('legend'=>Mage::helper('sellergroup')->__('Sellergroup information')));
16
-
17
-
18
- $fieldset->addField('seller_group_code', 'text', array(
19
- 'label' => Mage::helper('sellergroup')->__('Seller Group Name'),
20
- 'class' => 'required-entry',
21
- 'required' => true,
22
- 'name' => 'seller_group_code',
23
- 'values' => $seller_group_code ,
24
- ));
25
-
26
- $fieldset->addField('seller_commission', 'text', array(
27
- 'label' => Mage::helper('sellergroup')->__('Seller Commission'),
28
- 'class' => 'required-entry',
29
- 'required' => true,
30
- 'name' => 'seller_commission',
31
- 'values' => $seller_commission ,
32
- ));
33
- $fieldset->addField('sellergroup_upgrade_threshold', 'text', array(
34
- 'label' => Mage::helper('sellergroup')->__('Sellergroup Upgrade To Next Level Threshold'),
35
- 'class' => 'required-entry',
36
- 'required' => true,
37
- 'name' => 'sellergroup_upgrade_threshold',
38
- 'values' => $sellergroup_upgrade_threshold ,
39
- ));
40
-
41
-
42
- if ( Mage::getSingleton('adminhtml/session')->getsellergroupData() )
43
- {
44
- $form->setValues(Mage::getSingleton('adminhtml/session')->getsellergroupData());
45
- Mage::getSingleton('adminhtml/session')->setsellergroupData(null);
46
- } elseif ( Mage::registry('sellergroup_data') ) {
47
- $form->setValues(Mage::registry('sellergroup_data')->getData());
48
- }
49
- return parent::_prepareForm();
50
- }
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Edit/Tabs.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
- {
4
-
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('sellergroup_tabs');
9
- $this->setDestElementId('edit_form');
10
- $this->setTitle(Mage::helper('sellergroup')->__('Sellergroup Information'));
11
- }
12
-
13
- protected function _beforeToHtml()
14
- {
15
- $this->addTab('form_section', array(
16
- 'label' => Mage::helper('sellergroup')->__('Sellergroup Information'),
17
- 'title' => Mage::helper('sellergroup')->__('Sellergroup Information'),
18
- 'content' => $this->getLayout()->createBlock('sellergroup/adminhtml_sellergroup_edit_tab_form')->toHtml(),
19
- ));
20
-
21
- return parent::_beforeToHtml();
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Adminhtml/Sellergroup/Grid.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Adminhtml_Sellergroup_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
- {
5
- public function __construct()
6
- {
7
- parent::__construct();
8
- $this->setId('sellergroupGrid');
9
- $this->setDefaultSort('sellergroup_id');
10
- $this->setDefaultDir('ASC');
11
- $this->setSaveParametersInSession(true);
12
- }
13
-
14
- protected function _prepareCollection()
15
- {
16
- $collection = Mage::getModel('sellergroup/sellergroup')->getCollection();
17
- //echo "<pre>"; print_r($collection->getData());exit;
18
- $this->setCollection($collection);
19
- return parent::_prepareCollection();
20
- }
21
-
22
- protected function _prepareColumns()
23
- {
24
-
25
- $this->addColumn('sellergroup_id', array(
26
- 'header' => Mage::helper('sellergroup')->__('ID'),
27
- 'align' =>'left',
28
- 'index' => 'sellergroup_id',
29
- 'width' => '100',
30
- ));
31
- $this->addColumn('seller_group_code', array(
32
- 'header' => Mage::helper('sellergroup')->__('Seller Group Name'),
33
- 'index' => 'seller_group_code',
34
- ));
35
- $this->addColumn('seller_commission', array(
36
- 'header' => Mage::helper('sellergroup')->__('Seller Commission (%)'),
37
- 'index' => 'seller_commission',
38
- 'width' => '100'
39
- ));
40
- $this->addColumn('sellergroup_upgrade_threshold', array(
41
- 'header' => Mage::helper('sellergroup')->__('Sellergroup Upgrade Threshold'),
42
- 'index' => 'sellergroup_upgrade_threshold',
43
- 'width' => '100'
44
- ));
45
-
46
-
47
- return parent::_prepareColumns();
48
- }
49
-
50
- protected function _prepareMassaction()
51
- {
52
- $this->setMassactionIdField('sellergroup_id');
53
- $this->getMassactionBlock()->setFormFieldName('sellergroup');
54
-
55
- $this->getMassactionBlock()->addItem('delete', array(
56
- 'label' => Mage::helper('sellergroup')->__('Delete'),
57
- 'url' => $this->getUrl('*/*/massDelete'),
58
- 'confirm' => Mage::helper('sellergroup')->__('Are you sure?')
59
- ));
60
- return $this;
61
- }
62
-
63
- public function getRowUrl($row)
64
- {
65
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
66
- }
67
-
68
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Bankaccount.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Block_Bankaccount extends Mage_Core_Block_Template
3
- {
4
- public function __construct()
5
- {
6
- parent::__construct();
7
- }
8
-
9
- protected function _prepareLayout()
10
- {
11
- parent::_prepareLayout();
12
- }
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Editproduct.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Editproduct extends Mage_Core_Block_Template
4
- {
5
- protected $_subscription = null;
6
-
7
- protected function _construct()
8
- {
9
- $this->conn = Mage::getSingleton('core/resource')->getConnection('core_read');
10
- $this->customer_id = Mage::getSingleton('customer/session')->getCustomerId();
11
- $this->storeId = Mage::app()->getStore()->getId();
12
- $this->task_id = (int)$this->getRequest()->getParam('id');
13
- // d($this->task_id);
14
- $this->initList();
15
- }
16
-
17
- public function initList()
18
- {
19
-
20
- }
21
-
22
- public function getProductById()
23
- {
24
- return Mage::getModel('catalog/product')->load((int)$this->getRequest()->getParam('id'));
25
-
26
- }
27
-
28
- public function res($cur_category, $idCat){
29
- // dd($cur_category);
30
- $cat_mod = Mage::getModel('catalog/category');
31
- $categoryObj = $cat_mod->load($cur_category);//->getChildrenCategories();
32
- if($categoryObj->hasChildren()){
33
- ?> <ul> <?php
34
- $children_categories =$categoryObj->getChildrenCategories();
35
- //echo "<pre>";print_r($children_categories);
36
- foreach($children_categories as $v):
37
- $all_data = $v->getData();
38
- $nm = $all_data['name'];
39
- $jid = $v->getId(); ?>
40
- <li id="<?php echo $jid; ?>">
41
- <span><?php echo $nm?></span>
42
- <?php if(!$v->hasChildren()):?>
43
- <input class="required-entry <?php echo 'class'.$idCat?> classinput" type="checkbox" name="category['<?=$nm?>']" id='category' value="<?php echo $v->getId();?>">
44
- <?php else:?>
45
- <span class="expand-child">&nbsp;</span>
46
- <?php endif;?>
47
- <?php $this->res($v->getId(),$idCat);?>
48
- </li>
49
-
50
- <?php
51
- endforeach;
52
- ?> </ul> <?php
53
- }
54
-
55
- }
56
-
57
- public function getAttributeValueById($idAtt){
58
- $idAtt = (int) $idAtt;
59
- $model_att = Mage::getModel('eav/entity_attribute');
60
- // $att_id = $model_att->getIdByCode( 'catalog_product', 'color' );
61
- $attributes = $model_att->load($idAtt);
62
- // Get the literal value
63
- $model_att_options = Mage::getModel('eav/entity_attribute_source_table'); // We get the model handling eav_attribute_option
64
- $attributesNeed = $model_att_options->setAttribute($attributes); // We set our attribute for this model
65
- $attributesArray = array();
66
- foreach($attributesNeed->getAllOptions() as $op){
67
- $attributesArray[$op['value']] = $op['label'];
68
- }
69
- return $attributesArray;
70
-
71
- }
72
-
73
-
74
- public function getAttributeValueByName($nameAtt){
75
- $model_att = Mage::getModel('eav/entity_attribute');
76
- $att_id = $model_att->getIdByCode( 'catalog_product', $nameAtt );
77
- $attributes = $model_att->load($att_id);
78
- // Get the literal value
79
- $model_att_options = Mage::getModel('eav/entity_attribute_source_table'); // We get the model handling eav_attribute_option
80
- $attributesNeed = $model_att_options->setAttribute($attributes); // We set our attribute for this model
81
- $attributesArray = array();
82
- foreach($attributesNeed->getAllOptions() as $op){
83
- $attributesArray[$op['value']] = $op['label'];
84
- }
85
- return $attributesArray;
86
-
87
- }
88
-
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Publish.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Block_Publish extends Mage_Core_Block_Template
3
- {
4
- public function __construct()
5
- {
6
-
7
- parent::__construct();
8
- $products =
9
- Mage::getModel('catalog/product')->getCollection()
10
- ->addStoreFilter(0)
11
- ->addAttributeToSelect('*')
12
- ->addAttributeToFilter('seller_id', $this->getCustomerId())
13
- //->addAttributeToFilter('status_delete', array('neq'=>2))
14
- ->setOrder('created_at', 'desc')
15
-
16
- ;
17
-
18
- $this->setOrders($products);
19
- }
20
-
21
- protected function _prepareLayout()
22
- {
23
- parent::_prepareLayout();
24
-
25
- $pager = $this->getLayout()->createBlock('page/html_pager', 'ifuturz.product.list.pager')
26
- ->setCollection($this->getOrders());
27
- $this->setChild('pager', $pager);
28
- $this->getOrders()->load();
29
- return $this;
30
- }
31
-
32
- public function getPagerHtml()
33
- {
34
- return $this->getChildHtml('pager');
35
- }
36
-
37
- public function getCustomerId()
38
- {
39
- return Mage::getSingleton('customer/session')->getCustomerId();
40
- }
41
-
42
-
43
- /* public function getMyProduct()
44
- {
45
- return Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('seller_id', 1)->setOrder('created_at', 'desc');
46
- }
47
-
48
- public function getProductItemUrl($productId)
49
- {
50
- return Mage::getModel('core/url_rewrite')->getCollection()->addFieldToFilter('product_id',$productId)->addFieldToFilter('category_id',array('neq'=>null))->getFirstItem()->getRequestPath();
51
- //
52
- // return Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('seller_id', 1)->setOrder('created_at', 'desc');
53
- }*/
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Salesreport.php DELETED
@@ -1,121 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Block_Salesreport extends Mage_Core_Block_Template
4
- {
5
- protected $_subscription = null;
6
-
7
- public function getCustomer()
8
- {
9
- return Mage::getSingleton('customer/session')->getCustomer();
10
- }
11
-
12
- /* public function getOrder()
13
- {
14
- return Mage::registry('current_order');
15
- } */
16
- public function __construct()
17
- {
18
-
19
- parent::__construct();
20
- $userProduct = Mage::getModel('catalog/product')
21
- ->getCollection()
22
- ->addAttributeToSelect('*')
23
- ->addAttributeToFilter('seller_id',$this->getCustomer()->getId())
24
- ->setOrder('created_at', 'desc');
25
-
26
-
27
- $arrayUserProduct = $userProduct->getAllIds();
28
-
29
- $itemCollections = Mage::getModel("sales/order_item")
30
- ->getCollection()
31
- ->addFieldToFilter("product_id",array("in"=>$arrayUserProduct))
32
- ->setOrder('created_at', 'desc');
33
- $itemCollections->getSelect()->join(array('o_item' => 'sales_flat_order'), 'o_item.entity_id = main_table.order_id AND o_item.status = "complete"');
34
-
35
- /* if(Mage::getVersion()<'1.5.x.x')
36
- {
37
- $itemCollections->getSelect()->join('sales_order','main_table.order_id=sales_order.entity_id','sales_order.status = complete');
38
- }
39
- else
40
- {*/
41
-
42
- // }
43
-
44
- $this->setOrders($itemCollections);
45
-
46
- }
47
-
48
- protected function _prepareLayout()
49
- {
50
- parent::_prepareLayout();
51
-
52
- $pager = $this->getLayout()->createBlock('page/html_pager', 'sellergroup.product.list.pager')
53
- ->setCollection($this->getOrders());
54
-
55
- $this->setChild('pager', $pager);
56
-
57
- return $this;
58
- }
59
-
60
- public function getPagerHtml()
61
- {
62
- return $this->getChildHtml('pager');
63
- }
64
-
65
- public function getAllSales()
66
- {
67
-
68
- $userProduct = Mage::getModel('catalog/product')
69
- ->getCollection()
70
- ->addAttributeToSelect('*')
71
- ->addAttributeToFilter('seller_id',$this->getCustomer()->getId())
72
- ->setOrder('created_at', 'desc');
73
-
74
-
75
- $arrayUserProduct = $userProduct->getAllIds();
76
-
77
- $itemCollections = Mage::getModel("sales/order_item")
78
- ->getCollection()
79
- ->addFieldToFilter("product_id",array("in"=>$arrayUserProduct))
80
- ->setOrder('created_at', 'desc');
81
-
82
-
83
- $arrayIdOrder = array();
84
- foreach($itemCollections as $itemCollectionObject){
85
- $arrayIdOrder[] = $itemCollectionObject->getOrderId();
86
- }
87
-
88
- $order = Mage::getModel("sales/order")
89
- ->getCollection()
90
- ->addFieldToFilter("entity_id",array("in"=>$arrayIdOrder))
91
- ->setOrder('created_at', 'desc');
92
-
93
- //echo "<pre>"; print_r($order->getData()); die;
94
- $arrayNeedIt = array();
95
- $productModel = Mage::getModel('catalog/product');
96
- $i=0;
97
- foreach($order as $or)
98
- {
99
- foreach($itemCollections as $ite)
100
- {
101
- if($ite->getOrderId() == $or->getId() && $or->getStatus() == 'complete')
102
- {
103
- $sellergroup_commissionmodel = Mage::getModel('sellergroup/sellercommission')->getCollection()->addFieldToFilter('order_id',$ite->getOrderId())->addFieldToFilter('product_id',$ite->getProductId());
104
- $sellergroup_commissiondata = $sellergroup_commissionmodel->getData();
105
- $arrayNeedIt[$i]['product_id'] = $ite->getProductId();
106
- $arrayNeedIt[$i]['price'] = $productModel->load($ite->getProductId())->getPrice();
107
- $arrayNeedIt[$i]['commission'] = $sellergroup_commissiondata[0]['owner_commission_amt'];
108
- $arrayNeedIt[$i]['revenue'] = $sellergroup_commissiondata[0]['seller_commission_amt'];
109
- $arrayNeedIt[$i]['order_id'] = $ite->getOrderId();
110
- $arrayNeedIt[$i]['update_at'] = $ite->getUpdatedAt();
111
- $arrayNeedIt[$i]['customer_id'] = $or->getCustomerId();
112
- $arrayNeedIt[$i]['name'] = $ite->getName();
113
- $i++;
114
- }
115
-
116
- }
117
- }
118
- return $arrayNeedIt;
119
- }
120
-
121
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Block/Sellergroup.php DELETED
@@ -1,61 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Block_Sellergroup extends Mage_Core_Block_Template
3
- {
4
- public function _prepareLayout()
5
- {
6
- return parent::_prepareLayout();
7
- }
8
-
9
- public function getSellergroup()
10
- {
11
- if(!$this->hasData('sellergroup'))
12
- {
13
- $this->setData('sellergroup',Mage::registry('sellergroup'));
14
- }
15
- return $this->getData('sellergroup');
16
- }
17
- public function res($cur_category, $idCat)
18
- {
19
-
20
- $cat_mod = Mage::getModel('catalog/category');
21
- $categoryObj = $cat_mod->load($cur_category);//->getChildrenCategories();
22
- ?>
23
- <?php if($categoryObj->hasChildren()):?>
24
- <ul>
25
- <?php $children_categories =$categoryObj->getChildrenCategories(); ?>
26
- <?php foreach($children_categories as $v): ?>
27
- <?php $all_data = $v->getData();
28
- $nm = $all_data['name'];
29
- ?>
30
- <li>
31
- <span><?php echo $nm?></span>
32
- <?php if(!$v->hasChildren()):?>
33
- <input class="categorychild" type="checkbox" name="category['<?=$nm?>']" id='category' value="<?php echo $v->getId();?>">
34
- <?php /*?><input class="required-entry <?php echo 'class'.$idCat?> classinput" type="checkbox" name="category['<?=$nm?>']" id='category' value="<?php echo $v->getId();?>"><?php */?>
35
- <?php else:?>
36
- <span class="expand-child">&nbsp;</span>
37
- <?php endif;?>
38
- <?php $this->res($v->getId(),$idCat);?>
39
- </li>
40
- <?php endforeach; ?>
41
- </ul>
42
- <?php endif;?>
43
- <?php
44
- }
45
-
46
- public function getAttributeValueByName($nameAtt){
47
- $model_att = Mage::getModel('eav/entity_attribute');
48
- $att_id = $model_att->getIdByCode( 'catalog_product', $nameAtt );
49
- $attributes = $model_att->load($att_id);
50
-
51
- // Get the literal value
52
- $model_att_options = Mage::getModel('eav/entity_attribute_source_table'); // We get the model handling eav_attribute_option
53
- $attributesNeed = $model_att_options->setAttribute($attributes); // We set our attribute for this model
54
- $attributesArray = array();
55
- foreach($attributesNeed->getAllOptions() as $op){
56
- $attributesArray[$op['value']] = $op['label'];
57
- }
58
- return $attributesArray;
59
- }
60
- }
61
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Helper/Data.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- const XML_PATH_EMAIL_TEMPLATE = 'sellergroup/email/comment/template';
5
- const XML_PATH_EMAIL_PUBLISHEDPRODUCT_TEMPLATE = 'sellergroup/email/publishedproduct/template';
6
- const XML_PATH_EMAIL_PRODUCTSOLD_TEMPLATE = 'sellergroup/email/productsold/template';
7
-
8
- public function getEmailTemplate($store = null)
9
- {
10
- return Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $store);
11
- }
12
-
13
- public function getPublishedProductEmailTemplate($store = null)
14
- {
15
- return Mage::getStoreConfig(self::XML_PATH_EMAIL_PUBLISHEDPRODUCT_TEMPLATE, $store);
16
- }
17
-
18
- public function getSoldProductEmailTemplate($store = null)
19
- {
20
- return Mage::getStoreConfig(self::XML_PATH_EMAIL_PRODUCTSOLD_TEMPLATE, $store);
21
- }
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Checkout/Type/Onepage.php DELETED
@@ -1,146 +0,0 @@
1
- <?php
2
- require_once 'Mage/Checkout/Model/Type/Onepage.php';
3
- class Ifuturz_Sellergroup_Model_Checkout_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
4
- {
5
- protected function _getHelper()
6
- {
7
- return Mage::helper('sellergroup');
8
- }
9
- public function saveOrder()
10
- {
11
- $this->validate();
12
- $isNewCustomer = false;
13
- switch ($this->getCheckoutMethod()) {
14
- case self::METHOD_GUEST:
15
- $this->_prepareGuestQuote();
16
- break;
17
- case self::METHOD_REGISTER:
18
- $this->_prepareNewCustomerQuote();
19
- $isNewCustomer = true;
20
- break;
21
- default:
22
- $this->_prepareCustomerQuote();
23
- break;
24
- }
25
-
26
- $service = Mage::getModel('sales/service_quote', $this->getQuote());
27
- $service->submitAll();
28
-
29
- if ($isNewCustomer) {
30
- try {
31
- $this->_involveNewCustomer();
32
- } catch (Exception $e) {
33
- Mage::logException($e);
34
- }
35
- }
36
-
37
- $this->_checkoutSession->setLastQuoteId($this->getQuote()->getId())
38
- ->setLastSuccessQuoteId($this->getQuote()->getId())
39
- ->clearHelperData();
40
-
41
- $order = $service->getOrder();
42
- if ($order) {
43
- Mage::dispatchEvent('checkout_type_onepage_save_order_after',
44
- array('order'=>$order, 'quote'=>$this->getQuote()));
45
-
46
- /**
47
- * a flag to set that there will be redirect to third party after confirmation
48
- * eg: paypal standard ipn
49
- */
50
- /* start code to send mail to the product publisher*/
51
- $orderdetail = Mage::getModel('sales/order')->load($order->getEntityId());
52
- $items = $orderdetail->getAllItems();
53
- foreach ($items as $item)
54
- {
55
- $productload = Mage::getModel('catalog/product')->load($item->getProductId());
56
- $customer = Mage::getModel('customer/customer')->load($productload->getSellerId());
57
-
58
- $template = $this->_getHelper()->getSoldProductEmailTemplate();
59
- /* @var $translate Mage_Core_Model_Translate */
60
- $translate = Mage::getSingleton('core/translate');
61
- $translate->setTranslateInline(false);
62
-
63
- /* @var $mailTemplate Mage_Core_Model_Email_Template */
64
- $mailTemplate = Mage::getModel('core/email_template');
65
-
66
- $sender = array(
67
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
68
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
69
- );
70
-
71
- $recipient = array(
72
- 'name' => $customer->getName(),
73
- 'email' => $customer->getEmail()
74
- );
75
-
76
- $mailTemplate->setDesignConfig(array(
77
- 'area' => 'frontend',
78
- 'store' => Mage::app()->getStore()->getId()
79
- ));
80
-
81
- $mailTemplate->sendTransactional(
82
- $template,
83
- $sender,
84
- $recipient['email'],
85
- $recipient['name'],
86
- array(
87
- 'name' => $recipient['name'],
88
- 'product_url' => $productload->getProductUrl(),
89
- 'website' => Mage::getUrl(),
90
- 'store' => $store
91
- )
92
- );
93
-
94
- $translate->setTranslateInline(true);
95
-
96
- }
97
-
98
-
99
- /* end code to send mail to the product publisher*/
100
- $redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
101
- /**
102
- * we only want to send to customer about new order when there is no redirect to third party
103
- */
104
-
105
- if (!$redirectUrl && $order->getCanSendNewEmailFlag()) {
106
- try {
107
- $order->sendNewOrderEmail();
108
- } catch (Exception $e) {
109
- Mage::logException($e);
110
- }
111
- }
112
-
113
- // add order information to the session
114
- $this->_checkoutSession->setLastOrderId($order->getId())
115
- ->setRedirectUrl($redirectUrl)
116
- ->setLastRealOrderId($order->getIncrementId());
117
-
118
-
119
-
120
- // as well a billing agreement can be created
121
- $agreement = $order->getPayment()->getBillingAgreement();
122
- if ($agreement) {
123
- $this->_checkoutSession->setLastBillingAgreementId($agreement->getId());
124
- }
125
- }
126
-
127
- // add recurring profiles information to the session
128
- $profiles = $service->getRecurringPaymentProfiles();
129
- if ($profiles) {
130
- $ids = array();
131
- foreach ($profiles as $profile) {
132
- $ids[] = $profile->getId();
133
- }
134
- $this->_checkoutSession->setLastRecurringProfileIds($ids);
135
- // TODO: send recurring profile emails
136
- }
137
-
138
- Mage::dispatchEvent(
139
- 'checkout_submit_all_after',
140
- array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles)
141
- );
142
-
143
- return $this;
144
- }
145
-
146
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Customerbalance.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Customerbalance extends Mage_Core_Model_Abstract
3
- {
4
- public function _construct()
5
- {
6
- //parent::_construct();
7
- $this->_init('sellergroup/customerbalance');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Customerbalance.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Customerbalance extends Mage_Core_Model_Mysql4_Abstract
3
- {
4
- public function _construct()
5
- {
6
- // Note that the sellercommission_id refers to the key field in your database table.
7
- $this->_init('sellergroup/sellergroup_customerbalance', 'balance_id');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Customerbalance/Collection.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Customerbalance_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('sellergroup/customerbalance');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellercommission.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Sellercommission extends Mage_Core_Model_Mysql4_Abstract
3
- {
4
- public function _construct()
5
- {
6
- // Note that the sellercommission_id refers to the key field in your database table.
7
- $this->_init('sellergroup/sellergroup_sellercommission', 'sellercommission_id');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellercommission/Collection.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Sellercommission_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('sellergroup/sellercommission');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellergroup.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Sellergroup extends Mage_Core_Model_Mysql4_Abstract
3
- {
4
- public function _construct()
5
- {
6
- // Note that the register_id refers to the key field in your database table.
7
- $this->_init('sellergroup/sellergroup', 'sellergroup_id');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Sellergroup/Collection.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Mysql4_Sellergroup_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('sellergroup/sellergroup');
8
- }
9
- /*public function getsellergroupArray()
10
- {
11
- $options = array();
12
- $this->addOrder('seller_group_code', 'asc');
13
- foreach ($this as $item) {
14
- $options[] = array(
15
- 'value' => $item->getSellergroupId(),
16
- 'label' => $item->getApplicantGroupCode()
17
- );
18
- }
19
-
20
- return $options;
21
- }
22
- public function setRealGroupsFilter()
23
- {
24
- return $this->addFieldToFilter('sellergroup_id', array('gt' => 0));
25
- }
26
- public function toOptionArray()
27
- {
28
- return parent::_toOptionArray('sellergroup_id', 'seller_group_code');
29
- }*/
30
- public function toOptionHash()
31
- {
32
- return parent::_toOptionHash('sellergroup_id', 'seller_group_code');
33
- }
34
-
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Mysql4/Setup.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
4
- {
5
- }
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Observer-8-7-2013.php DELETED
@@ -1,287 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Observer
3
- {
4
- public function calculateCommission($observer)
5
- {
6
- $event = $observer->getEvent();
7
- $product = $event->getPayment();
8
- $order = $product->getOrder();
9
-
10
- $items = $order->getAllItems();
11
-
12
- $customer_id = $order->getCustomerId();
13
- $arraysellergroupId = array();
14
- $groupthresholds = array();
15
-
16
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
17
-
18
- $sellergroups = Mage::getModel('sellergroup/sellergroup')->getCollection();
19
-
20
- foreach($sellergroups as $sp)
21
- {
22
- $arraysellergroupId[] = $sp->getSellergroupId();
23
- $groupthresholds[] = $sp->getSellergroupUpgradeThreshold();
24
- }
25
- asort($groupthresholds);
26
- foreach($items as $item)
27
- {
28
- //start code for seller commission
29
- $attids= $write->query("Select attribute_id from eav_attribute where attribute_code='seller_id'");
30
- $attidrow = $attids->fetch();
31
- $attid = $attidrow['attribute_id'];
32
-
33
- $sellerdetail = $write->query("Select value from catalog_product_entity_varchar where attribute_id='".$attid."' AND entity_id='".$item->getProductId()."'");
34
- $row = $sellerdetail->fetch();
35
- $seller_id = $row['value'];
36
-
37
- $customermodel = Mage::getModel('customer/customer');
38
- $customermodel->load($seller_id);
39
- $sellergroupid = $customermodel->getSellergroupId();
40
-
41
- if(in_array($sellergroupid,$arraysellergroupId))
42
- {
43
- $sellergroupload = Mage::getModel('sellergroup/sellergroup')->load($sellergroupid);
44
- $commission = $sellergroupload->getSellerCommission();
45
- $groupthreshold = $sellergroupload->getSellergroupUpgradeThreshold();
46
-
47
- if($commission!='')
48
- {
49
- $sellercommission = ($item->getBaseRowTotal()*$commission)/100;
50
- $ownercomission = $item->getBaseRowTotal()-$sellercommission;
51
- }
52
-
53
- $pid = $item->getProductId();
54
- $orderid = $order->getEntityId();
55
-
56
- $sellergroup_commission = Mage::getModel('sellergroup/sellercommission');
57
-
58
- $sellergroup_commission->setProductId($pid);
59
- $sellergroup_commission->setSellerId($seller_id);
60
- $sellergroup_commission->setBuyerId($customer_id);
61
- $sellergroup_commission->setOrderId($orderid);
62
- $sellergroup_commission->setSellerGroup($sellergroupid);
63
- $sellergroup_commission->setSellerPercent($commission);
64
- $sellergroup_commission->setSellerCommissionAmt($sellercommission);
65
- $sellergroup_commission->setOwnerCommissionAmt($ownercomission);
66
- $sellergroup_commission->setCreatedAt(now());
67
-
68
- $sellergroup_commission->save();
69
-
70
- $sellerbalancemodel = Mage::getModel('sellergroup/customerbalance');
71
-
72
- $sellerbalance_load = $sellerbalancemodel->getCollection()->addFieldToFilter('customer_id',$seller_id);
73
-
74
- $balancedata = $sellerbalance_load->getData();
75
- if(empty($balancedata))
76
- {
77
- $sellerbalancemodel->setCustomerId($seller_id);
78
- $sellerbalancemodel->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
79
- $sellerbalancemodel->setBalance($sellercommission);
80
- $sellerbalancemodel->save();
81
- }
82
- else
83
- {
84
- $updatedbal = $balancedata[0]['balance']+$sellercommission;
85
- $sellerbalancemodel->load($balancedata[0]['balance_id']);
86
- $sellerbalancemodel->setBalance($updatedbal)->save();
87
- }
88
-
89
- // start code for seller group upgrade
90
- $userProduct = Mage::getModel('catalog/product')
91
- ->getCollection()
92
- ->addAttributeToSelect('*')
93
- ->addAttributeToFilter('seller_id',$seller_id);
94
-
95
- $arrayUserProduct = $userProduct->getAllIds();
96
-
97
- $itemCollections = Mage::getModel("sales/order_item")
98
- ->getCollection()
99
- ->addFieldToFilter("product_id",array("in"=>$arrayUserProduct));
100
- $itemCollections->getSelect()->join(array('o_item' => 'sales_flat_order'), 'o_item.entity_id = main_table.order_id AND o_item.status = "complete"');
101
-
102
- $soldproductcount = $itemCollections->getSize();
103
-
104
- $key = array_search($groupthreshold, $groupthresholds); // $key = 2;
105
-
106
- $nextthreshold = $groupthresholds[$key+1];
107
-
108
- if($soldproductcount>=$groupthreshold && $soldproductcount<=$nextthreshold)
109
- {
110
-
111
- $sellergroupfilterload = Mage::getModel('sellergroup/sellergroup')->getCollection()->addFieldToFilter('sellergroup_upgrade_threshold',$nextthreshold);
112
-
113
- $sellergroupfilterdata = $sellergroupfilterload->getData();
114
- $customermodel->setSellergroupId($sellergroupfilterdata[0]['sellergroup_id'])->save();
115
- $this->sendMail($customermodel->getEmail(),$customermodel->getFirstname(),$sellergroupfilterdata[0]['seller_group_code']);
116
- }
117
-
118
- // end code for seller group upgrade
119
- $sellergroupload = '';
120
- $sellerbalancemodel = '';
121
- }
122
- //end seller commission
123
-
124
- }
125
- }
126
-
127
- public function customerSuccess($observer)
128
- {
129
- $event = $observer->getEvent();
130
- $customer = $event->getCustomer();
131
- $sellergroups = Mage::getModel('sellergroup/sellergroup')->getCollection()->getFirstItem();
132
- $sellergroupId = $sellergroups->getSellergroupId();
133
- $memberModel = Mage::getModel('customer/customer')->load($customer->getEntityId());
134
- $memberModel->setSellergroupId($sellergroupId)->save();
135
-
136
- }
137
- public function sendMail($email,$name,$groupcode)
138
- {
139
-
140
- if ($email){
141
-
142
- $to_email = $email;
143
- $to_name = $name;
144
- $subject = 'Site - Congratulation!!Your seller group is upgraded to the next level';
145
- $Body = "Your group is upgraded to the next level. Now you belongs to the group: <b>".$groupcode."</b>";
146
-
147
- $sender_email = "owner@sender.com";
148
- $sender_name = "Site Owner";
149
-
150
- $mail = new Zend_Mail();
151
- $mail->setBodyHtml($Body); //for sending message containing html code
152
- $mail->setFrom($sender_email, $sender_name);
153
- $mail->addTo($to_email, $to_name);
154
- //$mail->addCc($cc, $ccname); //can set cc
155
- //$mail->addBCc($bcc, $bccname); //can set bcc
156
- $mail->setSubject($subject);
157
- $msg ='';
158
- try {
159
- if($mail->send())
160
- {
161
- $msg = true;
162
- }
163
- }
164
- catch(Exception $ex) {
165
- $msg = false;
166
- //die("Error sending mail to $to,$error_msg");
167
- }
168
- }
169
- }
170
-
171
- /**
172
- * Flag to stop observer executing more than once
173
- *
174
- * @var static bool
175
- */
176
- static protected $_singletonFlag = false;
177
-
178
- /**
179
- * This method will run when the product is saved from the Magento Admin
180
- * Use this function to update the product model, process the
181
- * data or anything you like
182
- *
183
- * @param Varien_Event_Observer $observer
184
- */
185
- public function saveProductTabData(Varien_Event_Observer $observer)
186
- {
187
- if (!self::$_singletonFlag) {
188
- self::$_singletonFlag = true;
189
-
190
- $product = $observer->getEvent()->getProduct();
191
-
192
- try {
193
- $data = $this->_getRequest()->getPost('product');
194
- if($data['approve_product']==1)
195
- {
196
- $product->setStatus(1);
197
- }
198
- $product->save();
199
- if($data['is_seller_notified']==1 && $data['comment_publisher']!='')
200
- {
201
- $customer = Mage::getModel('customer/customer')->load($data['seller_id']);
202
- $maildetail['name'] = $customer->getName();
203
- $maildetail['email'] = $customer->getEmail();
204
- $maildetail['product_name'] = $data['name'];
205
- $maildetail['product_url'] = $product->getProductUrl();
206
- $maildetail['comment'] = $data['comment_publisher'];
207
- $this->sendCommentMail($data['is_seller_notified'], $data['comment_publisher'], $maildetail);
208
- }
209
-
210
- }
211
- catch (Exception $e) {
212
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
213
- }
214
- }
215
- }
216
-
217
- /**
218
- * Retrieve the product model
219
- *
220
- * @return Mage_Catalog_Model_Product $product
221
- */
222
- public function getProduct()
223
- {
224
- return Mage::registry('product');
225
- }
226
-
227
- /**
228
- * Shortcut to getRequest
229
- *
230
- */
231
- protected function _getRequest()
232
- {
233
- return Mage::app()->getRequest();
234
- }
235
-
236
- protected function _getHelper()
237
- {
238
- return Mage::helper('sellergroup');
239
- }
240
-
241
- public function getTemplate()
242
- {
243
- return $this->_getHelper()->getEmailTemplate();
244
- }
245
-
246
- public function sendCommentMail($notifyCustomer = true, $comment = '', $maildetail)
247
- {
248
-
249
- /* @var $translate Mage_Core_Model_Translate */
250
- $translate = Mage::getSingleton('core/translate');
251
- $translate->setTranslateInline(false);
252
-
253
- /* @var $mailTemplate Mage_Core_Model_Email_Template */
254
- $mailTemplate = Mage::getModel('core/email_template');
255
-
256
-
257
- $sender = array(
258
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
259
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
260
- );
261
-
262
- $mailTemplate->setDesignConfig(array(
263
- 'area' => 'adminhtml',
264
- 'store' => Mage::app()->getStore()->getId()
265
- ));
266
-
267
- $mailTemplate->sendTransactional(
268
- $this->getTemplate(),
269
- $sender,
270
- $maildetail['email'],
271
- $maildetail['name'],
272
- array(
273
- 'name' => $maildetail['name'],
274
- 'email' => $maildetail['email'],
275
- 'product_name' => $maildetail['product_name'],
276
- 'product_url' => $maildetail['product_url'],
277
- 'message' => $comment,
278
- 'sender_name' => $maildetail['name'],
279
- 'sender_email' => $maildetail['email'],
280
- 'store' => $store
281
- )
282
- );
283
-
284
- $translate->setTranslateInline(true);
285
- }
286
-
287
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Observer.php DELETED
@@ -1,289 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Observer
3
- {
4
- public function calculateCommission($observer)
5
- {
6
- $event = $observer->getEvent();
7
- $product = $event->getPayment();
8
- $order = $product->getOrder();
9
-
10
- $items = $order->getAllItems();
11
-
12
- $customer_id = $order->getCustomerId();
13
- $arraysellergroupId = array();
14
- $groupthresholds = array();
15
-
16
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
17
-
18
- $sellergroups = Mage::getModel('sellergroup/sellergroup')->getCollection();
19
-
20
- foreach($sellergroups as $sp)
21
- {
22
- $arraysellergroupId[] = $sp->getSellergroupId();
23
- $groupthresholds[] = $sp->getSellergroupUpgradeThreshold();
24
- }
25
- asort($groupthresholds);
26
- foreach($items as $item)
27
- {
28
- //start code for seller commission
29
- $attids= $write->query("Select attribute_id from eav_attribute where attribute_code='seller_id'");
30
- $attidrow = $attids->fetch();
31
- $attid = $attidrow['attribute_id'];
32
-
33
- $sellerdetail = $write->query("Select value from catalog_product_entity_varchar where attribute_id='".$attid."' AND entity_id='".$item->getProductId()."'");
34
- $row = $sellerdetail->fetch();
35
- $seller_id = $row['value'];
36
-
37
- $customermodel = Mage::getModel('customer/customer');
38
- $customermodel->load($seller_id);
39
- $sellergroupid = $customermodel->getSellergroupId();
40
-
41
- if(in_array($sellergroupid,$arraysellergroupId))
42
- {
43
- $sellergroupload = Mage::getModel('sellergroup/sellergroup')->load($sellergroupid);
44
- $commission = $sellergroupload->getSellerCommission();
45
- $groupthreshold = $sellergroupload->getSellergroupUpgradeThreshold();
46
-
47
- if($commission!='')
48
- {
49
- /*$sellercommission = ($item->getBaseRowTotal()*$commission)/100;
50
- $ownercomission = $item->getBaseRowTotal()-$sellercommission;*/
51
- $ownercomission = ($item->getBaseRowTotal()*$commission)/100;
52
- $sellercommission = $item->getBaseRowTotal()-$ownercomission;
53
- }
54
-
55
- $pid = $item->getProductId();
56
- $orderid = $order->getEntityId();
57
-
58
- $sellergroup_commission = Mage::getModel('sellergroup/sellercommission');
59
-
60
- $sellergroup_commission->setProductId($pid);
61
- $sellergroup_commission->setSellerId($seller_id);
62
- $sellergroup_commission->setBuyerId($customer_id);
63
- $sellergroup_commission->setOrderId($orderid);
64
- $sellergroup_commission->setSellerGroup($sellergroupid);
65
- $sellergroup_commission->setSellerPercent($commission);
66
- $sellergroup_commission->setSellerCommissionAmt($sellercommission);
67
- $sellergroup_commission->setOwnerCommissionAmt($ownercomission);
68
- $sellergroup_commission->setCreatedAt(now());
69
-
70
- $sellergroup_commission->save();
71
-
72
- $sellerbalancemodel = Mage::getModel('sellergroup/customerbalance');
73
-
74
- $sellerbalance_load = $sellerbalancemodel->getCollection()->addFieldToFilter('customer_id',$seller_id);
75
-
76
- $balancedata = $sellerbalance_load->getData();
77
- if(empty($balancedata))
78
- {
79
- $sellerbalancemodel->setCustomerId($seller_id);
80
- $sellerbalancemodel->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
81
- $sellerbalancemodel->setBalance($sellercommission);
82
- $sellerbalancemodel->save();
83
- }
84
- else
85
- {
86
- $updatedbal = $balancedata[0]['balance']+$sellercommission;
87
- $sellerbalancemodel->load($balancedata[0]['balance_id']);
88
- $sellerbalancemodel->setBalance($updatedbal)->save();
89
- }
90
-
91
- // start code for seller group upgrade
92
- $userProduct = Mage::getModel('catalog/product')
93
- ->getCollection()
94
- ->addAttributeToSelect('*')
95
- ->addAttributeToFilter('seller_id',$seller_id);
96
-
97
- $arrayUserProduct = $userProduct->getAllIds();
98
-
99
- $itemCollections = Mage::getModel("sales/order_item")
100
- ->getCollection()
101
- ->addFieldToFilter("product_id",array("in"=>$arrayUserProduct));
102
- $itemCollections->getSelect()->join(array('o_item' => 'sales_flat_order'), 'o_item.entity_id = main_table.order_id AND o_item.status = "complete"');
103
-
104
- $soldproductcount = $itemCollections->getSize();
105
-
106
- $key = array_search($groupthreshold, $groupthresholds); // $key = 2;
107
-
108
- $nextthreshold = $groupthresholds[$key+1];
109
-
110
- if($soldproductcount>=$groupthreshold && $soldproductcount<=$nextthreshold)
111
- {
112
-
113
- $sellergroupfilterload = Mage::getModel('sellergroup/sellergroup')->getCollection()->addFieldToFilter('sellergroup_upgrade_threshold',$nextthreshold);
114
-
115
- $sellergroupfilterdata = $sellergroupfilterload->getData();
116
- $customermodel->setSellergroupId($sellergroupfilterdata[0]['sellergroup_id'])->save();
117
- $this->sendMail($customermodel->getEmail(),$customermodel->getFirstname(),$sellergroupfilterdata[0]['seller_group_code']);
118
- }
119
-
120
- // end code for seller group upgrade
121
- $sellergroupload = '';
122
- $sellerbalancemodel = '';
123
- }
124
- //end seller commission
125
-
126
- }
127
- }
128
-
129
- public function customerSuccess($observer)
130
- {
131
- $event = $observer->getEvent();
132
- $customer = $event->getCustomer();
133
- $sellergroups = Mage::getModel('sellergroup/sellergroup')->getCollection()->getFirstItem();
134
- $sellergroupId = $sellergroups->getSellergroupId();
135
- $memberModel = Mage::getModel('customer/customer')->load($customer->getEntityId());
136
- $memberModel->setSellergroupId($sellergroupId)->save();
137
-
138
- }
139
- public function sendMail($email,$name,$groupcode)
140
- {
141
-
142
- if ($email){
143
-
144
- $to_email = $email;
145
- $to_name = $name;
146
- $subject = 'Site - Congratulation!!Your seller group is upgraded to the next level';
147
- $Body = "Your group is upgraded to the next level. Now you belongs to the group: <b>".$groupcode."</b>";
148
-
149
- $sender_email = "owner@sender.com";
150
- $sender_name = "Site Owner";
151
-
152
- $mail = new Zend_Mail();
153
- $mail->setBodyHtml($Body); //for sending message containing html code
154
- $mail->setFrom($sender_email, $sender_name);
155
- $mail->addTo($to_email, $to_name);
156
- //$mail->addCc($cc, $ccname); //can set cc
157
- //$mail->addBCc($bcc, $bccname); //can set bcc
158
- $mail->setSubject($subject);
159
- $msg ='';
160
- try {
161
- if($mail->send())
162
- {
163
- $msg = true;
164
- }
165
- }
166
- catch(Exception $ex) {
167
- $msg = false;
168
- //die("Error sending mail to $to,$error_msg");
169
- }
170
- }
171
- }
172
-
173
- /**
174
- * Flag to stop observer executing more than once
175
- *
176
- * @var static bool
177
- */
178
- static protected $_singletonFlag = false;
179
-
180
- /**
181
- * This method will run when the product is saved from the Magento Admin
182
- * Use this function to update the product model, process the
183
- * data or anything you like
184
- *
185
- * @param Varien_Event_Observer $observer
186
- */
187
- public function saveProductTabData(Varien_Event_Observer $observer)
188
- {
189
- if (!self::$_singletonFlag) {
190
- self::$_singletonFlag = true;
191
-
192
- $product = $observer->getEvent()->getProduct();
193
-
194
- try {
195
- $data = $this->_getRequest()->getPost('product');
196
- if($data['approve_product']==1)
197
- {
198
- $product->setStatus(1);
199
- }
200
- $product->save();
201
- if($data['is_seller_notified']==1 && $data['comment_publisher']!='')
202
- {
203
- $customer = Mage::getModel('customer/customer')->load($data['seller_id']);
204
- $maildetail['name'] = $customer->getName();
205
- $maildetail['email'] = $customer->getEmail();
206
- $maildetail['product_name'] = $data['name'];
207
- $maildetail['product_url'] = $product->getProductUrl();
208
- $maildetail['comment'] = $data['comment_publisher'];
209
- $this->sendCommentMail($data['is_seller_notified'], $data['comment_publisher'], $maildetail);
210
- }
211
-
212
- }
213
- catch (Exception $e) {
214
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
215
- }
216
- }
217
- }
218
-
219
- /**
220
- * Retrieve the product model
221
- *
222
- * @return Mage_Catalog_Model_Product $product
223
- */
224
- public function getProduct()
225
- {
226
- return Mage::registry('product');
227
- }
228
-
229
- /**
230
- * Shortcut to getRequest
231
- *
232
- */
233
- protected function _getRequest()
234
- {
235
- return Mage::app()->getRequest();
236
- }
237
-
238
- protected function _getHelper()
239
- {
240
- return Mage::helper('sellergroup');
241
- }
242
-
243
- public function getTemplate()
244
- {
245
- return $this->_getHelper()->getEmailTemplate();
246
- }
247
-
248
- public function sendCommentMail($notifyCustomer = true, $comment = '', $maildetail)
249
- {
250
-
251
- /* @var $translate Mage_Core_Model_Translate */
252
- $translate = Mage::getSingleton('core/translate');
253
- $translate->setTranslateInline(false);
254
-
255
- /* @var $mailTemplate Mage_Core_Model_Email_Template */
256
- $mailTemplate = Mage::getModel('core/email_template');
257
-
258
-
259
- $sender = array(
260
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
261
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
262
- );
263
-
264
- $mailTemplate->setDesignConfig(array(
265
- 'area' => 'adminhtml',
266
- 'store' => Mage::app()->getStore()->getId()
267
- ));
268
-
269
- $mailTemplate->sendTransactional(
270
- $this->getTemplate(),
271
- $sender,
272
- $maildetail['email'],
273
- $maildetail['name'],
274
- array(
275
- 'name' => $maildetail['name'],
276
- 'email' => $maildetail['email'],
277
- 'product_name' => $maildetail['product_name'],
278
- 'product_url' => $maildetail['product_url'],
279
- 'message' => $comment,
280
- 'sender_name' => $maildetail['name'],
281
- 'sender_email' => $maildetail['email'],
282
- 'store' => $store
283
- )
284
- );
285
-
286
- $translate->setTranslateInline(true);
287
- }
288
-
289
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Observer.php-original DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Observer
3
- {
4
- public function calculateCommission($observer)
5
- {
6
- $event = $observer->getEvent();
7
- $product = $event->getPayment();
8
- $order = $product->getOrder();
9
-
10
- $items = $order->getAllItems();
11
-
12
- $customer_id = $order->getCustomerId();
13
- $arraysellergroupId = array();
14
- $groupthresholds = array();
15
-
16
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
17
-
18
- $sellergroups = Mage::getModel('sellergroup/sellergroup')->getCollection();
19
-
20
- foreach($sellergroups as $sp)
21
- {
22
- $arraysellergroupId[] = $sp->getSellergroupId();
23
- $groupthresholds[] = $sp->getSellergroupUpgradeThreshold();
24
- }
25
- asort($groupthresholds);
26
- foreach($items as $item)
27
- {
28
- //start code for seller commission
29
- $attids= $write->query("Select attribute_id from eav_attribute where attribute_code='seller_id'");
30
- $attidrow = $attids->fetch();
31
- $attid = $attidrow['attribute_id'];
32
-
33
- $sellerdetail = $write->query("Select value from catalog_product_entity_varchar where attribute_id='".$attid."' AND entity_id='".$item->getProductId()."'");
34
- $row = $sellerdetail->fetch();
35
- $seller_id = $row['value'];
36
-
37
- $customermodel = Mage::getModel('customer/customer');
38
- $customermodel->load($seller_id);
39
- $sellergroupid = $customermodel->getSellergroupId();
40
-
41
- if(in_array($sellergroupid,$arraysellergroupId))
42
- {
43
- $sellergroupload = Mage::getModel('sellergroup/sellergroup')->load($sellergroupid);
44
- $commission = $sellergroupload->getSellerCommission();
45
- $groupthreshold = $sellergroupload->getSellergroupUpgradeThreshold();
46
-
47
- if($commission!='')
48
- {
49
- $sellercommission = ($item->getBaseRowTotal()*$commission)/100;
50
- $ownercomission = $item->getBaseRowTotal()-$sellercommission;
51
- }
52
-
53
- $pid = $item->getProductId();
54
- $orderid = $order->getEntityId();
55
-
56
- $sellergroup_commission = Mage::getModel('sellergroup/sellercommission');
57
-
58
- $sellergroup_commission->setProductId($pid);
59
- $sellergroup_commission->setSellerId($seller_id);
60
- $sellergroup_commission->setBuyerId($customer_id);
61
- $sellergroup_commission->setOrderId($orderid);
62
- $sellergroup_commission->setSellerGroup($sellergroupid);
63
- $sellergroup_commission->setSellerPercent($commission);
64
- $sellergroup_commission->setSellerCommissionAmt($sellercommission);
65
- $sellergroup_commission->setOwnerCommissionAmt($ownercomission);
66
- $sellergroup_commission->setCreatedAt(now());
67
-
68
- $sellergroup_commission->save();
69
-
70
- $sellerbalancemodel = Mage::getModel('sellergroup/customerbalance');
71
-
72
- $sellerbalance_load = $sellerbalancemodel->getCollection()->addFieldToFilter('customer_id',$seller_id);
73
-
74
- $balancedata = $sellerbalance_load->getData();
75
- if(empty($balancedata))
76
- {
77
- $sellerbalancemodel->setCustomerId($seller_id);
78
- $sellerbalancemodel->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
79
- $sellerbalancemodel->setBalance($sellercommission);
80
- $sellerbalancemodel->save();
81
- }
82
- else
83
- {
84
- $updatedbal = $balancedata[0]['balance']+$sellercommission;
85
- $sellerbalancemodel->load($balancedata[0]['balance_id']);
86
- $sellerbalancemodel->setBalance($updatedbal)->save();
87
- }
88
-
89
- // start code for seller group upgrade
90
- $userProduct = Mage::getModel('catalog/product')
91
- ->getCollection()
92
- ->addAttributeToSelect('*')
93
- ->addAttributeToFilter('seller_id',$seller_id);
94
-
95
- $arrayUserProduct = $userProduct->getAllIds();
96
-
97
- $itemCollections = Mage::getModel("sales/order_item")
98
- ->getCollection()
99
- ->addFieldToFilter("product_id",array("in"=>$arrayUserProduct));
100
- $itemCollections->getSelect()->join(array('o_item' => 'sales_flat_order'), 'o_item.entity_id = main_table.order_id AND o_item.status = "complete"');
101
-
102
- $soldproductcount = $itemCollections->getSize();
103
-
104
- $key = array_search($groupthreshold, $groupthresholds); // $key = 2;
105
-
106
- $nextthreshold = $groupthresholds[$key+1];
107
-
108
- if($soldproductcount>=$groupthreshold && $soldproductcount<=$nextthreshold)
109
- {
110
-
111
- $sellergroupfilterload = Mage::getModel('sellergroup/sellergroup')->getCollection()->addFieldToFilter('sellergroup_upgrade_threshold',$nextthreshold);
112
-
113
- $sellergroupfilterdata = $sellergroupfilterload->getData();
114
- $customermodel->setSellergroupId($sellergroupfilterdata[0]['sellergroup_id'])->save();
115
- $this->sendMail($customermodel->getEmail(),$customermodel->getFirstname(),$sellergroupfilterdata[0]['seller_group_code']);
116
- }
117
-
118
- // end code for seller group upgrade
119
- $sellergroupload = '';
120
- $sellerbalancemodel = '';
121
- }
122
- //end seller commission
123
-
124
- }
125
- }
126
-
127
- public function sendMail($email,$name,$groupcode)
128
- {
129
-
130
- if ($email){
131
-
132
- $to_email = $email;
133
- $to_name = $name;
134
- $subject = 'Site - Congratulation!!Your seller group is upgraded to the next level';
135
- $Body = "Your group is upgraded to the next level. Now you belongs to the group: <b>".$groupcode."</b>";
136
-
137
- $sender_email = "owner@sender.com";
138
- $sender_name = "Site Owner";
139
-
140
- $mail = new Zend_Mail();
141
- $mail->setBodyHtml($Body); //for sending message containing html code
142
- $mail->setFrom($sender_email, $sender_name);
143
- $mail->addTo($to_email, $to_name);
144
- //$mail->addCc($cc, $ccname); //can set cc
145
- //$mail->addBCc($bcc, $bccname); //can set bcc
146
- $mail->setSubject($subject);
147
- $msg ='';
148
- try {
149
- if($mail->send())
150
- {
151
- $msg = true;
152
- }
153
- }
154
- catch(Exception $ex) {
155
- $msg = false;
156
- //die("Error sending mail to $to,$error_msg");
157
- }
158
- }
159
- }
160
-
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Sellercommission.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Sellercommission extends Mage_Core_Model_Abstract
3
- {
4
- public function _construct()
5
- {
6
- //parent::_construct();
7
- $this->_init('sellergroup/sellercommission');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Sellergroup.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Sellergroup extends Mage_Core_Model_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('sellergroup/sellergroup');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/Model/Sellergroup/Attribute/Source/Sellergroup.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_Model_Sellergroup_Attribute_Source_Sellergroup extends Mage_Eav_Model_Entity_Attribute_Source_Table
3
- {
4
- public function getAllOptions()
5
- {
6
- if (!$this->_options) {
7
- $this->_options = Mage::getResourceModel('sellergroup/sellergroup_collection')
8
- ->addFieldToFilter('sellergroup_id', array('gt'=> 0))
9
- ->load()
10
- ->toOptionHash();
11
- }
12
- return $this->_options;
13
- }
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/controllers/Adminhtml/SellergroupController.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Sellergroup_Adminhtml_SellergroupController extends Mage_Adminhtml_Controller_Action
4
- {
5
- protected function _initAction()
6
- {
7
- $this->loadLayout()
8
- ->_setActiveMenu('sellergroup')
9
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Add sellergroup Category Management'), Mage::helper('adminhtml')->__('Add sellergroup category Management'));
10
-
11
- return $this;
12
- }
13
-
14
- public function indexAction()
15
- {
16
- $this->_initAction()
17
- ->renderLayout();
18
- }
19
-
20
- public function editAction() {
21
- $id = $this->getRequest()->getParam('id');
22
- $model = Mage::getModel('sellergroup/sellergroup')->load($id);
23
-
24
- if ($model->getId() || $id == 0) {
25
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
26
- if (!empty($data)) {
27
- $model->setData($data);
28
- }
29
- Mage::register('sellergroup_data', $model);
30
-
31
- $this->loadLayout();
32
- $this->_setActiveMenu('sellergroup');
33
-
34
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Add sellergroupegory Management'), Mage::helper('adminhtml')->__('Add sellergroup category Management'));
35
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Rule News'), Mage::helper('adminhtml')->__('Rule News'));
36
-
37
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
-
39
- $this->_addContent($this->getLayout()->createBlock('sellergroup/adminhtml_sellergroup_edit'))
40
- ->_addLeft($this->getLayout()->createBlock('sellergroup/adminhtml_sellergroup_edit_tabs'));
41
-
42
- $this->renderLayout();
43
- } else {
44
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sellergroup')->__('sellergroup does not exist'));
45
- $this->_redirect('*/*/');
46
- }
47
- }
48
-
49
-
50
- public function newAction()
51
- {
52
- $this->_forward('edit');
53
- }
54
-
55
- public function saveAction()
56
- {
57
- if ($data = $this->getRequest()->getPost())
58
- {
59
-
60
- $model = Mage::getModel('sellergroup/sellergroup');
61
- $model->setData($data)
62
- ->setId($this->getRequest()->getParam('id'));
63
-
64
- try
65
- {
66
- $model->save();
67
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('sellergroup')->__('User was successfully saved'));
68
- Mage::getSingleton('adminhtml/session')->setFormData(false);
69
-
70
- if ($this->getRequest()->getParam('back'))
71
- {
72
- $this->_redirect('*/*/edit', array('id' => $model->getId()));
73
- return;
74
- }
75
- $this->_redirect('*/*/');
76
- return;
77
- }
78
- catch (Exception $e)
79
- {
80
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
81
- Mage::getSingleton('adminhtml/session')->setFormData($data);
82
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
83
- return;
84
- }
85
- }
86
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sellergroup')->__('Unable to find User to save'));
87
- $this->_redirect('*/*/');
88
- }
89
-
90
- public function deleteAction() {
91
- if( $this->getRequest()->getParam('id') > 0 ) {
92
- try {
93
- $model = Mage::getModel('sellergroup/sellergroup');
94
-
95
- $model->setId($this->getRequest()->getParam('id'))
96
- ->delete();
97
-
98
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('sellergroup was successfully deleted'));
99
- $this->_redirect('*/*/');
100
- } catch (Exception $e) {
101
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
102
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
103
- }
104
- }
105
- $this->_redirect('*/*/');
106
- }
107
-
108
- public function massDeleteAction() {
109
- $sellergroupIds = $this->getRequest()->getParam('sellergroup');
110
- if(!is_array($sellergroupIds)) {
111
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('sellergroup')->__('Please select Sellergroup(s)'));
112
- } else {
113
- try {
114
- foreach ($sellergroupIds as $sellergroupId) {
115
- $sellergroup = Mage::getModel('sellergroup/sellergroup')->load($sellergroupId);
116
- $sellergroup->delete();
117
- }
118
- Mage::getSingleton('adminhtml/session')->addSuccess(
119
- Mage::helper('adminhtml')->__(
120
- 'Total of %d record(s) were successfully deleted', count($sellergroupIds)
121
- )
122
- );
123
- } catch (Exception $e) {
124
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
125
- }
126
- }
127
- $this->_redirect('*/*/index');
128
- }
129
-
130
- public function massStatusAction()
131
- {
132
- $sellergroupIds = $this->getRequest()->getParam('sellergroup');
133
- if(!is_array($sellergroupIds)) {
134
- Mage::getSingleton('adminhtml/session')->addError($this->__('Please select Sellergroup(s)'));
135
- } else {
136
- try {
137
- foreach ($sellergroupIds as $sellergroupId) {
138
- $sellergroup = Mage::getSingleton('sellergroup/sellergroup')
139
- ->load($sellergroupId)
140
- ->setStatus($this->getRequest()->getParam('status'))
141
- ->setIsMassupdate(true)
142
- ->save();
143
- }
144
- $this->_getSession()->addSuccess(
145
- $this->__('Total of %d record(s) were successfully updated', count($sellergroupIds))
146
- );
147
- } catch (Exception $e) {
148
- $this->_getSession()->addError($e->getMessage());
149
- }
150
- }
151
- $this->_redirect('*/*/index');
152
- }
153
-
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/controllers/Catalog/ProductController.php DELETED
@@ -1,106 +0,0 @@
1
- <?php
2
- include_once 'Mage/Adminhtml/controllers/Catalog/ProductController.php';
3
- class Ifuturz_Sellergroup_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
4
- {
5
-
6
- protected function _getHelper()
7
- {
8
- return Mage::helper('sellergroup');
9
- }
10
- public function getTemplate()
11
- {
12
- return $this->_getHelper()->getEmailTemplate();
13
- }
14
-
15
- public function addCommentAction()
16
- {
17
- if ($product = $this->_initProduct()) {
18
- try {
19
- /*echo "<pre>";
20
- print_r($this->getRequest()->getPost()); die;*/
21
- $response = false;
22
- $data = $this->getRequest()->getPost('history');
23
- $productdata = $this->getRequest()->getPost('product');
24
-
25
- $productload = Mage::getModel('catalog/product')->load($this->getRequest()->getPost('productid'));
26
-
27
- $notify = isset($data['is_seller_notified']) ? $data['is_seller_notified'] : false;
28
-
29
- $productload->setCommentPublisher($productdata['comment_publisher'])->setIsSellerNotified($notify);
30
- $productload->save();
31
-
32
- $comment = trim(strip_tags($productdata['comment_publisher']));
33
-
34
- $customer = Mage::getModel('customer/customer')->load($productload->getSellerId());
35
-
36
- $maildetail['name'] = $customer->getName();
37
- $maildetail['email'] = $customer->getEmail();
38
- $maildetail['product_name'] = $productload->getName();
39
- $maildetail['product_url'] = $productload->getProductUrl();
40
- $maildetail['comment'] = $comment;
41
-
42
- $this->sendCommentMail($notify, $comment, $maildetail);
43
-
44
- $this->loadLayout('empty');
45
- $this->renderLayout();
46
- }
47
- catch (Mage_Core_Exception $e) {
48
- $response = array(
49
- 'error' => true,
50
- 'message' => $e->getMessage(),
51
- );
52
- }
53
- catch (Exception $e) {
54
- $response = array(
55
- 'error' => true,
56
- 'message' => $this->__('Cannot add product comment.')
57
- );
58
- }
59
- if (is_array($response)) {
60
- $response = Mage::helper('core')->jsonEncode($response);
61
- $this->getResponse()->setBody($response);
62
- }
63
- }
64
- }
65
-
66
- public function sendCommentMail($notifyCustomer = true, $comment = '', $maildetail) {
67
-
68
-
69
- /* @var $translate Mage_Core_Model_Translate */
70
- $translate = Mage::getSingleton('core/translate');
71
- $translate->setTranslateInline(false);
72
-
73
- /* @var $mailTemplate Mage_Core_Model_Email_Template */
74
- $mailTemplate = Mage::getModel('core/email_template');
75
-
76
-
77
- $sender = array(
78
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
79
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
80
- );
81
-
82
- $mailTemplate->setDesignConfig(array(
83
- 'area' => 'adminhtml',
84
- 'store' => Mage::app()->getStore()->getId()
85
- ));
86
-
87
- $mailTemplate->sendTransactional(
88
- $this->getTemplate(),
89
- $sender,
90
- $maildetail['email'],
91
- $maildetail['name'],
92
- array(
93
- 'name' => $maildetail['name'],
94
- 'email' => $maildetail['email'],
95
- 'product_name' => $maildetail['product_name'],
96
- 'product_url' => $maildetail['product_url'],
97
- 'message' => $comment,
98
- 'sender_name' => $maildetail['name'],
99
- 'sender_email' => $maildetail['email'],
100
- 'store' => $store
101
- )
102
- );
103
-
104
- $translate->setTranslateInline(true);
105
- }
106
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/controllers/IndexController.php DELETED
@@ -1,687 +0,0 @@
1
- <?php
2
- class Ifuturz_Sellergroup_IndexController extends Mage_Core_Controller_Front_Action
3
- {
4
-
5
- public function indexAction()
6
- {
7
- $this->loadLayout()->renderLayout();
8
- }
9
-
10
- protected function _getSession()
11
- {
12
- return Mage::getSingleton('customer/session');
13
- }
14
-
15
- protected function _getHelper()
16
- {
17
- return Mage::helper('sellergroup');
18
- }
19
-
20
- public function preDispatch()
21
- {
22
- parent::preDispatch();
23
- if (!$this->_getSession()->isLoggedIn()) {
24
-
25
- $session = Mage::getSingleton("customer/session");
26
- // Store The Current Page Url Where User will be redirected once loggedin
27
- $session->setBeforeAuthUrl(Mage::helper("core/url")->getCurrentUrl());
28
-
29
- $this->_redirect('customer/account/login');
30
- return;
31
- }
32
-
33
- }
34
-
35
- public function publishAction()
36
- {
37
- if($this->getRequest()){
38
- if($this->getRequest()->getParam('event') == 'productsuccess'){
39
- //$this->_redirect('sellergroup/index/publish');
40
- // Mage::getSingleton('checkout/session')->addError("Your cart has been updated successfully!");
41
- // Mage::getSingleton('checkout/session')->addSuccess("Your product has been added successfully!");
42
- }
43
- if($this->getRequest()->getParam('event') =='tasksuccess'){
44
- // Mage::getSingleton('checkout/session')->addSuccess("Your task has been added successfully!");
45
- }
46
- if($this->getRequest()->getParam('action') =='delete'){
47
- // d('aa');
48
- // d($this->getRequest()->getParam('product_id'));
49
-
50
- if($this->getRequest()->getParam('product_id')){
51
- $pId = $this->getRequest()->getParam('product_id');
52
- Mage::app()->setCurrentStore( Mage_Core_Model_App :: ADMIN_STORE_ID );
53
- $product = Mage::getModel('catalog/product')->load($pId)->delete();
54
-
55
- }
56
- }
57
- }
58
- $this->loadLayout();
59
- $this->renderLayout();
60
- }
61
-
62
- public function newproductAction()
63
- {
64
- //echo "<pre>"; print_r($this->getRequest()->getPost()); die;
65
-
66
- if($this->getRequest()->getPost())
67
- {
68
-
69
- $data = $this->getRequest()->getPost();
70
- $data['seller_id'] = $this->_getSession()->getId();
71
-
72
- $categoriesIds = array();
73
- foreach($data['category'] as $value){
74
- $categoriesIds[] = $value;
75
- }
76
- $data['category'] = $categoriesIds;
77
-
78
- $product = Mage::getModel("catalog/product")->setStoreId(0);
79
- $product->setTypeId('downloadable');
80
-
81
- //$product->setStatus($data["product"]['status']);
82
- $product->setStatus(2); //disabled
83
- //$product->setSku($data["product"]['sku']);
84
- $sku = time();
85
- $product->setSku($sku);
86
- $product->setTaxClassId(0);
87
-
88
- $product->setWebsiteIds(array(1)); // your website ids
89
-
90
- //$product->setStoreIds(array(1,4)); // your store ids
91
- if($data["product"]["stock_data"]['qty']>0)
92
- {
93
- $isstock = 1;
94
- }
95
- else
96
- {
97
- $isstock = 0;
98
- }
99
- $product->setStockData(array(
100
- 'is_in_stock' => $isstock,
101
- 'qty' => $data["product"]["stock_data"]['qty'],
102
- 'manage_stock' => 0,
103
- ));
104
-
105
- // set the rest of the product information here that can be set on either new/update
106
- $product->setAttributeSetId(Mage::getModel('catalog/product')->getResource()->getEntityType()->getDefaultAttributeSetId()); // the product attribute set to use
107
- $product->setName($data["product"]['name']);
108
- $product->setCategoryIds($data['category']); // array of categories it will relate to
109
- $product->setDescription($data["product"]['description']);
110
- $product->setShortDescription($data["product"]['description']);
111
-
112
- $product->setPrice($data["product"]['price']);
113
-
114
- $product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
115
- $product->setSellerId($data['seller_id']);
116
-
117
-
118
-
119
- if($data['hiddenvalue']){
120
- //$server = $_SERVER['DOCUMENT_ROOT'];
121
- $server = Mage::getBaseDir('media');
122
-
123
- $catalog = $server.'/uploads/'.$data['seller_id'].'/'.$data['hiddenvalue'].'/sample/';
124
-
125
- $visibility = array ('thumbnail','small_image','image');
126
- $product->setMediaGallery (array('images'=>array (), 'values'=>array ()));
127
-
128
- if ($handle = opendir($catalog)) {
129
- $k = 1;
130
- while (false !== ($file = readdir($handle))) {
131
- if ($file != "." && $file != "..") {
132
-
133
- //$product->addImageToMediaGallery($catalog.$file,$visibility,true,false);
134
- $path_info = pathinfo($file);
135
- if($path_info['extension']=='mp4' || $path_info['extension']=='flv')
136
- {
137
- $videoarray[] = $file;
138
- }
139
- else
140
- {
141
- $product->addImageToMediaGallery($catalog.$file,$visibility,true,false);
142
- }
143
- }
144
- }
145
- closedir($handle);
146
- }
147
-
148
- $comma_separated = implode(",", $videoarray);
149
- $product->setVideo($comma_separated);
150
-
151
-
152
- try{
153
- $kProduct = $product->save();
154
- $productmodel = Mage::getModel('catalog/product')->load($kProduct->getId());
155
- Mage::getModel('downloadable/link')->setData(array(
156
- 'product_id' => $productmodel->getId(),
157
- 'sort_order' => 0,
158
- 'number_of_downloads' => 0, // Unlimited downloads
159
- 'is_shareable' => 2, // Not shareable
160
- 'link_url' => $productmodel->getProductUrl(),
161
- 'link_type' => 'url',
162
- 'link_file' => '',
163
- 'sample_url' => '',
164
- 'sample_file' => '',
165
- 'sample_type' => '',
166
- 'use_default_title' => false,
167
- 'title' => $productmodel->getName(),
168
- 'default_price' => 0,
169
- 'price' => 0,
170
- 'store_id' => 0,
171
- 'website_id' => $productmodel->getStore()->getWebsiteId(),
172
- ))->save();
173
- $customer = Mage::getModel('customer/customer')->load($data['seller_id']);
174
- $maildetail['name'] = $customer->getName();
175
- $maildetail['email'] = $customer->getEmail();
176
- $maildetail['sku'] = $sku;
177
- $maildetail['product_name'] = $data["product"]['name'];
178
-
179
- $this->sendMail($this->_getHelper()->getPublishedProductEmailTemplate(), $maildetail);
180
-
181
- } catch(Exception $e){
182
- echo $e->getMessage();
183
- }
184
- $productfolder = $kProduct->getId();
185
- $videopath = $server.'/catalog/product/videos/';
186
-
187
- if(is_dir($videopath.$productfolder))
188
- {
189
- //echo "directory exists!";
190
- }
191
- else
192
- {
193
- //mkdir($videopath.$productfolder);
194
- @mkdir($videopath.$productfolder,0777);
195
- }
196
- $videoarray = array();
197
- if ($handle = opendir($catalog)) {
198
- while (false !== ($file = readdir($handle))) {
199
- if ($file != "." && $file != "..") {
200
-
201
- $path_info = pathinfo($file);
202
- if($path_info['extension']=='mp4' || $path_info['extension']=='flv')
203
- {
204
- $videoarray[] = $file;
205
- if (!copy($catalog.$file, $videopath.$productfolder."/".$file))
206
- {
207
- //echo "failed to copy $file...<br>";
208
- }
209
- else
210
- {
211
- //echo "File is successfully copied to ".$videopath.$file."<br>";
212
- unlink($catalog.$file);
213
- }
214
-
215
- }
216
- }
217
- }
218
-
219
- closedir($handle);
220
- }
221
-
222
- }
223
-
224
- }
225
- //==========
226
- $this->_redirect('sellergroup/index/publish/event/productsuccess');
227
- return;
228
-
229
- }
230
-
231
- public function editproductAction()
232
- {
233
- if($this->getRequest()->getPost()){
234
- $data = $this->getRequest()->getPost();
235
- //echo "<pre>";print_r($data);
236
-
237
- //die;
238
- $data['seller_id'] = $this->_getSession()->getId();
239
- foreach($data['category'] as $value){
240
- $categoriesIds[] = $value;
241
- }
242
- $data['category'] = $categoriesIds;
243
-
244
- Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
245
- $product = Mage::getModel("catalog/product")->setStoreId(0)->load($data['producthide']);
246
-
247
-
248
- if($data['hiddenvalue'])
249
- {
250
-
251
- $server = Mage::getBaseDir('media');
252
-
253
- $catalog = $server.'/uploads/'.$data['seller_id'].'/'.$data['hiddenvalue'].'/sample/';
254
-
255
- /*set the rest of the product information here that can be set on either new/update*/
256
- if(trim($product->getName())!=trim($data['product']['name']) || file_exists($server.'/uploads/'.$data['seller_id'].'/'.$data['hiddenvalue'].'/'))
257
- {
258
-
259
- Mage::getModel('catalog/product_status')->updateProductStatus($product->getEntityId(), 0, Mage_Catalog_Model_Product_Status::STATUS_DISABLED); /* here 0 is admin store id */
260
- $product->setUrlKey();
261
- $product->setApproveProduct(0);/* set to not approved product */
262
- $customer = Mage::getModel('customer/customer')->load($data['seller_id']);
263
- $maildetail['name'] = $customer->getName();
264
- $maildetail['email'] = $customer->getEmail();
265
- $maildetail['sku'] = $product->getSku();
266
- $maildetail['product_name'] = $data['product']['name'];
267
- $this->sendMail($this->_getHelper()->getPublishedProductEmailTemplate(), $maildetail);
268
- }
269
-
270
- $visibility = array ('thumbnail','small_image','image');
271
- $product->setMediaGallery (array('images'=>array (), 'values'=>array ()));
272
-
273
- $videopath = $server.'/catalog/product/videos/'.$data['producthide'].'/';
274
-
275
- if($product->getVideo()!='')
276
- {
277
- $videoarray = array($product->getVideo());
278
- }
279
- else
280
- {
281
- $videoarray = array();
282
- }
283
- if ($handle = opendir($catalog)) {
284
- $k = 1;
285
- while (false !== ($file = readdir($handle))) {
286
- if ($file != "." && $file != "..") {
287
-
288
- $path_info = pathinfo($file);
289
- if($path_info['extension']=='mp4' || $path_info['extension']=='flv')
290
- {
291
-
292
- $videoarray[] = $file;
293
- if (!copy($catalog.$file, $videopath.$file))
294
- {
295
- //echo "failed to copy $file...<br>";
296
- }
297
- else
298
- {
299
- //echo "File is successfully copied to ".$videopath.$file."<br>";
300
- unlink($catalog.$file);
301
- }
302
-
303
- }
304
- else
305
- {
306
- $product->addImageToMediaGallery($catalog.$file,$visibility,true,false);
307
- }
308
-
309
- }
310
- }
311
- $comma_separated = implode(",", $videoarray);
312
- $product->setVideo($comma_separated);
313
- closedir($handle);
314
- }
315
-
316
- }
317
-
318
-
319
- $product->setName($data["product"]['name']);
320
- $product->setStatus($data["product"]['status']);
321
- $product->setCategoryIds($data['category']); // array of categories it will relate to
322
- $product->setDescription($data["product"]['description']);
323
- $product->setShortDescription($data["product"]['description']);
324
- $product->setPrice($data["product"]['price']);
325
-
326
- if($data["product"]["stock_data"]['qty']>0)
327
- {
328
- $isstock = 1;
329
- }
330
- else
331
- {
332
- $isstock = 0;
333
- }
334
-
335
- $product->setStockData(array(
336
- 'is_in_stock' => $isstock,
337
- 'qty' => $data["product"]["stock_data"]['qty'],
338
- 'manage_stock' => 0,
339
- ));
340
-
341
- try{
342
- $product->save();
343
- $productmodel = Mage::getModel('catalog/product')->load($product->getId());
344
- Mage::getModel('downloadable/link')->setData(array(
345
- 'product_id' => $productmodel->getId(),
346
- 'sort_order' => 0,
347
- 'number_of_downloads' => 0, // Unlimited downloads
348
- 'is_shareable' => 2, // Not shareable
349
- 'link_url' => $productmodel->getProductUrl(),
350
- 'link_type' => 'url',
351
- 'link_file' => '',
352
- 'sample_url' => '',
353
- 'sample_file' => '',
354
- 'sample_type' => '',
355
- 'use_default_title' => false,
356
- 'title' => $productmodel->getName(),
357
- 'default_price' => 0,
358
- 'price' => 0,
359
- 'store_id' => 0,
360
- 'website_id' => $productmodel->getStore()->getWebsiteId(),
361
- ))->save();
362
-
363
- } catch(Exception $e){
364
- echo $e->getMessage();
365
- }
366
-
367
- if(isset($data['deleteimagefile'])){
368
- $this->deleteImage($data['producthide'],$data['deleteimagefile']);
369
- }
370
- if(isset($data['deletelink'])){
371
- $this->deleteLink($data['producthide'],$data['deletelink']);
372
- }
373
- $this->_redirect('sellergroup/index/publish/event/productsuccess');
374
- return;
375
- }
376
- $this->loadLayout();
377
- $this->renderLayout();
378
- }
379
-
380
- public function uploadifyAction()
381
- {
382
- if (!empty($_FILES)) {
383
- $tempFile = $_FILES['Filedata']['tmp_name'];
384
-
385
- $targetPath = Mage::getBaseDir('media') .'/uploads/'. $_REQUEST['folder'] . '/';
386
- $rightTargetPath = str_replace('//','/',$targetPath);
387
- $cat = explode('/',$_REQUEST['folder']);
388
- $needPath = Mage::getBaseDir('media').'/uploads/';
389
- @mkdir($needPath,0777);
390
- foreach($cat as $newcat){
391
- if($newcat != ''){
392
- $needPath .= $newcat.'/';
393
- @mkdir($needPath,0777);// exit("Failed to create directory!");
394
- }
395
- }
396
- $fileName = $this->checkfilename($_FILES['Filedata']['name'],$rightTargetPath);
397
- $targetFile = $rightTargetPath. $fileName;
398
- // if (file_exists($targetFile)) {
399
- // die('YES');
400
- // }
401
- @move_uploaded_file($tempFile,$targetFile);
402
- die(str_replace(Mage::getBaseDir('media'),'',$targetFile));
403
- }
404
- if ($_REQUEST['action'] == 'delete')
405
- {
406
- //delete file
407
- // die('sdf');
408
- // $targetPath = $_SERVER['DOCUMENT_ROOT'] .'/uploads'. $_REQUEST['folder'] . '';
409
- //$targetPath = $_SERVER['DOCUMENT_ROOT'];
410
- $targetPath = Mage::getBaseDir('media');
411
- $targetPath = $targetPath . $_REQUEST['filename'];
412
- dd($targetPath);
413
- if (@file_exists($targetPath)) {
414
-
415
- dd($targetPath);
416
- @unlink($targetPath);}
417
- // $targetThumbPath = $targetPath."";
418
- //if (@file_exists($targetThumbPath)) @unlink($targetThumbPath);
419
- die('ok');
420
- echo 'ok';
421
- }
422
-
423
- }
424
- public function checkfilename($filename,$filepath)
425
- {
426
- if (@file_exists($filepath.$filename)) {
427
- $array = explode('.',$filename);
428
- $ext = array_pop($array);
429
- $newFileName = '';
430
- foreach($array as $itemArray){
431
- $newFileName = $newFileName.$itemArray;
432
- }
433
- $newFileName = $newFileName.'1'.'.'.$ext;
434
- if(@file_exists($filepath.$newFileName)){
435
-
436
- $newFileName = $this->checkfilename($newFileName,$filepath);
437
- }
438
- $filename = $newFileName;
439
- }
440
- return $filename;
441
- }
442
-
443
- public function ajaximageAction()
444
- {
445
- //dd($this->getRequest()->getId());
446
- //$postData = $this->getRequest()->getPost();
447
-
448
- if (!$this->_getSession()->isLoggedIn()) {
449
- die('no');
450
- } else{
451
- $userId = (int) $this->_getSession()->getId();
452
- if($this->getRequest()->getPost()){
453
- $postData = $this->getRequest()->getPost();
454
- if($this->checkuserrule($postData['prod_id']) ){
455
- $this->deleteImage($postData['prod_id'],array($postData['name'])) ;
456
-
457
- die($postData['id']);
458
- }
459
- }
460
- }
461
-
462
- }
463
-
464
- public function checkuserrule($productId)
465
- {
466
- if($product = Mage::getModel('catalog/product')->load($productId)) {
467
- if($product->getSellerId() == $this->_getSession()->getId()){
468
- return true;
469
- }
470
- }
471
- return false;
472
-
473
- }
474
-
475
- public function deleteImage($productId,$arrayRemoveImage)
476
- {
477
- Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
478
- $product = Mage::getModel ('catalog/product') ;
479
- $product->setStoreId(0)->load($productId);
480
- $product->setImage(null);
481
- $product->setThumbnail(null);
482
- $product->setSmallImage(null);
483
- $product->save();
484
-
485
- $product = Mage::getModel ( 'catalog/product' ) ;
486
- $product->setStoreId(0)->load($productId);
487
-
488
- $mediaApi = Mage::getModel("catalog/product_attribute_media_api");
489
-
490
- $items = $mediaApi->items($product->getId());
491
-
492
- foreach($items as $item){
493
- $itemName = explode('/',$item['file']);
494
- $itemName =array_pop($itemName);
495
- if(in_array($itemName,$arrayRemoveImage)){
496
-
497
- try{
498
- $mediaApi->remove($product->getId(), $item['file']);
499
- } catch(Exception $e){
500
- }
501
- }
502
- }
503
-
504
- $product->save();
505
-
506
- $product = Mage::getModel ('catalog/product')->setStoreId(0) ;
507
- $product->load($productId);
508
- $file = $product->getMediaGalleryImages()->getLastItem()->getData("file");
509
-
510
- $product->setImage($file);
511
- $product->setThumbnail($file);
512
- $product->setSmallImage($file);
513
- $product->save();
514
- }
515
-
516
- public function ajaxvideoAction()
517
- {
518
- //dd($this->getRequest()->getId());
519
- if (!$this->_getSession()->isLoggedIn()) {
520
-
521
- } else{
522
- $userId = (int) $this->_getSession()->getId();
523
- if($this->getRequest()->getPost()){
524
- $postData = $this->getRequest()->getPost();
525
-
526
- if($this->checkuserrule($postData['prod_id']) )
527
- {
528
- $videopath = Mage::getBaseDir('media')."/catalog/product/videos/".$postData['prod_id']."/";
529
- $videoarray = array();
530
- if ($handle = opendir($videopath))
531
- {
532
- while (false !== ($file = readdir($handle)))
533
- {
534
- if ($file != "." && $file != "..")
535
- {
536
- $videoarray[] = $file;
537
- if($postData['name']==$file)
538
- {
539
- unlink($videopath.$file);
540
- Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
541
- $product = Mage::getModel ('catalog/product')->setStoreId(0)->load($postData['prod_id']);
542
- $avail_video = $product->getVideo();
543
- $rep_string = str_replace($postData['name'],'',$avail_video);
544
-
545
- if($rep_string[0] == ',')
546
- {
547
- $len = strlen($rep_string)-1;
548
- $fstring = substr($rep_string,1,$len);
549
-
550
- }
551
- elseif($rep_string[strlen($rep_string)-1] == ',')
552
- {
553
- $len = strlen($rep_string)-1;
554
- $fstring = substr($rep_string,0,$len);
555
-
556
- }
557
- elseif(stristr($rep_string,",,"))
558
- {
559
- $fstring = str_replace(",,",",",$rep_string);
560
- }
561
- else
562
- {
563
- $fstring = $rep_string;
564
- }
565
- $product->setVideo($fstring);
566
- $product->save();
567
- }
568
-
569
- }
570
- }
571
-
572
- closedir($handle);
573
- }
574
-
575
- }
576
- }
577
- }
578
- }
579
-
580
- public function bankaccountAction()
581
- {
582
- $action = $this->getRequest()->getParam('action');
583
-
584
- if ($action == '')
585
- {
586
- $this->loadLayout();
587
- $this->_initLayoutMessages('customer/session');
588
- $this->_initLayoutMessages('catalog/session');
589
-
590
- $this->getLayout()->getBlock('head')->setTitle($this->__('Bank Account Setting'));
591
- $this->renderLayout();
592
- }
593
- elseif ($action == 'save')
594
- {
595
- $bankArray = $this->getRequest()->getParam('bank');
596
- // d($bankArray) ;
597
-
598
- $conn = Mage::getSingleton('core/resource')->getConnection('core_write');
599
- //$results = $conn->query("update customer_entity set received_by=".$bankArray['received_by'].",paypal='".$bankArray['paypal']."',alipay='".$bankArray['alipay']."',bank_country='".$bankArray['country']."',bank_accountname='".$bankArray['account_name']."',bank_name='".$bankArray['name']."',bank_branch='".$bankArray['branch']."',bank_accountnums='".$bankArray['account_nums']."' where entity_id=".$this->getCustomerId());
600
- $results = $conn->query("update customer_entity set paypal='".strip_tags($bankArray['paypal'])."' where entity_id=".$this->_getSession()->getCustomerId());
601
- Mage::getSingleton('customer/session')->addSuccess($this->__('The account information has been saved.'));
602
- $this->_redirect('*/*/bankaccount/');
603
- return;
604
- }
605
- }
606
- public function redirecttocheckoutAction()
607
- {
608
- $this->getRequest()->getParam('price');
609
- $vpid = Mage::getSingleton('core/session')->getVirtualProductId();
610
-
611
- if( $this->getRequest()->getParam('price')){
612
- //clear cart
613
- foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
614
- Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
615
- }
616
- $this->_redirect('checkout/cart/add?product='.$vpid.'&qty='.$this->getRequest()->getParam('price'));
617
- } else {
618
- $this->_redirect('assetmanager/index/bankaccount/');
619
- }
620
- return ;
621
- }
622
-
623
- public function salesreportAction()
624
- {
625
- $this->loadLayout();
626
- $this->renderLayout();
627
- }
628
-
629
- public function sendMail($template,$maildetail)
630
- {
631
-
632
- /* @var $translate Mage_Core_Model_Translate */
633
- $translate = Mage::getSingleton('core/translate');
634
- $translate->setTranslateInline(false);
635
-
636
- /* @var $mailTemplate Mage_Core_Model_Email_Template */
637
- $mailTemplate = Mage::getModel('core/email_template');
638
-
639
-
640
- /* $sender = array(
641
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
642
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
643
- );*/
644
-
645
- $sender = array(
646
- 'name' => $maildetail['name'],
647
- 'email' => $maildetail['email']
648
- );
649
-
650
- $recipient = array(
651
- 'name' => Mage::getStoreConfig('trans_email/ident_general/name'),
652
- 'email' => Mage::getStoreConfig('trans_email/ident_general/email')
653
- );
654
-
655
- $mailTemplate->setDesignConfig(array(
656
- 'area' => 'frontend',
657
- 'store' => Mage::app()->getStore()->getId()
658
- ));
659
-
660
- $mailTemplate->sendTransactional(
661
- $template,
662
- $sender,
663
- $recipient['email'],
664
- $recipient['name'],
665
- array(
666
- 'name' => $recipient['name'],
667
- 'sku' => $maildetail['sku'],
668
- 'product_name' => $maildetail['product_name'],
669
- 'website' => Mage::getUrl(),
670
- 'store' => $store
671
- )
672
- );
673
-
674
- $translate->setTranslateInline(true);
675
- }
676
-
677
- public function is_dir_empty($dir) {
678
-
679
- $handle = opendir($dir);
680
- while (false !== ($entry = readdir($handle))) {
681
- if ($entry != "." && $entry != "..") {
682
- return 1;
683
- }
684
- }
685
- return 0;
686
- }
687
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/etc/config.xml DELETED
@@ -1,221 +0,0 @@
1
- <?xml version="1.0" ?>
2
- <config>
3
- <modules>
4
- <Ifuturz_Sellergroup>
5
- <version>0.1.2</version>
6
- </Ifuturz_Sellergroup>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <sellergroup>
11
- <use>standard</use>
12
- <args>
13
- <module>Ifuturz_Sellergroup</module>
14
- <frontName>sellergroup</frontName>
15
- </args>
16
- </sellergroup>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <sellergroup>
21
- <file>sellergroup.xml</file>
22
- </sellergroup>
23
- </updates>
24
- </layout>
25
- </frontend>
26
-
27
- <admin>
28
- <routers>
29
- <sellergroup>
30
- <use>admin</use>
31
- <args>
32
- <module>Ifuturz_Sellergroup</module>
33
- <frontName>sellergroup</frontName>
34
- </args>
35
- </sellergroup>
36
- <!--<adminhtml>
37
- <args>
38
- <modules>
39
- <Ifuturz_Sellergroup before="Mage_Adminhtml">Ifuturz_Sellergroup</Ifuturz_Sellergroup>
40
- </modules>
41
- </args>
42
- </adminhtml>-->
43
- </routers>
44
- </admin>
45
- <adminhtml>
46
- <menu>
47
- <customer>
48
- <children>
49
- <sellergroup translate="title" module="sellergroup">
50
- <title>Seller Groups</title>
51
- <action>sellergroup/adminhtml_sellergroup</action>
52
- <sort_order>110</sort_order>
53
- </sellergroup>
54
- </children>
55
- </customer>
56
- </menu>
57
- <layout>
58
- <updates>
59
- <sellergroup>
60
- <file>sellergroup.xml</file>
61
- </sellergroup>
62
- </updates>
63
- </layout>
64
- <events>
65
- <catalog_product_save_after>
66
- <observers>
67
- <ifuturz_save_product_data>
68
- <type>singleton</type>
69
- <class>sellergroup/observer</class>
70
- <method>saveProductTabData</method>
71
- </ifuturz_save_product_data>
72
- </observers>
73
- </catalog_product_save_after>
74
- </events>
75
- <acl>
76
- <resources>
77
- <admin>
78
- <children>
79
- <system>
80
- <children>
81
- <config>
82
- <children>
83
- <sellergroup>
84
- <title>sellergroup</title>
85
- </sellergroup>
86
- </children>
87
- </config>
88
- </children>
89
- </system>
90
- </children>
91
- </admin>
92
- </resources>
93
- </acl>
94
- </adminhtml>
95
- <global>
96
- <models>
97
- <checkout>
98
- <rewrite>
99
- <type_onepage>Ifuturz_Sellergroup_Model_Checkout_Type_Onepage</type_onepage>
100
- </rewrite>
101
- </checkout>
102
- <sellergroup>
103
- <class>Ifuturz_Sellergroup_Model</class>
104
- <resourceModel>sellergroup_mysql4</resourceModel>
105
- </sellergroup>
106
- <sellergroup_sellercommission>
107
- <class>Ifuturz_Sellergroup_Model_Sellercommission</class>
108
- <resourceModel>sellergroup_mysql4</resourceModel>
109
- </sellergroup_sellercommission>
110
- <sellergroup_customerbalance>
111
- <class>Ifuturz_Sellergroup_Model_Customerbalance</class>
112
- <resourceModel>sellergroup_mysql4</resourceModel>
113
- </sellergroup_customerbalance>
114
- <sellergroup_mysql4>
115
- <class>Ifuturz_Sellergroup_Model_Mysql4</class>
116
- <entities>
117
- <sellergroup>
118
- <table>sellergroup</table>
119
- </sellergroup>
120
- <sellergroup_sellercommission>
121
- <table>sellergroup_sellercommission</table>
122
- </sellergroup_sellercommission>
123
- <sellergroup_customerbalance>
124
- <table>customerbalance</table>
125
- </sellergroup_customerbalance>
126
- </entities>
127
- </sellergroup_mysql4>
128
- </models>
129
- <resources>
130
- <sellergroup_setup>
131
- <setup>
132
- <module>Ifuturz_Sellergroup</module>
133
- <class>Ifuturz_Sellergroup_Model_Mysql4_Setup</class>
134
- </setup>
135
- <connection>
136
- <use>core_setup</use>
137
- </connection>
138
- </sellergroup_setup>
139
- <sellergroup_write>
140
- <connection>
141
- <use>core_write</use>
142
- </connection>
143
- </sellergroup_write>
144
- <sellergroup_read>
145
- <connection>
146
- <use>core_read</use>
147
- </connection>
148
- </sellergroup_read>
149
- </resources>
150
- <blocks>
151
- <sellergroup>
152
- <class>Ifuturz_Sellergroup_Block</class>
153
- </sellergroup>
154
- <adminhtml>
155
- <rewrite>
156
- <customer_grid>Ifuturz_Sellergroup_Block_Adminhtml_Customer_Grid</customer_grid>
157
- </rewrite>
158
- </adminhtml>
159
- </blocks>
160
- <helpers>
161
- <sellergroup>
162
- <class>Ifuturz_Sellergroup_Helper</class>
163
- </sellergroup>
164
- </helpers>
165
- <events>
166
- <sales_order_payment_pay>
167
- <observers>
168
- <sellergroup_observer>
169
- <type>singleton</type>
170
- <class>sellergroup/observer</class>
171
- <method>calculateCommission</method>
172
- </sellergroup_observer>
173
- </observers>
174
- </sales_order_payment_pay>
175
- <customer_register_success>
176
- <observers>
177
- <sellergroup_observer>
178
- <type>singleton</type>
179
- <class>sellergroup/observer</class>
180
- <method>customerSuccess</method>
181
- </sellergroup_observer>
182
- </observers>
183
- </customer_register_success>
184
- </events>
185
- <template>
186
- <email>
187
- <sellergroup_email_comment_template module="sellergroup">
188
- <label>Product Approval</label>
189
- <file>sellergroup/product_comment.html</file>
190
- <type>html</type>
191
- </sellergroup_email_comment_template>
192
- <sellergroup_email_publishedproduct_template module="sellergroup">
193
- <label>Product Published</label>
194
- <file>sellergroup/product_published.html</file>
195
- <type>html</type>
196
- </sellergroup_email_publishedproduct_template>
197
- <sellergroup_email_productsold_template module="sellergroup">
198
- <label>Product Sold</label>
199
- <file>sellergroup/product_sold.html</file>
200
- <type>html</type>
201
- </sellergroup_email_productsold_template>
202
- </email>
203
- </template>
204
- </global>
205
- <default>
206
- <sellergroup>
207
- <email>
208
- <comment>
209
- <template>sellergroup_email_comment_template</template>
210
- </comment>
211
- <publishedproduct>
212
- <template>sellergroup_email_publishedproduct_template</template>
213
- </publishedproduct>
214
- <productsold>
215
- <template>sellergroup_email_productsold_template</template>
216
- </productsold>
217
- </email>
218
- </sellergroup>
219
- </default>
220
-
221
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-install-0.1.0.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
- /*code to create sellergroup table */
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('sellergroup')};
10
- CREATE TABLE {$this->getTable('sellergroup')} (
11
- `sellergroup_id` int(11) unsigned NOT NULL auto_increment,
12
- `seller_group_code` varchar(50) NULL,
13
- `seller_commission` float NULL,
14
- `sellergroup_upgrade_threshold` int(11) NULL,
15
- PRIMARY KEY (`sellergroup_id`)
16
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17
-
18
- ");
19
- /*code to create sellergroup_sellercommission table */
20
- $installer->run("
21
-
22
- -- DROP TABLE IF EXISTS {$this->getTable('sellergroup_sellercommission')};
23
- CREATE TABLE {$this->getTable('sellergroup_sellercommission')} (
24
- `sellercommission_id` int(11) unsigned NOT NULL auto_increment,
25
- `product_id` int(11) unsigned NOT NULL,
26
- `seller_id` int(11) unsigned NOT NULL,
27
- `buyer_id` int(11) unsigned NOT NULL,
28
- `order_id` int(11) unsigned NOT NULL,
29
- `seller_group` int(11) NULL,
30
- `seller_percent` float NULL,
31
- `seller_commission_amt` float NULL,
32
- `owner_commission_amt` float NULL,
33
- `created_at` datetime NULL,
34
- PRIMARY KEY (`sellercommission_id`)
35
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
36
-
37
- ");
38
- /*code to create customerbalance table */
39
- $installer->run("
40
- CREATE TABLE {$this->getTable('customerbalance')} (
41
- `balance_id` INT NOT NULL AUTO_INCREMENT ,
42
- `customer_id` INT( 10 ) UNSIGNED NOT NULL ,
43
- `website_id` SMALLINT( 5 ) NOT NULL ,
44
- `balance` DECIMAL( 12, 4 ) NOT NULL ,
45
- PRIMARY KEY ( `balance_id` ),
46
- KEY `FK_CUSTOMERBALANCE_CUSTOMER_ENTITY` (`customer_id`),
47
- CONSTRAINT `FK_CUSTOMERBALANCE_CUSTOMER_ENTITY` FOREIGN KEY (customer_id) REFERENCES `{$this->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
48
- ) ENGINE = InnoDB
49
- ");
50
- /*code to add product attribute */
51
- $installer->addAttribute('catalog_product', 'seller_id', array(
52
- 'type' => 'varchar',
53
- 'backend' => '',
54
- 'frontend' => '',
55
- 'label' => 'Seller ID',
56
- 'input' => 'text',
57
- 'class' => '',
58
- 'source' => '',
59
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
60
- 'visible' => false,
61
- 'required' => false,
62
- 'user_defined' => false,
63
- 'default' => '',
64
- 'searchable' => false,
65
- 'filterable' => false,
66
- 'comparable' => false,
67
- 'visible_on_front' => false,
68
- 'unique' => false,
69
- 'apply_to' => '',
70
- 'is_configurable' => false
71
- ));
72
- /*code to add product attribute */
73
- $installer->addAttribute('catalog_product', 'video', array(
74
- 'type' => 'varchar',
75
- 'backend' => '',
76
- 'frontend' => '',
77
- 'label' => 'Video',
78
- 'input' => 'text',
79
- 'class' => '',
80
- 'source' => '',
81
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
82
- 'visible' => false,
83
- 'required' => false,
84
- 'user_defined' => false,
85
- 'default' => '',
86
- 'searchable' => false,
87
- 'filterable' => false,
88
- 'comparable' => false,
89
- 'visible_on_front' => false,
90
- 'unique' => false,
91
- 'apply_to' => '',
92
- 'is_configurable' => false
93
- ));
94
- /*code to add column to the customer table*/
95
- $conn = $installer->getConnection();
96
- $conn->addColumn($this->getTable('customer_entity'), 'paypal', 'varchar(128) null');
97
- $conn->addColumn($this->getTable('customer_entity'), 'sellergroup_id', 'int(11) unsigned NOT NULL');
98
-
99
- /*code to add sellergroup_id to the eav table*/
100
- $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
101
-
102
- $entityTypeId = $setup->getEntityTypeId('customer');
103
- $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
104
- $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
105
-
106
- $setup->addAttribute('customer', 'sellergroup_id', array(
107
- 'input' => 'select',
108
- 'type' => 'static',
109
- 'label' => 'Seller Group',
110
- 'visible' => 1,
111
- 'required' => 0,
112
- 'user_defined' => 1,
113
- 'source' => 'sellergroup/sellergroup_attribute_source_sellergroup',
114
- ));
115
-
116
- $setup->addAttributeToGroup(
117
- $entityTypeId,
118
- $attributeSetId,
119
- $attributeGroupId,
120
- 'sellergroup_id'
121
- //'999' //sort_order
122
- );
123
-
124
- $oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'sellergroup_id');
125
- $oAttribute->setData('used_in_forms', array('adminhtml_customer'));
126
- $oAttribute->save();
127
-
128
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-upgrade-0.1.0-0.1.1.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
- /*code to add product attribute */
7
- $installer->addAttribute('catalog_product', 'comment_publisher', array(
8
- 'type' => 'varchar',
9
- 'backend' => '',
10
- 'frontend' => '',
11
- 'label' => 'Comment To Publisher',
12
- 'input' => 'textarea',
13
- 'class' => '',
14
- 'source' => '',
15
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
16
- 'note' => 'comment to product publisher for product approved or not approved',
17
- 'visible' => false,
18
- 'required' => true,
19
- 'user_defined' => false,
20
- 'default' => '',
21
- 'searchable' => false,
22
- 'filterable' => false,
23
- 'comparable' => false,
24
- 'visible_on_front' => false,
25
- 'unique' => false,
26
- 'apply_to' => '',
27
- 'is_configurable' => false
28
- ));
29
-
30
- $installer->addAttribute('catalog_product', 'approve_product', array(
31
- 'type' => 'int',
32
- 'backend' => '',
33
- 'frontend' => '',
34
- 'label' => 'Approve Product',
35
- 'input' => 'boolean',
36
- 'class' => '',
37
- 'source' => '',
38
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
39
- 'note' => 'set approval for the product after seeing the product image and video',
40
- 'visible' => false,
41
- 'required' => true,
42
- 'user_defined' => false,
43
- 'default' => '',
44
- 'searchable' => false,
45
- 'filterable' => false,
46
- 'comparable' => false,
47
- 'visible_on_front' => false,
48
- 'unique' => false,
49
- 'apply_to' => '',
50
- 'is_configurable' => false
51
- ));
52
-
53
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Sellergroup/sql/sellergroup_setup/mysql4-upgrade-0.1.1-0.1.2.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
- /*code to add product attribute */
7
-
8
- $installer->addAttribute('catalog_product', 'is_seller_notified', array(
9
- 'type' => 'int',
10
- 'backend' => '',
11
- 'frontend' => '',
12
- 'label' => 'Notify Seller By Email',
13
- 'input' => 'boolean',
14
- 'group' => '',
15
- 'class' => '',
16
- 'source' => '',
17
- 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
18
- 'note' => 'set yes if you want to send comment for the product approval to product seller',
19
- 'visible' => false,
20
- 'required' => false,
21
- 'user_defined' => false,
22
- 'default' => '',
23
- 'searchable' => false,
24
- 'filterable' => false,
25
- 'comparable' => false,
26
- 'visible_on_front' => false,
27
- 'unique' => false,
28
- 'apply_to' => '',
29
- 'is_configurable' => false
30
- ));
31
-
32
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Form.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Uploadpdf_Block_Adminhtml_Uploadpdf_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
- {
5
- protected function _prepareForm()
6
- {
7
- $form = new Varien_Data_Form(array(
8
- 'id' => 'edit_form',
9
- 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
- 'method' => 'post',
11
- 'enctype' => 'multipart/form-data'
12
- )
13
- );
14
-
15
- $form->setUseContainer(true);
16
- $this->setForm($form);
17
- return parent::_prepareForm();
18
- }
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Tab/Uploadpdf.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Open Software License (OSL 3.0)
8
- * that is bundled with this package in the file LICENSE.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/osl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category Mage
22
- * @package Mage_Adminhtml
23
- * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
- */
26
-
27
- /**
28
- * Product inventory data
29
- *
30
- * @author Magento Core Team <core@magentocommerce.com>
31
- */
32
- class Ifuturz_Uploadpdf_Block_Adminhtml_Catalog_Product_Edit_Tab_Uploadpdf extends Mage_Adminhtml_Block_Widget
33
- {
34
- public function __construct()
35
- {
36
- parent::__construct();
37
- $this->setTemplate('uploadpdf/catalog/product/tab/uploadpdf.phtml');
38
- }
39
-
40
-
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Block/Adminhtml/Catalog/Product/Edit/Tabs.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- require_once 'Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php';
3
- class Ifuturz_Uploadpdf_Block_Adminhtml_Catalog_Product_Edit_Tabs
4
- extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs
5
- {
6
- protected function _prepareLayout()
7
- {
8
- $product = $this->getProduct();
9
-
10
- if (!($setId = $product->getAttributeSetId())) {
11
- $setId = $this->getRequest()->getParam('set', null);
12
- }
13
-
14
- if ($setId) {
15
- $groupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
16
- ->setAttributeSetFilter($setId)
17
- ->setSortOrder()
18
- ->load();
19
- /*$groupCollection = Mage::getResourceModel('eav/entity_attribute_group_collection')
20
- ->setAttributeSetFilter($setId)
21
- ->load();*/
22
-
23
- foreach ($groupCollection as $group) {
24
- $attributes = $product->getAttributes($group->getId(), true);
25
- // do not add groups without attributes
26
-
27
- foreach ($attributes as $key => $attribute) {
28
- if( !$attribute->getIsVisible() ) {
29
- unset($attributes[$key]);
30
- }
31
- }
32
-
33
- if (count($attributes)==0) {
34
- continue;
35
- }
36
-
37
- $this->addTab('group_'.$group->getId(), array(
38
- 'label' => Mage::helper('catalog')->__($group->getAttributeGroupName()),
39
- 'content' => $this->_translateHtml($this->getLayout()->createBlock($this->getAttributeTabBlock(),
40
- 'adminhtml.catalog.product.edit.tab.attributes')->setGroup($group)
41
- ->setGroupAttributes($attributes)
42
- ->toHtml()),
43
- ));
44
- }
45
- /* ------------------- Added code by R ----------------------- */
46
-
47
- $geteditid = $_GET['editid'];
48
-
49
- if (Mage::helper('core')->isModuleEnabled('Mage_CatalogInventory'))
50
- {
51
- $this->addTab('inventory', array(
52
- 'label' => Mage::helper('catalog')->__('Inventory'),
53
- 'content' => $this->_translateHtml($this->getLayout()
54
- ->createBlock('adminhtml/catalog_product_edit_tab_inventory')->toHtml()),
55
- ));
56
-
57
- /* ------------------- START Added code by R ----------------------- */
58
- if($geteditid != '')
59
- {
60
- $this->addTab('Upload PDF', array(
61
- 'label' => Mage::helper('catalog')->__('Upload PDF'),
62
- 'active' => true,
63
- 'content' => $this->_translateHtml($this->getLayout()
64
- ->createBlock('uploadpdf/adminhtml_catalog_product_edit_tab_uploadpdf')->toHtml()),
65
- ));
66
- }
67
- else
68
- {
69
- $this->addTab('Upload PDF', array(
70
- 'label' => Mage::helper('catalog')->__('Upload PDF'),
71
- 'content' => $this->_translateHtml($this->getLayout()
72
- ->createBlock('uploadpdf/adminhtml_catalog_product_edit_tab_uploadpdf')->toHtml()),
73
- ));
74
-
75
- }
76
- /* ------------------- END Added code by R ----------------------- */
77
- }
78
-
79
- /**
80
- * Don't display website tab for single mode
81
- */
82
- if (!Mage::app()->isSingleStoreMode()) {
83
- $this->addTab('websites', array(
84
- 'label' => Mage::helper('catalog')->__('Websites'),
85
- 'content' => $this->_translateHtml($this->getLayout()
86
- ->createBlock('adminhtml/catalog_product_edit_tab_websites')->toHtml()),
87
- ));
88
- }
89
-
90
- $this->addTab('categories', array(
91
- 'label' => Mage::helper('catalog')->__('Categories'),
92
- 'url' => $this->getUrl('*/*/categories', array('_current' => true)),
93
- 'class' => 'ajax',
94
- ));
95
-
96
- $this->addTab('related', array(
97
- 'label' => Mage::helper('catalog')->__('Related Products'),
98
- 'url' => $this->getUrl('*/*/related', array('_current' => true)),
99
- 'class' => 'ajax',
100
- ));
101
-
102
- $this->addTab('upsell', array(
103
- 'label' => Mage::helper('catalog')->__('Up-sells'),
104
- 'url' => $this->getUrl('*/*/upsell', array('_current' => true)),
105
- 'class' => 'ajax',
106
- ));
107
-
108
- $this->addTab('crosssell', array(
109
- 'label' => Mage::helper('catalog')->__('Cross-sells'),
110
- 'url' => $this->getUrl('*/*/crosssell', array('_current' => true)),
111
- 'class' => 'ajax',
112
- ));
113
-
114
-
115
- $storeId = 0;
116
- if ($this->getRequest()->getParam('store')) {
117
- $storeId = Mage::app()->getStore($this->getRequest()->getParam('store'))->getId();
118
- }
119
-
120
- $alertPriceAllow = Mage::getStoreConfig('catalog/productalert/allow_price');
121
- $alertStockAllow = Mage::getStoreConfig('catalog/productalert/allow_stock');
122
-
123
- if (($alertPriceAllow || $alertStockAllow) && !$product->isGrouped()) {
124
- $this->addTab('productalert', array(
125
- 'label' => Mage::helper('catalog')->__('Product Alerts'),
126
- 'content' => $this->_translateHtml($this->getLayout()
127
- ->createBlock('adminhtml/catalog_product_edit_tab_alerts', 'admin.alerts.products')->toHtml())
128
- ));
129
- }
130
-
131
- if( $this->getRequest()->getParam('id', false) ) {
132
- if (Mage::helper('catalog')->isModuleEnabled('Mage_Review')) {
133
- if (Mage::getSingleton('admin/session')->isAllowed('admin/catalog/reviews_ratings')){
134
- $this->addTab('reviews', array(
135
- 'label' => Mage::helper('catalog')->__('Product Reviews'),
136
- 'url' => $this->getUrl('*/*/reviews', array('_current' => true)),
137
- 'class' => 'ajax',
138
- ));
139
- }
140
- }
141
- if (Mage::helper('catalog')->isModuleEnabled('Mage_Tag')) {
142
- if (Mage::getSingleton('admin/session')->isAllowed('admin/catalog/tag')){
143
- $this->addTab('tags', array(
144
- 'label' => Mage::helper('catalog')->__('Product Tags'),
145
- 'url' => $this->getUrl('*/*/tagGrid', array('_current' => true)),
146
- 'class' => 'ajax',
147
- ));
148
-
149
- $this->addTab('customers_tags', array(
150
- 'label' => Mage::helper('catalog')->__('Customers Tagged Product'),
151
- 'url' => $this->getUrl('*/*/tagCustomerGrid', array('_current' => true)),
152
- 'class' => 'ajax',
153
- ));
154
- }
155
- }
156
-
157
-
158
- }
159
-
160
- /**
161
- * Do not change this tab id
162
- * @see Mage_Adminhtml_Block_Catalog_Product_Edit_Tabs_Configurable
163
- * @see Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tabs
164
- */
165
- if (!$product->isGrouped()) {
166
- $this->addTab('customer_options', array(
167
- 'label' => Mage::helper('catalog')->__('Custom Options'),
168
- 'url' => $this->getUrl('*/*/options', array('_current' => true)),
169
- 'class' => 'ajax',
170
- ));
171
- }
172
-
173
- }
174
- else {
175
- $this->addTab('set', array(
176
- 'label' => Mage::helper('catalog')->__('Settings'),
177
- 'content' => $this->_translateHtml($this->getLayout()
178
- ->createBlock('adminhtml/catalog_product_edit_tab_settings')->toHtml()),
179
- 'active' => true
180
- ));
181
- }
182
- return parent::_prepareLayout();
183
- }
184
-
185
-
186
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Helper/Data.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- class Ifuturz_Uploadpdf_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- }
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Model/Mysql4/Uploadpdf.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Uploadpdf_Model_Mysql4_Uploadpdf extends Mage_Core_Model_Mysql4_Abstract
3
- {
4
- public function _construct()
5
- {
6
- // Note that the register_id refers to the key field in your database table.
7
- $this->_init('uploadpdf/uploadpdf', 'pdf_id');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Model/Mysql4/Uploadpdf/Collection.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- class Ifuturz_Uploadpdf_Model_Mysql4_Uploadpdf_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('uploadpdf/uploadpdf');
8
- }
9
- /*public function getPublishernameArray()
10
- {
11
- $options = array();
12
- $this->addOrder('publisher_name', 'asc');
13
- foreach ($this as $item) {
14
- $options[] = array(
15
- 'value' => $item->getPublisherId(),
16
- 'label' => $item->getPublisherName()
17
- );
18
- }
19
- if (count($options)>0) {
20
- array_unshift($options, array('title'=>null, 'value'=>'0', 'label'=>Mage::helper('publisher')->__('-- Please select --')));
21
- }
22
- return $options;
23
- }*/
24
-
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Model/Observer.php DELETED
@@ -1,255 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Uploadpdf_Model_Observer
4
- {
5
- /**
6
- * Flag to stop observer executing more than once
7
- *
8
- * @var static bool
9
- */
10
- static protected $_singletonFlag = false;
11
-
12
- /**
13
- * This method will run when the product is saved from the Magento Admin
14
- * Use this function to update the product model, process the
15
- * data or anything you like
16
- *
17
- * @param Varien_Event_Observer $observer
18
- */
19
- public function saveProductTabData(Varien_Event_Observer $observer)
20
- {
21
- //echo "hello";die;
22
- if (!self::$_singletonFlag) {
23
- self::$_singletonFlag = true;
24
-
25
- $product = $observer->getEvent()->getProduct();
26
- //echo "<pre>"; print_r($product);die;
27
- $productid = $product->getId();
28
-
29
- try {
30
- /**
31
- * Perform any actions you want here
32
- *
33
- */
34
- //$id = $this->_getRequest()->getParam('id');
35
- //$countcolorid = $this->_getRequest()->getParam('hidden');
36
-
37
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
38
- $collection = array();
39
- $data1 = Mage::getModel('uploadpdf/uploadpdf')->getCollection();
40
- foreach($data1 as $cd)
41
- {
42
- $collection[] = $cd['pdf_file'];
43
- }
44
- //echo "<pre>";print_r($collection);die;
45
- $det_edit_id = $this->_getRequest()->getParam('editid');
46
- //unlink("/pdfs/test3.pdf");die;
47
-
48
- if ($data = $this->_getRequest()->getPost())
49
- {
50
- //echo "<pre>"; print_r($data);die;
51
- $pdfname = $data['pdf_name'];
52
- if(isset($_FILES['upload_pdf']['name']) && $_FILES['upload_pdf']['name'] != '') {
53
-
54
- //this way the name is saved in DB
55
- $data['upload_pdf'] = $_FILES['upload_pdf']['name'];
56
- $front = $data['upload_pdf'];
57
-
58
- //$imgPath = Mage::getBaseUrl('media')."pdffiles/uploadedfiles/".$front;
59
- $imgPath1 = Mage::getBaseUrl()."pdfs/".$front;
60
- $imgPath = str_replace("/index.php","",$imgPath1);//die;
61
- $data['pdf_path'] = '<img src="'.$imgPath.'" border="0" />';
62
-
63
- }
64
- }
65
-
66
- $collection = array();
67
- $data1 = Mage::getModel('uploadpdf/uploadpdf')->getCollection();
68
- foreach($data1 as $cd)
69
- {
70
- $collection[] = $cd['pdf_file'];
71
- }
72
- //echo "<pre>";print_r($collection);die;
73
- $cpid=Mage::registry('current_product')->getId();
74
- //$uploadpdf = "media/pdffiles/uploadedfiles/";
75
- $uploadpdf = "pdfs/";
76
-
77
- /*------------------------------ Multiple DELETE PDF CODE -------------------------------------*/
78
-
79
- if(!empty($_POST['chkdelete'])) {
80
- foreach($_POST['chkdelete'] as $checkdel) {
81
- //echo $checkdel;
82
-
83
- $readresult = $write->query("SELECT pdf_file FROM ifuturz_uploadpdf WHERE pdf_id ='$checkdel'");
84
- $entityid = $readresult->fetch();
85
- $delfilef = $entityid['pdf_file'];
86
-
87
- unlink("pdfs/".$delfilef);
88
-
89
- $sql1del = "DELETE FROM `ifuturz_uploadpdf` WHERE pdf_id = '$checkdel'";
90
- $write->query($sql1del);
91
- }
92
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('uploadpdf')->__('PDF(s) deleted successfully.'));
93
- }
94
- //die;
95
-
96
- if($det_edit_id == '')
97
- {
98
-
99
- /*------------------------------ ADD PDF CODE -------------------------------------*/
100
-
101
- if($front != "")
102
- {
103
-
104
- if(file_exists($uploadpdf.$front))
105
- {
106
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('uploadpdf')->__('PDF file already exists!!'));
107
- }
108
- else
109
- {
110
- $ext = end(explode(".", $front));
111
-
112
- if(($ext == "pdf") || ($ext == "PDF"))
113
- {
114
- $pdftempfile = $_FILES['upload_pdf']['tmp_name'];
115
- //echo $pdftempfile."<br>".$uploadpdf.$front;
116
- move_uploaded_file($pdftempfile,$uploadpdf.$front);
117
-
118
- if(!in_array($front,$collection))
119
- {
120
- $sql1 = "INSERT INTO `ifuturz_uploadpdf` (`product_id`,`pdf_file`,`pdfname`,`pdf_path`) VALUES ('$productid','$front','$pdfname','$imgPath' )";
121
- $write->query($sql1);
122
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('uploadpdf')->__('PDF uploaded successfully.'));
123
- }
124
- }
125
- else
126
- {
127
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('uploadpdf')->__('Only PDF file is allowed.!'));
128
- }
129
- }
130
- }
131
- $product->save();
132
- }
133
- else
134
- {
135
- //die('hello');
136
- /*------------------------------ UPDATE PDF CODE -------------------------------------*/
137
-
138
- $readresultn = $write->query("SELECT pdf_file FROM ifuturz_uploadpdf WHERE pdf_id ='$det_edit_id'");
139
- $entityidn = $readresultn->fetch();
140
- $delfilefn = $entityidn['pdf_file'];
141
-
142
- if($front == '')
143
- {
144
- $front = $delfilefn;
145
- }
146
-
147
- if($front != $delfilefn)
148
- {
149
- unlink("pdfs/".$delfilefn);
150
- }
151
-
152
- if((file_exists($uploadpdf.$front)) && ($front != $delfilefn))
153
- {
154
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('uploadpdf')->__('PDF file already exists!!'));
155
- }
156
- else
157
- {
158
- if($front == '')
159
- {
160
- $front = $delfilefn;
161
- }
162
-
163
- $ext = end(explode(".", $front));
164
-
165
- if(($ext == "pdf") || ($ext == "PDF"))
166
- {
167
- $pdftempfile = $_FILES['upload_pdf']['tmp_name'];
168
- //echo $pdftempfile."<br>".$uploadpdf.$front;die;
169
- move_uploaded_file($pdftempfile,$uploadpdf.$front);
170
-
171
- $imgUpPath1 = Mage::getBaseUrl()."pdfs/".$front;
172
- $imgUpPath = str_replace("/index.php","",$imgUpPath1);
173
-
174
- $sql1_edit = "Update ifuturz_uploadpdf SET pdf_file = '$front',pdfname = '$pdfname',pdf_path = '$imgUpPath' WHERE pdf_id='$det_edit_id'";
175
- $write->query($sql1_edit);
176
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('uploadpdf')->__('PDF updated successfully.'));
177
- }
178
- else
179
- {
180
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('uploadpdf')->__('Only PDF file is allowed.!'));
181
- }
182
- }
183
- $product->save();
184
-
185
- }
186
-
187
- }
188
- catch (Exception $e) {
189
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
190
- }
191
- }
192
- }
193
-
194
- /**
195
- * Retrieve the product model
196
- *
197
- * @return Mage_Catalog_Model_Product $product
198
- */
199
- public function getProduct()
200
- {
201
- return Mage::registry('product');
202
- }
203
-
204
- /**
205
- * Shortcut to getRequest
206
- *
207
- */
208
- protected function _getRequest()
209
- {
210
- return Mage::app()->getRequest();
211
- }
212
-
213
- public function checkInstallation($observer)
214
- {
215
- $read = Mage::getSingleton('core/resource')->getConnection('core_read');
216
- $sql ="SELECT * FROM `uploadpdf_lck` WHERE flag='LCK' AND value='1'";
217
- $data = $read->fetchAll($sql);
218
- if(count($data)==1)
219
- {
220
-
221
- $admindata = $read->fetchAll("SELECT email FROM admin_user WHERE username='admin'");
222
-
223
- $storename = Mage::getStoreConfig('general/store_information/name');
224
- $storephone = Mage::getStoreConfig('general/store_information/phone');
225
- $store_address = Mage::getStoreConfig('general/store_information/address');
226
- $secureurl = Mage::getStoreConfig('web/unsecure/base_url');
227
- $unsecureurl = Mage::getStoreConfig('web/secure/base_url');
228
- $sendername = Mage::getStoreConfig('trans_email/ident_general/name');
229
- $general_email = Mage::getStoreConfig('trans_email/ident_general/email');
230
- $admin_email = $admindata[0]['email'];
231
-
232
- $body = "Extension <b>'Uploadpdf'</b> is installed to the following detail: <br/><br/> STORE NAME: ".$storename."<br/>STORE PHONE: ".$storephone."<br/>STORE ADDRESS: ".$store_address."<br/>SECURE URL: ".$secureurl."<br/>UNSECURE URL: ".$unsecureurl."<br/>ADMIN EMAIL ADDRESS: ".$admin_email."<br/>GENERAL EMAIL ADDRESS: ".$general_email."";
233
-
234
- $mail = Mage::getModel('core/email');
235
- $mail->setToName('Extension Geek');
236
- $mail->setToEmail('extension.geek@ifuturz.com');
237
- $mail->setBody($body);
238
- $mail->setSubject('Uploadpdf Extension is installed!!!');
239
- $mail->setFromEmail($general_email);
240
- $mail->setFromName($sendername);
241
- $mail->setType('html');
242
- try{
243
- $mail->send();
244
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
245
- $write->query("update uploadpdf_lck set value='0' where flag='LCK'");
246
- }
247
- catch(Exception $e)
248
- {
249
- }
250
-
251
-
252
- }
253
-
254
- }
255
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/Model/Uploadpdf.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Ifuturz_Uploadpdf_Model_Uploadpdf extends Mage_Core_Model_Abstract
3
- {
4
- public function _construct()
5
- {
6
- parent::_construct();
7
- $this->_init('uploadpdf/uploadpdf');
8
- }
9
-
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/controllers/Adminhtml/UploadpdfController.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
-
3
- class Ifuturz_Uploadpdf_Adminhtml_UploadpdfController extends Mage_Adminhtml_Controller_Action
4
- {
5
- protected function _initAction()
6
- {
7
- $this->loadLayout()
8
- ->_setActiveMenu('uploadpdf')
9
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Add uploadpdf Category Management'), Mage::helper('adminhtml')->__('Add uploadpdf category Management'));
10
-
11
- return $this;
12
- }
13
-
14
- public function indexAction()
15
- {
16
- $this->_initAction()
17
- ->renderLayout();
18
- }
19
-
20
-
21
- public function editAction() {
22
- $id = $this->getRequest()->getParam('id');
23
- $model = Mage::getModel('uploadpdf/uploadpdf')->load($id);
24
-
25
- if ($model->getId() || $id == 0) {
26
- $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
27
- if (!empty($data)) {
28
- $model->setData($data);
29
- }
30
- /* if($id!=0)
31
- {
32
- Mage::register('region_reload', $model);
33
- }
34
- */
35
- Mage::register('uploadpdf_data', $model);
36
-
37
- $this->loadLayout();
38
- $this->_setActiveMenu('uploadpdf');
39
-
40
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Add uploadpdf Management'), Mage::helper('adminhtml')->__('Add uploadpdf Management'));
41
- $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Rule News'), Mage::helper('adminhtml')->__('Rule News'));
42
-
43
- $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
44
-
45
- $this->_addContent($this->getLayout()->createBlock('uploadpdf/adminhtml_uploadpdf_edit'))
46
- ->_addLeft($this->getLayout()->createBlock('uploadpdf/adminhtml_uploadpdf_edit_tabs'));
47
-
48
- $this->renderLayout();
49
- } else {
50
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('uploadpdf')->__('uploadpdf does not exist'));
51
- $this->_redirect('*/*/');
52
- }
53
- }
54
-
55
- public function newAction()
56
- {
57
- $this->_forward('edit');
58
- }
59
-
60
- public function saveAction()
61
- {
62
-
63
- }
64
-
65
-
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/controllers/IndexController.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- class Ifuturz_Uploadpdf_IndexController extends Mage_Core_Controller_Front_Action
3
- {
4
-
5
- public function indexAction()
6
- {
7
- $this->loadLayout()->renderLayout();
8
- }
9
- }
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/etc/config.xml DELETED
@@ -1,108 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Ifuturz_Uploadpdf>
5
- <version>0.2.1</version>
6
- </Ifuturz_Uploadpdf>
7
- </modules>
8
- <frontend>
9
- <routers>
10
- <uploadpdf>
11
- <use>standard</use>
12
- <args>
13
- <module>Ifuturz_Uploadpdf</module>
14
- <frontName>uploadpdf</frontName>
15
- </args>
16
- </uploadpdf>
17
- </routers>
18
- <layout>
19
- <updates>
20
- <uploadpdf>
21
- <file>uploadpdf.xml</file>
22
- </uploadpdf>
23
- </updates>
24
- </layout>
25
- </frontend>
26
- <global>
27
- <events>
28
- <controller_action_predispatch>
29
- <observers>
30
- <uploadpdf_install>
31
- <class>Ifuturz_Uploadpdf_Model_Observer</class>
32
- <method>checkInstallation</method>
33
- </uploadpdf_install>
34
- </observers>
35
- </controller_action_predispatch>
36
- </events>
37
- <blocks>
38
- <uploadpdf>
39
- <class>Ifuturz_Uploadpdf_Block</class>
40
- </uploadpdf>
41
- <adminhtml>
42
- <rewrite>
43
- <catalog_product_edit_tabs>Ifuturz_Uploadpdf_Block_Adminhtml_Catalog_Product_Edit_Tabs</catalog_product_edit_tabs>
44
- </rewrite>
45
- </adminhtml>
46
- </blocks>
47
- <models>
48
- <uploadpdf>
49
- <class>Ifuturz_Uploadpdf_Model</class>
50
- <resourceModel>uploadpdf_mysql4</resourceModel>
51
- </uploadpdf>
52
- <uploadpdf_mysql4>
53
- <class>Ifuturz_Uploadpdf_Model_Mysql4</class>
54
- <entities>
55
- <uploadpdf>
56
- <table>ifuturz_uploadpdf</table>
57
- </uploadpdf>
58
- </entities>
59
- </uploadpdf_mysql4>
60
- </models>
61
- <resources>
62
- <uploadpdf_setup>
63
- <setup>
64
- <module>Ifuturz_Uploadpdf</module>
65
- </setup>
66
- <connection>
67
- <use>core_setup</use>
68
- </connection>
69
- </uploadpdf_setup>
70
- <uploadpdf_write>
71
- <connection>
72
- <use>core_write</use>
73
- </connection>
74
- </uploadpdf_write>
75
- <uploadpdf_read>
76
- <connection>
77
- <use>core_read</use>
78
- </connection>
79
- </uploadpdf_read>
80
- </resources>
81
-
82
- <helpers>
83
- <uploadpdf>
84
- <class>Ifuturz_Uploadpdf_Helper</class>
85
- </uploadpdf>
86
- </helpers>
87
- </global>
88
- <adminhtml>
89
- <layout>
90
- <updates>
91
- <uploadpdf>
92
- <file>uploadpdf.xml</file>
93
- </uploadpdf>
94
- </updates>
95
- </layout>
96
- <events>
97
- <catalog_product_save_after>
98
- <observers>
99
- <ifuturz_save_product_data9>
100
- <type>singleton</type>
101
- <class>uploadpdf/observer</class>
102
- <method>saveProductTabData</method>
103
- </ifuturz_save_product_data9>
104
- </observers>
105
- </catalog_product_save_after>
106
- </events>
107
- </adminhtml>
108
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/sql/uploadpdf_setup/mysql4-install-0.2.0.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
-
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('ifuturz_uploadpdf')};
10
- CREATE TABLE {$this->getTable('ifuturz_uploadpdf')} (
11
- `pdf_id` int(11) unsigned NOT NULL auto_increment,
12
- `product_id` int(11) NULL,
13
- `pdf_file` varchar(500) NULL,
14
- `pdfname` varchar(500) NULL,
15
- `pdf_path` varchar(500) NULL,
16
- PRIMARY KEY (`pdf_id`)
17
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
18
- ");
19
-
20
- $installer->endSetup();
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Ifuturz/Uploadpdf/sql/uploadpdf_setup/mysql4-upgrade-0.2.0-0.2.1.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
- $installer = $this;
3
-
4
- $installer->startSetup();
5
-
6
-
7
- $installer->run("
8
-
9
- -- DROP TABLE IF EXISTS {$this->getTable('uploadpdf_lck')};
10
- CREATE TABLE {$this->getTable('uploadpdf_lck')} (
11
- `flag` varchar(4),
12
- `value` ENUM('0','1') DEFAULT 0
13
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
14
-
15
- INSERT INTO `{$installer->getTable('uploadpdf_lck')}` VALUES ('LCK','1');
16
- ");
17
-
18
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/layout/productcomment.xml CHANGED
@@ -2,7 +2,8 @@
2
  <layout version="0.1.0">
3
  <catalog_product_view>
4
  <reference name="content">
5
- <block type="productcomment/productcomment" as="productcommentAs" template="productcomment/productcomment.phtml" />
 
6
  </reference>
7
  </catalog_product_view>
8
  </layout>
2
  <layout version="0.1.0">
3
  <catalog_product_view>
4
  <reference name="content">
5
+ <block type="productcomment/productcomment" as="productcommentAs" template="productcomment/productcomment.phtml" />
6
+ <!--<action method="setTemplate"><template>productcomment/productcomment.phtml</template></action>-->
7
  </reference>
8
  </catalog_product_view>
9
  </layout>
app/etc/modules/Ifuturz_Productcomment.xml CHANGED
@@ -6,4 +6,4 @@
6
  <codePool>local</codePool>
7
  </Ifuturz_Productcomment>
8
  </modules>
9
- </config>
6
  <codePool>local</codePool>
7
  </Ifuturz_Productcomment>
8
  </modules>
9
+ </config>
package.xml CHANGED
@@ -1,21 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ifuturz_Productcomment</name>
4
- <version>0.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Customer can give the comments to particular product from view page using this extension</summary>
10
- <description> - Add comment box on product view page on frontend. Customer can add more than one comment for one product.&amp;#xD;&#xD;
11
- - Admin can view list of comments which customer has added for particular product. Admin can have ability to delete the product comments from admin panel.&amp;#xD;&#xD;
12
- - Only logged in customer can add the comments on product view page.&amp;#xD;&#xD;
13
  - Not logged in customer also can view the list of product comments. All comments should be listed below the comment box with date and month.</description>
14
- <notes>Second Product Comment Extension</notes>
15
  <authors><author><name>Iverve</name><user>iverve</user><email>extension.geek@ifuturz.com</email></author></authors>
16
- <date>2014-03-06</date>
17
- <time>10:11:43</time>
18
- <contents><target name="mageetc"><dir name="modules"><file name="Ifuturz_Productcomment.xml" hash="445555826c0f16a0bd2f3b59ff918bd7"/></dir></target><target name="magelocal"><dir name="Ifuturz"><dir name="Payme"><dir name="Block"><dir name="Adminhtml"><dir name="Payme"><dir name="Edit"><file name="Form.php" hash="323291e4ca5d05a27f15f6181f5606c5"/><dir name="Tab"><file name="Form.php" hash="c69c214e3555742a5870b0354996ee54"/></dir><file name="Tabs.php" hash="e9fa62a7e2fe9c75ace6ad460b528da8"/></dir><file name="Edit.php" hash="54b5a79908ccaec608d272e414357aad"/><file name="Grid.php" hash="dbbc86eb3d996c0fbb09f4bd41348a1f"/></dir><file name="Payme.php" hash="c12d8f2dfe505be41e134ddb91a24c0f"/></dir><file name="Payme.php" hash="2fb9345925b0e582fc50a81a622b9406"/></dir><dir name="Helper"><file name="Data.php" hash="7dc044c9642fea277001674ffb993211"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Payme"><file name="Collection.php" hash="4e6095debe533ceac28a7459671316c2"/></dir><file name="Payme.php" hash="bd024410e894bbc6e31a138ed81c6596"/></dir><file name="Payme.php" hash="f5720219e233d5f3397dd5a8d885d6d2"/><file name="Status.php" hash="67d80f7c434bbd2a509049d605e559dc"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PaymeController.php" hash="1e191d55676129bf0737e9b281ef2076"/></dir><file name="IndexController.php" hash="dfa9c441f99b3ce2d6904d2e4d68ad9f"/></dir><dir name="etc"><file name="config.xml" hash="6e385a9960d8b7ac43b89660695e7e3e"/></dir><dir name="sql"><dir name="payme_setup"><file name="mysql4-install-0.1.0.php" hash="89ee8b73a424892eee24347939dfb19b"/></dir></dir></dir><dir name="Productcomment"><dir name="Block"><dir name="Adminhtml"><dir name="Productcomment"><dir name="Edit"><file name="Form.php" hash="42f0391b1164759c6b8d52d111b4793a"/><dir name="Tab"><file name="Form.php" hash="2d00f84b10a51b02ed45737e26aea0c6"/></dir><file name="Tabs.php" hash="5978b718131a70a71f8ac34e3ebb3c10"/></dir><file name="Edit.php" hash="a3c19776224d8927c36d2fea5019382d"/><file name="Grid.php" hash="56435d12ce7044364820d647425a2cfd"/></dir><file name="Productcomment.php" hash="656fd8b1f289851dcde3830ef0f31a73"/></dir><file name="Productcomment.php" hash="80cda9965bfe699bb0fcbaed0e38cc3f"/></dir><dir name="Helper"><file name="Data.php" hash="493bf8d95253b3027f0e4c968eb4c30b"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productcomment"><file name="Collection.php" hash="f18ce14c0c0984b5038a3457e0634094"/></dir><file name="Productcomment.php" hash="b44713215d612eaf508953949460d388"/></dir><file name="Observer.php" hash="98b0bf2b71ac81eacc61d70bf4311ec5"/><file name="Productcomment.php" hash="90e6b197cc9bfd42312d4186e075051e"/></dir><dir name="controllers"><file name="AccountController.php" hash="2ee135dd1b879f61926745c1c41bdac3"/><dir name="Adminhtml"><file name="ProductcommentController.php" hash="ce4a9f62b34c21040a2deba9861e2b1e"/></dir><file name="IndexController.php" hash="4c03b78767a6601e95af1579d4455568"/></dir><dir name="etc"><file name="config.xml" hash="e9452c43770bc0ab5e727bda77d135c6"/></dir><dir name="sql"><dir name="productcomment_setup"><file name="mysql4-install-0.2.0.php" hash="138f9f3b0c9e2ef9e8db2a1de0a579ee"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="bbeebff50bf37f5cdefa52f733a71078"/></dir></dir></dir><dir name="Sellergroup"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Tab.php" hash="376b77089ae1e5085cc03e88e43e49c2"/></dir></dir><dir name="Customer"><file name="Grid.php" hash="0425ff0732282e961f2fac0509fda1d5"/></dir><dir name="Sellergroup"><dir name="Edit"><file name="Form.php" hash="48a8009e7706281cde6bafbabb12aac1"/><dir name="Tab"><file name="Form.php" hash="9b400e02f4214a5111b23595e3f97f32"/></dir><file name="Tabs.php" hash="292e30e5115079912e1f1aacf0d84672"/></dir><file name="Edit.php" hash="5d157d9a5d821aee13afd7787a6fa714"/><file name="Grid.php" hash="0a23bbd32d3f1a26c0d27539b73c585d"/></dir><file name="Sellergroup.php" hash="150bbae0191cb8aa69e525676cfc69ea"/></dir><file name="Bankaccount.php" hash="1589815ec965ccc01a05c41919913ffe"/><file name="Editproduct.php" hash="42b606e88931cf064529c2263f3719cc"/><file name="Publish.php" hash="1abb4f12f0a1c0205073009cce1a1099"/><file name="Salesreport.php" hash="7139efe0140b8776704ba07fbb91639e"/><file name="Sellergroup.php" hash="3a003efff7447ce6171aac79cca25e82"/></dir><dir name="Helper"><file name="Data.php" hash="f4142447951d9b12e45ae21a7c7d7f6c"/></dir><dir name="Model"><dir name="Checkout"><dir name="Type"><file name="Onepage.php" hash="8e85ae279ce9f50e7a74e7e746d8f885"/></dir></dir><file name="Customerbalance.php" hash="36124f156891e1959fc447f0e806ce34"/><dir name="Mysql4"><dir name="Customerbalance"><file name="Collection.php" hash="8c4d0a9c8bf4cfff7dd89a1f5e83d0fc"/></dir><file name="Customerbalance.php" hash="f79fae355bd893c1f8b46e0e3515648e"/><dir name="Sellercommission"><file name="Collection.php" hash="663bdf7b42155283fe4215cfe10c4e5b"/></dir><file name="Sellercommission.php" hash="52b7fe2984c6085b82efdec59194f9fb"/><dir name="Sellergroup"><file name="Collection.php" hash="4d98e58e1d6ebc21a21a60ba0c01a636"/></dir><file name="Sellergroup.php" hash="792822ce697c8a5758010de88dd16679"/><file name="Setup.php" hash="b5846a1775950921b37d8500bc600603"/></dir><file name="Observer-8-7-2013.php" hash="0d123c5ef2b62abfe9fbf61b5ce5f9e4"/><file name="Observer.php" hash="5333dc9cf7670a841a3b71b7ef922181"/><file name="Observer.php-original" hash="f7f4101c5ac3a285d8f2bb45aa18bcb0"/><file name="Sellercommission.php" hash="9ba531402c09bb1189b7dcdeeca5257c"/><dir name="Sellergroup"><dir name="Attribute"><dir name="Source"><file name="Sellergroup.php" hash="440bd5d290e566414cdb837cd8466314"/></dir></dir></dir><file name="Sellergroup.php" hash="146f0910b289f2a75d858107558b6583"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SellergroupController.php" hash="2f3daa578183411e4b0f257224f943fa"/></dir><dir name="Catalog"><file name="ProductController.php" hash="02b8102b051dc1254aff1eb027196375"/></dir><file name="IndexController.php" hash="ad502d5bcda7da627e0420fc7d333b50"/></dir><dir name="etc"><file name="config.xml" hash="1e35c45f2c6be4dabfeb4da4cb5c267f"/></dir><dir name="sql"><dir name="sellergroup_setup"><file name="mysql4-install-0.1.0.php" hash="1248c920528cd35cb5ec75cf35cc39cc"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="6bac9a083d487d2b27cceb19c530a7d1"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="2e6b7b3a0abbe16cf946e37df0ff9929"/></dir></dir></dir><dir name="Uploadpdf"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Edit"><file name="Form.php" hash="da851444cc8a8d054c1fa061b23be63b"/><dir name="Tab"><file name="Uploadpdf.php" hash="29d2e39637ebcc96a530840cf9ba80c7"/></dir><file name="Tabs.php" hash="2d0244615617397f671a327d719aba4a"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7da275b559a1d56075d4839559ea3903"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Uploadpdf"><file name="Collection.php" hash="a43f5a17243d9c11c8cef06fac2edfef"/></dir><file name="Uploadpdf.php" hash="745f41fbf6c53f262d217eab67ab8e06"/></dir><file name="Observer.php" hash="564b8193f1c67ebb1441972eca74e78a"/><file name="Uploadpdf.php" hash="be43a3fbf5f88d4cc1434ef80856c0cd"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="UploadpdfController.php" hash="45ac98d3dc6b6ec842da6c3386e01c49"/></dir><file name="IndexController.php" hash="721a4c0c77fbd5df29cfda3f3f2708c8"/></dir><dir name="etc"><file name="config.xml" hash="0102186af03775bc8c94b8a55434fa65"/></dir><dir name="sql"><dir name="uploadpdf_setup"><file name="mysql4-install-0.2.0.php" hash="cb847f803de84f1dde7c99335b7b501d"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="3f4ceefaf59507446930e1fdad9276d3"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productcomment.xml" hash="4fdaf1e29305d721da4a902f5d450a48"/></dir><dir name="template"><dir name="productcomment"><file name="form.phtml" hash="0f7681757082f0200e50e87a0cf5f19a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="productcomment.xml" hash="ae57957ca44673990f344f5e32d70a5e"/></dir><dir name="template"><dir name="productcomment"><file name="productcomment.phtml" hash="0d9e41cc27e1bc1eb72c0731f212ce31"/></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ifuturz_Productcomment</name>
4
+ <version>0.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Customer can give the comments to particular product from view page using this extension</summary>
10
+ <description> - Add comment box on product view page on frontend. Customer can add more than one comment for one product.&#xD;
11
+ - Admin can view list of comments which customer has added for particular product. Admin can have ability to delete the product comments from admin panel.&#xD;
12
+ - Only logged in customer can add the comments on product view page.&#xD;
13
  - Not logged in customer also can view the list of product comments. All comments should be listed below the comment box with date and month.</description>
14
+ <notes>Third Product Comment Extension</notes>
15
  <authors><author><name>Iverve</name><user>iverve</user><email>extension.geek@ifuturz.com</email></author></authors>
16
+ <date>2014-05-02</date>
17
+ <time>11:41:46</time>
18
+ <contents><target name="mageetc"><dir name="modules"><file name="Ifuturz_Productcomment.xml" hash="20389b5bf62d36d383e751b26f05dcb8"/></dir></target><target name="magelocal"><dir name="Ifuturz"><dir name="Productcomment"><dir name="Block"><dir name="Adminhtml"><dir name="Productcomment"><dir name="Edit"><file name="Form.php" hash="42f0391b1164759c6b8d52d111b4793a"/><dir name="Tab"><file name="Form.php" hash="2d00f84b10a51b02ed45737e26aea0c6"/></dir><file name="Tabs.php" hash="5978b718131a70a71f8ac34e3ebb3c10"/></dir><file name="Edit.php" hash="a3c19776224d8927c36d2fea5019382d"/><file name="Grid.php" hash="56435d12ce7044364820d647425a2cfd"/></dir><file name="Productcomment.php" hash="656fd8b1f289851dcde3830ef0f31a73"/></dir><file name="Productcomment.php" hash="80cda9965bfe699bb0fcbaed0e38cc3f"/></dir><dir name="Helper"><file name="Data.php" hash="493bf8d95253b3027f0e4c968eb4c30b"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productcomment"><file name="Collection.php" hash="f18ce14c0c0984b5038a3457e0634094"/></dir><file name="Productcomment.php" hash="b44713215d612eaf508953949460d388"/></dir><file name="Observer.php" hash="98b0bf2b71ac81eacc61d70bf4311ec5"/><file name="Productcomment.php" hash="90e6b197cc9bfd42312d4186e075051e"/></dir><dir name="controllers"><file name="AccountController.php" hash="2ee135dd1b879f61926745c1c41bdac3"/><dir name="Adminhtml"><file name="ProductcommentController.php" hash="ce4a9f62b34c21040a2deba9861e2b1e"/></dir><file name="IndexController.php" hash="4c03b78767a6601e95af1579d4455568"/></dir><dir name="etc"><file name="config.xml" hash="48f227c64e9fd2d141041cfa151ea8b2"/></dir><dir name="sql"><dir name="productcomment_setup"><file name="mysql4-install-0.3.0.php" hash="c56e5fe1ebd335d1dff18d4870607b07"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productcomment.xml" hash="4fdaf1e29305d721da4a902f5d450a48"/></dir><dir name="template"><dir name="productcomment"><file name="form.phtml" hash="0f7681757082f0200e50e87a0cf5f19a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="productcomment.xml" hash="124315732cbf1b960a0256c4d3262bd0"/></dir><dir name="template"><dir name="productcomment"><file name="productcomment.phtml" hash="0d9e41cc27e1bc1eb72c0731f212ce31"/></dir></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>