Payment_Method_Custom - Version 1.0.0

Version Notes

First Release

Download this release

Release Info

Developer Chandan Kumar Singh
Extension Payment_Method_Custom
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Chandan/Chandanpayment/Block/Adminhtml/Order/Grid.php ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Chandanpayment_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('sales_order_grid');
10
+ $this->setUseAjax(true);
11
+ $this->setDefaultSort('created_at');
12
+ $this->setDefaultDir('DESC');
13
+ $this->setSaveParametersInSession(true);
14
+ }
15
+
16
+ /**
17
+ * Retrieve collection class
18
+ *
19
+ * @return string
20
+ */
21
+ protected function _getCollectionClass()
22
+ {
23
+ return 'sales/order_grid_collection';
24
+ }
25
+
26
+ protected function _prepareCollection()
27
+ {
28
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
29
+ $collection->join(array('payment'=>'sales/order_payment'),'main_table.entity_id=parent_id','method');
30
+ $collection->getSelect()->joinLeft('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('total_qty_ordered'));
31
+ $this->setCollection($collection);
32
+
33
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
34
+ }
35
+
36
+ protected function _prepareColumns()
37
+ {
38
+
39
+ $this->addColumn('real_order_id', array(
40
+ 'header'=> Mage::helper('sales')->__('Order #'),
41
+ 'width' => '80px',
42
+ 'type' => 'text',
43
+ 'index' => 'increment_id',
44
+ ));
45
+
46
+ if (!Mage::app()->isSingleStoreMode()) {
47
+ $this->addColumn('store_id', array(
48
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
49
+ 'index' => 'store_id',
50
+ 'type' => 'store',
51
+ 'store_view'=> true,
52
+ 'display_deleted' => true,
53
+ ));
54
+ }
55
+
56
+ $this->addColumn('created_at', array(
57
+ 'header' => Mage::helper('sales')->__('Purchased On'),
58
+ 'index' => 'created_at',
59
+ 'type' => 'datetime',
60
+ 'width' => '100px',
61
+ ));
62
+
63
+ $this->addColumn('billing_name', array(
64
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
65
+ 'index' => 'billing_name',
66
+ 'width' => '100px',
67
+ ));
68
+
69
+ $this->addColumn('shipping_name', array(
70
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
71
+ 'index' => 'shipping_name',
72
+ 'width' => '100px',
73
+ ));
74
+
75
+ $this->addColumn('name', array(
76
+ 'header'=> Mage::helper('sales')->__('Product Name'),
77
+ 'width' => '200px',
78
+ 'type' => 'text',
79
+ 'index' => 'name',
80
+ 'filter' => false,
81
+ 'renderer'=> 'Chandan_Chandanpayment_Block_Adminhtml_Order_Renderer_Productname',// THIS IS WHAT THIS POST IS ALL ABOUT
82
+ ));
83
+
84
+ $this->addColumn('total_qty_ordered', array(
85
+ 'header' => Mage::helper('sales')->__('Order Qty'),
86
+ 'index' => 'total_qty_ordered',
87
+ 'filter_index' => 'sales_flat_order.total_qty_ordered',
88
+ 'width' => '80px',
89
+ ));
90
+
91
+ $this->addColumn('base_grand_total', array(
92
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
93
+ 'index' => 'base_grand_total',
94
+ 'type' => 'currency',
95
+ 'currency' => 'base_currency_code',
96
+ ));
97
+
98
+ $this->addColumn('grand_total', array(
99
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
100
+ 'index' => 'grand_total',
101
+ 'type' => 'currency',
102
+ 'currency' => 'order_currency_code',
103
+
104
+ ));
105
+
106
+ $this->addColumn('method', array(
107
+ 'header' => Mage::helper('sales')->__('Method'),
108
+ 'index' => 'method',
109
+ 'filter_index' => 'sales_flat_order_payment.method',
110
+ 'width' => '100px',
111
+ ));
112
+
113
+ $this->addColumn('status', array(
114
+ 'header' => Mage::helper('sales')->__('Status'),
115
+ 'index' => 'status',
116
+ 'type' => 'options',
117
+ 'width' => '70px',
118
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
119
+ ));
120
+
121
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
122
+ $this->addColumn('action',
123
+ array(
124
+ 'header' => Mage::helper('sales')->__('Action'),
125
+ 'width' => '50px',
126
+ 'type' => 'action',
127
+ 'getter' => 'getId',
128
+ 'actions' => array(
129
+ array(
130
+ 'caption' => Mage::helper('sales')->__('View'),
131
+ 'url' => array('base'=>'*/sales_order/view'),
132
+ 'field' => 'order_id',
133
+ 'data-column' => 'action',
134
+ )
135
+ ),
136
+ 'filter' => false,
137
+ 'sortable' => false,
138
+ 'index' => 'stores',
139
+ 'is_system' => true,
140
+ ));
141
+ }
142
+ $this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
143
+
144
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
145
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
146
+
147
+ return parent::_prepareColumns();
148
+ }
149
+
150
+ protected function _prepareMassaction()
151
+ {
152
+ $this->setMassactionIdField('entity_id');
153
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
154
+ $this->getMassactionBlock()->setUseSelectAll(false);
155
+
156
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
157
+ $this->getMassactionBlock()->addItem('cancel_order', array(
158
+ 'label'=> Mage::helper('sales')->__('Cancel'),
159
+ 'url' => $this->getUrl('*/sales_order/massCancel'),
160
+ ));
161
+ }
162
+
163
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
164
+ $this->getMassactionBlock()->addItem('hold_order', array(
165
+ 'label'=> Mage::helper('sales')->__('Hold'),
166
+ 'url' => $this->getUrl('*/sales_order/massHold'),
167
+ ));
168
+ }
169
+
170
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
171
+ $this->getMassactionBlock()->addItem('unhold_order', array(
172
+ 'label'=> Mage::helper('sales')->__('Unhold'),
173
+ 'url' => $this->getUrl('*/sales_order/massUnhold'),
174
+ ));
175
+ }
176
+
177
+ $this->getMassactionBlock()->addItem('pdfinvoices_order', array(
178
+ 'label'=> Mage::helper('sales')->__('Print Invoices'),
179
+ 'url' => $this->getUrl('*/sales_order/pdfinvoices'),
180
+ ));
181
+
182
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
183
+ 'label'=> Mage::helper('sales')->__('Print Packingslips'),
184
+ 'url' => $this->getUrl('*/sales_order/pdfshipments'),
185
+ ));
186
+
187
+ $this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
188
+ 'label'=> Mage::helper('sales')->__('Print Credit Memos'),
189
+ 'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
190
+ ));
191
+
192
+ $this->getMassactionBlock()->addItem('pdfdocs_order', array(
193
+ 'label'=> Mage::helper('sales')->__('Print All'),
194
+ 'url' => $this->getUrl('*/sales_order/pdfdocs'),
195
+ ));
196
+
197
+ $this->getMassactionBlock()->addItem('print_shipping_label', array(
198
+ 'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
199
+ 'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
200
+ ));
201
+
202
+ return $this;
203
+ }
204
+
205
+ public function getRowUrl($row)
206
+ {
207
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
208
+ return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
209
+ }
210
+ return false;
211
+ }
212
+
213
+ public function getGridUrl()
214
+ {
215
+ return $this->getUrl('*/*/grid', array('_current'=>true));
216
+ }
217
+
218
+ }
app/code/community/Chandan/Chandanpayment/Block/Adminhtml/Order/Renderer/Productname.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Chandan_Chandanpayment_Block_Adminhtml_Order_Renderer_Productname extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ public function render(Varien_Object $row)
5
+ {
6
+ $order_id=$row->getData('increment_id');
7
+ $order = Mage::getModel('sales/order')->loadByIncrementID($order_id);
8
+ $items = $order->getAllItems();
9
+ foreach ($items as $itemId => $item)
10
+ {
11
+ if($item->getSku())
12
+ {
13
+ $name[] = $item->getName();
14
+ }
15
+ }
16
+ if(count($name))
17
+ {
18
+ $nametext = implode(',',$name);
19
+ }
20
+ $conbinetext=$nametext;
21
+ return $conbinetext;
22
+ }
23
+ }
app/code/community/Chandan/Chandanpayment/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Chandanpayment_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/Chandan/Chandanpayment/Model/Chandanpayment.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Chandan_Chandanpayment_Model_Chandanpayment extends Mage_Payment_Model_Method_Abstract
4
+ {
5
+
6
+ protected $_code = 'chandanpayment';
7
+
8
+ }
app/code/community/Chandan/Chandanpayment/etc/config.xml ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Chandan_Chandanpayment>
5
+ <version>1.0.0</version>
6
+ </Chandan_Chandanpayment>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <chandanpayment>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Chandan_Chandanpayment</module>
14
+ <frontName>chandanpayment</frontName>
15
+ </args>
16
+ </chandanpayment>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <chandanpayment>
21
+ <file>chandanpayment.xml</file>
22
+ </chandanpayment>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <chandanpayment>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Chandan_Chandanpayment</module>
32
+ <frontName>chandanpayment</frontName>
33
+ </args>
34
+ </chandanpayment>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+
39
+ <acl>
40
+ <resources>
41
+ <all>
42
+ <title>Allow Everything</title>
43
+ </all>
44
+ <admin>
45
+ <children>
46
+ <Chandan_Chandanpayment>
47
+ <title>Chandanpayment Module</title>
48
+ <sort_order>10</sort_order>
49
+ </Chandan_Chandanpayment>
50
+ </children>
51
+ </admin>
52
+ </resources>
53
+ </acl>
54
+ <layout>
55
+ <updates>
56
+ <chandanpayment>
57
+ <file>chandanpayment.xml</file>
58
+ </chandanpayment>
59
+ </updates>
60
+ </layout>
61
+ </adminhtml>
62
+ <global>
63
+
64
+ <blocks>
65
+ <adminhtml>
66
+ <rewrite>
67
+ <sales_order_grid>Chandan_Chandanpayment_Block_Adminhtml_Order_Grid</sales_order_grid>
68
+ </rewrite>
69
+ </adminhtml>
70
+ </blocks>
71
+ <models>
72
+ <chandanpayment>
73
+ <class>Chandan_Chandanpayment_Model</class>
74
+ <resourceModel>chandanpayment_mysql4</resourceModel>
75
+ </chandanpayment>
76
+ <chandanpayment_mysql4>
77
+ <class>Chandan_Chandanpayment_Model_Mysql4</class>
78
+ <entities>
79
+ <chandanpayment>
80
+ <table>chandanpayment</table>
81
+ </chandanpayment>
82
+ </entities>
83
+ </chandanpayment_mysql4>
84
+ </models>
85
+ <resources>
86
+ <chandanpayment_setup>
87
+ <setup>
88
+ <module>Chandan_Chandanpayment</module>
89
+ </setup>
90
+ <connection>
91
+ <use>core_setup</use>
92
+ </connection>
93
+ </chandanpayment_setup>
94
+ <chandanpayment_write>
95
+ <connection>
96
+ <use>core_write</use>
97
+ </connection>
98
+ </chandanpayment_write>
99
+ <chandanpayment_read>
100
+ <connection>
101
+ <use>core_read</use>
102
+ </connection>
103
+ </chandanpayment_read>
104
+ </resources>
105
+ <blocks>
106
+ <chandanpayment>
107
+ <class>Chandan_Chandanpayment_Block</class>
108
+ </chandanpayment>
109
+ </blocks>
110
+ <helpers>
111
+ <chandanpayment>
112
+ <class>Chandan_Chandanpayment_Helper</class>
113
+ </chandanpayment>
114
+ </helpers>
115
+ </global>
116
+
117
+ <default>
118
+ <payment>
119
+ <chandanpayment>
120
+ <active>1</active>
121
+ <model>chandanpayment/chandanpayment</model>
122
+ <order_status>processing</order_status>
123
+ <title>Chandan Payment Method</title>
124
+ </chandanpayment>
125
+ </payment>
126
+ </default>
127
+
128
+ </config>
app/code/community/Chandan/Chandanpayment/etc/system.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <chandanpayment translate="label" module="chandanpayment">
7
+ <label>Custom Payment</label>
8
+ <sort_order>670</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>2</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
+ </title>
30
+ <order_status translate="label">
31
+ <label>New order status</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_order_status</source_model>
34
+ <sort_order>3</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </order_status>
39
+ <allowspecific translate="label">
40
+ <label>Payment from applicable countries</label>
41
+ <frontend_type>allowspecific</frontend_type>
42
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <sort_order>4</sort_order>
47
+ </allowspecific>
48
+ <specificcountry translate="label">
49
+ <label>Payment from Specific countries</label>
50
+ <frontend_type>multiselect</frontend_type>
51
+ <source_model>adminhtml/system_config_source_country</source_model>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <sort_order>5</sort_order>
56
+ </specificcountry>
57
+ </fields>
58
+ </chandanpayment>
59
+ </groups>
60
+ </payment>
61
+ </sections>
62
+ </config>
app/etc/modules/Chandan_Chandanpayment.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Chandan_Chandanpayment>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Chandan_Chandanpayment>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Payment_Method_Custom</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The extension is easy to install and use. The Order Comment Extension is lightweight, completes the task with minimum obstruction, and is in line with the Magento Order Management Workflow.</summary>
10
+ <description>This extension allows admin to add their own payment method while using placing orders. The admin can view which customer using their payment method on sales order grid and this is also added to the invoice. Payment method for Magento enables you to provide better to cash on delivery customers by letting them write an about the order at time of checkout. The admin can view payment method in the form of grid listing or in the order detail page as a customer order request. &#xD;
11
+ &#xD;
12
+ The extension is easy to install and use. The Order Comment Extension is lightweight, completes the task with minimum obstruction, and is in line with the Magento Order Management Workflow.</description>
13
+ <notes>First Release</notes>
14
+ <authors><author><name>Chandan Kumar Singh</name><user>chandan8050</user><email>chandankumar8050@gmail.com</email></author></authors>
15
+ <date>2016-12-19</date>
16
+ <time>06:09:02</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Chandan_Chandanpayment.xml" hash="3c73c9876b2ced215166a0c6957f4496"/></dir></target><target name="magecommunity"><dir name="Chandan"><dir name="Chandanpayment"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><file name="Grid.php" hash="26877410e72a44c3381cf04547600946"/><dir name="Renderer"><file name="Productname.php" hash="3ac8321d1e4c38526115907c06a6e606"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="0d4e6728d8dee11af7adbdbc47c20024"/></dir><dir name="Model"><file name="Chandanpayment.php" hash="b68ab17412f746228b3ec05475f21539"/></dir><dir name="etc"><file name="config.xml" hash="836940db0bf9b94d062a957935413784"/><file name="system.xml" hash="2e640dfde62f5782f3be945853c1d4e4"/></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
20
+ </package>