Version Notes
Delete Orders Extension
Download this release
Release Info
Developer | Hire Magento Inc. |
Extension | Delete_Orders_Extension |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/HM/Deleteorder/Block/Adminhtml/Deleteorder.php +21 -0
- app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php +195 -0
- app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php +27 -0
- app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/View.php +28 -0
- app/code/community/HM/Deleteorder/Block/Deleteorder.php +26 -0
- app/code/community/HM/Deleteorder/Helper/Data.php +14 -0
- app/code/community/HM/Deleteorder/Model/Deleteorder.php +18 -0
- app/code/community/HM/Deleteorder/Model/Mysql4/Deleteorder.php +18 -0
- app/code/community/HM/Deleteorder/Model/Mysql4/Deleteorder/Collection.php +18 -0
- app/code/community/HM/Deleteorder/Model/Status.php +23 -0
- app/code/community/HM/Deleteorder/controllers/Adminhtml/DeleteorderController.php +73 -0
- app/code/community/HM/Deleteorder/etc/config.xml +97 -0
- app/code/community/HM/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php +25 -0
- app/design/adminhtml/default/default/layout/deleteorder.xml +8 -0
- app/etc/modules/HM_Deleteorder.xml +9 -0
- package.xml +18 -0
app/code/community/HM/Deleteorder/Block/Adminhtml/Deleteorder.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Block_Adminhtml_Deleteorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
12 |
+
{
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
$this->_controller = 'adminhtml_deleteorder';
|
16 |
+
$this->_blockGroup = 'deleteorder';
|
17 |
+
$this->_headerText = Mage::helper('deleteorder')->__('Delete Order');
|
18 |
+
// $this->_addButtonLabel = Mage::helper('deleteorder')->__('Add Item');
|
19 |
+
parent::__construct();
|
20 |
+
}
|
21 |
+
}
|
app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
12 |
+
{
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
$this->setId('sales_order_grid');
|
17 |
+
$this->setUseAjax(true);
|
18 |
+
$this->setDefaultSort('created_at');
|
19 |
+
$this->setDefaultDir('DESC');
|
20 |
+
$this->setSaveParametersInSession(true);
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Retrieve collection class
|
25 |
+
*
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
protected function _getCollectionClass()
|
29 |
+
{
|
30 |
+
return 'sales/order_grid_collection';
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _prepareCollection()
|
34 |
+
{
|
35 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
36 |
+
$this->setCollection($collection);
|
37 |
+
return parent::_prepareCollection();
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _prepareColumns()
|
41 |
+
{
|
42 |
+
|
43 |
+
$this->addColumn('real_order_id', array(
|
44 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
45 |
+
'width' => '80px',
|
46 |
+
'type' => 'text',
|
47 |
+
'index' => 'increment_id',
|
48 |
+
));
|
49 |
+
|
50 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
51 |
+
$this->addColumn('store_id', array(
|
52 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
53 |
+
'index' => 'store_id',
|
54 |
+
'type' => 'store',
|
55 |
+
'store_view'=> true,
|
56 |
+
'display_deleted' => true,
|
57 |
+
));
|
58 |
+
}
|
59 |
+
|
60 |
+
$this->addColumn('created_at', array(
|
61 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
62 |
+
'index' => 'created_at',
|
63 |
+
'type' => 'datetime',
|
64 |
+
'width' => '100px',
|
65 |
+
));
|
66 |
+
|
67 |
+
$this->addColumn('billing_name', array(
|
68 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
69 |
+
'index' => 'billing_name',
|
70 |
+
));
|
71 |
+
|
72 |
+
$this->addColumn('shipping_name', array(
|
73 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
74 |
+
'index' => 'shipping_name',
|
75 |
+
));
|
76 |
+
|
77 |
+
$this->addColumn('base_grand_total', array(
|
78 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
79 |
+
'index' => 'base_grand_total',
|
80 |
+
'type' => 'currency',
|
81 |
+
'currency' => 'base_currency_code',
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('grand_total', array(
|
85 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
86 |
+
'index' => 'grand_total',
|
87 |
+
'type' => 'currency',
|
88 |
+
'currency' => 'order_currency_code',
|
89 |
+
));
|
90 |
+
|
91 |
+
$this->addColumn('status', array(
|
92 |
+
'header' => Mage::helper('sales')->__('Status'),
|
93 |
+
'index' => 'status',
|
94 |
+
'type' => 'options',
|
95 |
+
'width' => '70px',
|
96 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
97 |
+
));
|
98 |
+
|
99 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
100 |
+
$this->addColumn('action',
|
101 |
+
array(
|
102 |
+
'header' => Mage::helper('sales')->__('Action'),
|
103 |
+
'width' => '100px',
|
104 |
+
'type' => 'action',
|
105 |
+
'getter' => 'getId',
|
106 |
+
'renderer' => 'deleteorder/adminhtml_sales_order_render_delete',
|
107 |
+
'filter' => false,
|
108 |
+
'sortable' => false,
|
109 |
+
'index' => 'stores',
|
110 |
+
'is_system' => true,
|
111 |
+
));
|
112 |
+
}
|
113 |
+
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
114 |
+
|
115 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
116 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
117 |
+
|
118 |
+
return parent::_prepareColumns();
|
119 |
+
}
|
120 |
+
|
121 |
+
protected function _prepareMassaction()
|
122 |
+
{
|
123 |
+
$this->setMassactionIdField('entity_id');
|
124 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
125 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
126 |
+
|
127 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
128 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
129 |
+
'label'=> Mage::helper('sales')->__('Cancel'),
|
130 |
+
'url' => $this->getUrl('*/sales_order/massCancel'),
|
131 |
+
));
|
132 |
+
}
|
133 |
+
|
134 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
135 |
+
$this->getMassactionBlock()->addItem('hold_order', array(
|
136 |
+
'label'=> Mage::helper('sales')->__('Hold'),
|
137 |
+
'url' => $this->getUrl('*/sales_order/massHold'),
|
138 |
+
));
|
139 |
+
}
|
140 |
+
|
141 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
142 |
+
$this->getMassactionBlock()->addItem('unhold_order', array(
|
143 |
+
'label'=> Mage::helper('sales')->__('Unhold'),
|
144 |
+
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
145 |
+
));
|
146 |
+
}
|
147 |
+
|
148 |
+
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
149 |
+
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
150 |
+
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
151 |
+
));
|
152 |
+
|
153 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
154 |
+
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
155 |
+
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
156 |
+
));
|
157 |
+
|
158 |
+
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
159 |
+
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
160 |
+
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
161 |
+
));
|
162 |
+
|
163 |
+
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
164 |
+
'label'=> Mage::helper('sales')->__('Print All'),
|
165 |
+
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
166 |
+
));
|
167 |
+
|
168 |
+
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
169 |
+
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
170 |
+
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
171 |
+
));
|
172 |
+
|
173 |
+
$this->getMassactionBlock()->addItem('delete_order', array(
|
174 |
+
'label'=> Mage::helper('sales')->__('Delete Order'),
|
175 |
+
'url' => $this->getUrl('deleteorder/adminhtml_deleteorder/massDelete'),
|
176 |
+
'confirm' => Mage::helper('sales')->__('Are you sure you want to delete order?')
|
177 |
+
));
|
178 |
+
|
179 |
+
return $this;
|
180 |
+
}
|
181 |
+
public function getRowUrl($row)
|
182 |
+
{
|
183 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
184 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
185 |
+
}
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
|
189 |
+
public function getGridUrl()
|
190 |
+
{
|
191 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
192 |
+
}
|
193 |
+
|
194 |
+
}
|
195 |
+
?>
|
app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Block_Adminhtml_Sales_Order_Render_Delete extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
12 |
+
{
|
13 |
+
public function render(Varien_Object $row)
|
14 |
+
{
|
15 |
+
$getData = $row->getData();
|
16 |
+
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
|
17 |
+
$orderID = $getData['entity_id'];
|
18 |
+
$view = $this->getUrl('*/sales_order/view',array('order_id' => $orderID));
|
19 |
+
$delete = $this->getUrl('deleteorder/adminhtml_deleteorder/delete',array('order_id' => $orderID));
|
20 |
+
$link = '<a href="'.$view.'">View</a> <a href="#" onclick="deleteConfirm(\''.$message.'\', \'' . $delete . '\')">Delete</a>';
|
21 |
+
return $link;
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
}
|
26 |
+
|
27 |
+
?>
|
app/code/community/HM/Deleteorder/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
12 |
+
public function __construct() {
|
13 |
+
|
14 |
+
parent::__construct();
|
15 |
+
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
|
16 |
+
$this->_addButton('button_id', array(
|
17 |
+
'label' => Mage::helper('Sales')->__('Delete Order'),
|
18 |
+
'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getDeleteUrl() . '\')',
|
19 |
+
'class' => 'go'
|
20 |
+
), 0, 100, 'header', 'header');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getDeleteUrl()
|
24 |
+
{
|
25 |
+
return $this->getUrl('deleteorder/adminhtml_deleteorder/delete', array('_current'=>true));
|
26 |
+
}
|
27 |
+
}
|
28 |
+
?>
|
app/code/community/HM/Deleteorder/Block/Deleteorder.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Block_Deleteorder extends Mage_Core_Block_Template
|
12 |
+
{
|
13 |
+
public function _prepareLayout()
|
14 |
+
{
|
15 |
+
return parent::_prepareLayout();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getDeleteorder()
|
19 |
+
{
|
20 |
+
if (!$this->hasData('deleteorder')) {
|
21 |
+
$this->setData('deleteorder', Mage::registry('deleteorder'));
|
22 |
+
}
|
23 |
+
return $this->getData('deleteorder');
|
24 |
+
|
25 |
+
}
|
26 |
+
}
|
app/code/community/HM/Deleteorder/Helper/Data.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
}
|
app/code/community/HM/Deleteorder/Model/Deleteorder.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Model_Deleteorder extends Mage_Core_Model_Abstract
|
12 |
+
{
|
13 |
+
public function _construct()
|
14 |
+
{
|
15 |
+
parent::_construct();
|
16 |
+
$this->_init('deleteorder/deleteorder');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/HM/Deleteorder/Model/Mysql4/Deleteorder.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Model_Mysql4_Deleteorder extends Mage_Core_Model_Mysql4_Abstract
|
12 |
+
{
|
13 |
+
public function _construct()
|
14 |
+
{
|
15 |
+
// Note that the deleteorder_id refers to the key field in your database table.
|
16 |
+
$this->_init('deleteorder/deleteorder', 'deleteorder_id');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/HM/Deleteorder/Model/Mysql4/Deleteorder/Collection.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Model_Mysql4_Deleteorder_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
12 |
+
{
|
13 |
+
public function _construct()
|
14 |
+
{
|
15 |
+
parent::_construct();
|
16 |
+
$this->_init('deleteorder/deleteorder');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/HM/Deleteorder/Model/Status.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Model_Status extends Varien_Object
|
12 |
+
{
|
13 |
+
const STATUS_ENABLED = 1;
|
14 |
+
const STATUS_DISABLED = 2;
|
15 |
+
|
16 |
+
static public function getOptionArray()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
self::STATUS_ENABLED => Mage::helper('deleteorder')->__('Enabled'),
|
20 |
+
self::STATUS_DISABLED => Mage::helper('deleteorder')->__('Disabled')
|
21 |
+
);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/HM/Deleteorder/controllers/Adminhtml/DeleteorderController.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
class HM_Deleteorder_Adminhtml_DeleteorderController extends Mage_Adminhtml_Controller_action
|
12 |
+
{
|
13 |
+
|
14 |
+
protected function _initAction() {
|
15 |
+
$this->loadLayout()
|
16 |
+
->_setActiveMenu('deleteorder/items')
|
17 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
18 |
+
|
19 |
+
return $this;
|
20 |
+
}
|
21 |
+
protected function _initOrder()
|
22 |
+
{
|
23 |
+
$id = $this->getRequest()->getParam('order_id');
|
24 |
+
$order = Mage::getModel('sales/order')->load($id);
|
25 |
+
|
26 |
+
if (!$order->getId()) {
|
27 |
+
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
28 |
+
$this->_redirect('*/*/');
|
29 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
Mage::register('sales_order', $order);
|
33 |
+
Mage::register('current_order', $order);
|
34 |
+
return $order;
|
35 |
+
}
|
36 |
+
public function indexAction() {
|
37 |
+
$this->_initAction()
|
38 |
+
->renderLayout();
|
39 |
+
}
|
40 |
+
public function deleteAction() {
|
41 |
+
if($order = $this->_initOrder()) {
|
42 |
+
try {
|
43 |
+
$order->delete()->save();
|
44 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Order was successfully deleted'));
|
45 |
+
$this->_redirectUrl(Mage::getBaseUrl().'admin/sales_order/index');
|
46 |
+
} catch (Exception $e) {
|
47 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
48 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('order_ids')));
|
49 |
+
}
|
50 |
+
}
|
51 |
+
$this->_redirectUrl(Mage::getBaseUrl().'admin/sales_order/index');
|
52 |
+
}
|
53 |
+
public function massDeleteAction() {
|
54 |
+
$deleteorderIds = $this->getRequest()->getParam('order_ids');
|
55 |
+
if(!is_array($deleteorderIds)) {
|
56 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
57 |
+
} else {
|
58 |
+
try {
|
59 |
+
foreach ($deleteorderIds as $deleteorderId) {
|
60 |
+
Mage::getModel('sales/order')->load($deleteorderId)->delete();
|
61 |
+
}
|
62 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
63 |
+
Mage::helper('adminhtml')->__(
|
64 |
+
'Total of %d record(s) were successfully deleted', count($deleteorderIds)
|
65 |
+
)
|
66 |
+
);
|
67 |
+
} catch (Exception $e) {
|
68 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
69 |
+
}
|
70 |
+
}
|
71 |
+
$this->_redirectUrl(Mage::getBaseUrl().'admin/sales_order/index');
|
72 |
+
}
|
73 |
+
}
|
app/code/community/HM/Deleteorder/etc/config.xml
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HM_Deleteorder>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</HM_Deleteorder>
|
7 |
+
</modules>
|
8 |
+
<admin>
|
9 |
+
<routers>
|
10 |
+
<deleteorder>
|
11 |
+
<use>admin</use>
|
12 |
+
<args>
|
13 |
+
<module>HM_Deleteorder</module>
|
14 |
+
<frontName>deleteorder</frontName>
|
15 |
+
</args>
|
16 |
+
</deleteorder>
|
17 |
+
</routers>
|
18 |
+
</admin>
|
19 |
+
<adminhtml>
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<all>
|
23 |
+
<title>Allow Everything</title>
|
24 |
+
</all>
|
25 |
+
<admin>
|
26 |
+
<children>
|
27 |
+
<HM_Deleteorder>
|
28 |
+
<title>Deleteorder Module</title>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
</HM_Deleteorder>
|
31 |
+
</children>
|
32 |
+
</admin>
|
33 |
+
</resources>
|
34 |
+
</acl>
|
35 |
+
<layout>
|
36 |
+
<updates>
|
37 |
+
<deleteorder>
|
38 |
+
<file>deleteorder.xml</file>
|
39 |
+
</deleteorder>
|
40 |
+
</updates>
|
41 |
+
</layout>
|
42 |
+
</adminhtml>
|
43 |
+
<global>
|
44 |
+
<models>
|
45 |
+
<deleteorder>
|
46 |
+
<class>HM_Deleteorder_Model</class>
|
47 |
+
<resourceModel>deleteorder_mysql4</resourceModel>
|
48 |
+
</deleteorder>
|
49 |
+
<deleteorder_mysql4>
|
50 |
+
<class>HM_Deleteorder_Model_Mysql4</class>
|
51 |
+
<entities>
|
52 |
+
<deleteorder>
|
53 |
+
<table>deleteorder</table>
|
54 |
+
</deleteorder>
|
55 |
+
</entities>
|
56 |
+
</deleteorder_mysql4>
|
57 |
+
</models>
|
58 |
+
<resources>
|
59 |
+
<deleteorder_setup>
|
60 |
+
<setup>
|
61 |
+
<module>HM_Deleteorder</module>
|
62 |
+
</setup>
|
63 |
+
<connection>
|
64 |
+
<use>core_setup</use>
|
65 |
+
</connection>
|
66 |
+
</deleteorder_setup>
|
67 |
+
<deleteorder_write>
|
68 |
+
<connection>
|
69 |
+
<use>core_write</use>
|
70 |
+
</connection>
|
71 |
+
</deleteorder_write>
|
72 |
+
<deleteorder_read>
|
73 |
+
<connection>
|
74 |
+
<use>core_read</use>
|
75 |
+
</connection>
|
76 |
+
</deleteorder_read>
|
77 |
+
</resources>
|
78 |
+
<blocks>
|
79 |
+
<adminhtml>
|
80 |
+
<rewrite>
|
81 |
+
<sales_order_grid>HM_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
82 |
+
</rewrite>
|
83 |
+
<rewrite>
|
84 |
+
<sales_order_view>HM_Deleteorder_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
85 |
+
</rewrite>
|
86 |
+
</adminhtml>
|
87 |
+
<deleteorder>
|
88 |
+
<class>HM_Deleteorder_Block</class>
|
89 |
+
</deleteorder>
|
90 |
+
</blocks>
|
91 |
+
<helpers>
|
92 |
+
<deleteorder>
|
93 |
+
<class>HM_Deleteorder_Helper</class>
|
94 |
+
</deleteorder>
|
95 |
+
</helpers>
|
96 |
+
</global>
|
97 |
+
</config>
|
app/code/community/HM/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Delete Orders Extension
|
4 |
+
*
|
5 |
+
* Author: Hire Magento
|
6 |
+
* Website: www.hiremagento.com
|
7 |
+
* Suport Email: hiremagento@gmail.com
|
8 |
+
*
|
9 |
+
**/
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
|
13 |
+
$installer->startSetup();
|
14 |
+
|
15 |
+
$installer->run("
|
16 |
+
|
17 |
+
-- DROP TABLE IF EXISTS {$this->getTable('deleteorder')};
|
18 |
+
CREATE TABLE {$this->getTable('deleteorder')} (
|
19 |
+
`deleteorder_id` int(11) NOT NULL auto_increment,
|
20 |
+
`internal_company_id` varchar(80) NOT NULL default '',
|
21 |
+
PRIMARY KEY (`deleteorder_id`)
|
22 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
23 |
+
");
|
24 |
+
|
25 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/deleteorder.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<deleteorder_adminhtml_deleteorder_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="deleteorder/adminhtml_deleteorder" name="deleteorder" />
|
6 |
+
</reference>
|
7 |
+
</deleteorder_adminhtml_deleteorder_index>
|
8 |
+
</layout>
|
app/etc/modules/HM_Deleteorder.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<HM_Deleteorder>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</HM_Deleteorder>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Delete_Orders_Extension</name>
|
4 |
+
<version>1.0.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>Delete Orders Extension</summary>
|
10 |
+
<description>Delete Orders Extension</description>
|
11 |
+
<notes>Delete Orders Extension</notes>
|
12 |
+
<authors><author><name>Hire Magento Inc.</name><user>hiremagento</user><email>hiremagento@gmail.com</email></author></authors>
|
13 |
+
<date>2013-09-11</date>
|
14 |
+
<time>18:58:44</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="HM"><dir name="Deleteorder"><dir name="Block"><dir name="Adminhtml"><file name="Deleteorder.php" hash="bf208b30127c60b2b98d6cd68f783c8e"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="e16a628bed1852fb7a1716db18c8ee08"/><dir name="Render"><file name="Delete.php" hash="42393b1c31e75c84ab2d3081b5ff62be"/></dir><file name="View.php" hash="219c3578587361ac68f100653960851c"/></dir></dir></dir><file name="Deleteorder.php" hash="761115c8f5ef7eff8a2974a45e3fd462"/></dir><dir name="Helper"><file name="Data.php" hash="d12fb82b3d771f439fdf8d7186955fde"/></dir><dir name="Model"><file name="Deleteorder.php" hash="4cd43eeebe90e753ac9aec489e8da10b"/><dir name="Mysql4"><dir name="Deleteorder"><file name="Collection.php" hash="13dd19f0b62cc6ba4e3c18b87a4dbb90"/></dir><file name="Deleteorder.php" hash="9884997d098af5a49bcf5777a14a0d08"/></dir><file name="Status.php" hash="05582f33533a7a463e26b49efcb28526"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteorderController.php" hash="c17a9f038dcc10de3a47c4bb40283db1"/></dir></dir><dir name="etc"><file name="config.xml" hash="4799b8e08021404a4a87aa5f2f647894"/></dir><dir name="sql"><dir name="deleteorder_setup"><file name="mysql4-install-0.1.0.php" hash="df9fbf996ab738770bb84d008fc9ea03"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deleteorder.xml" hash="7d07207d7c1103b44526c9344d593354"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HM_Deleteorder.xml" hash="7bf795fa56bc4d82a30e7523b589e36e"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.4</min><max>1.7</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
|
18 |
+
</package>
|