Version Notes
Support Magento Community V1.9
Download this release
Release Info
Developer | ksvcorporation |
Extension | ksv_deleteOrder |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 0.1.1 to 1.0.1
- app/code/community/Ksv/DeleteOrders/Helper/Data.php +0 -5
- app/code/community/Ksv/DeleteOrders/Model/Observer.php +0 -32
- app/code/community/Ksv/DeleteOrders/controllers/IndexController.php +0 -47
- app/code/community/Ksv/DeleteOrders/etc/config.xml +0 -51
- app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php +186 -0
- app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php +18 -0
- app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/View.php +19 -0
- app/code/community/Treasurebox/Deleteorder/Helper/Data.php +6 -0
- app/code/community/Treasurebox/Deleteorder/controllers/Adminhtml/DeleteorderController.php +65 -0
- app/code/community/Treasurebox/Deleteorder/etc/config.xml +115 -0
- app/design/adminhtml/default/default/layout/deleteorder.xml +8 -0
- app/etc/modules/{Ksv_DeleteOrders.xml → Treasurebox_Deleteorder.xml} +3 -3
- package.xml +26 -25
app/code/community/Ksv/DeleteOrders/Helper/Data.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ksv_DeleteOrders_Helper_Data extends Mgt_Base_Helper_Data
|
3 |
-
{
|
4 |
-
|
5 |
-
}
|
|
|
|
|
|
|
|
|
|
app/code/community/Ksv/DeleteOrders/Model/Observer.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Ksv_DeleteOrders_Model_Observer
|
3 |
-
{
|
4 |
-
const SALES_ORDER_GRID_NAME = 'sales_order_grid';
|
5 |
-
|
6 |
-
public function addOptionToSelect($observer)
|
7 |
-
{
|
8 |
-
if (self::SALES_ORDER_GRID_NAME == $observer->getEvent()->getBlock()->getId()) {
|
9 |
-
$massBlock = $observer->getEvent()->getBlock()->getMassactionBlock();
|
10 |
-
if ($massBlock) {
|
11 |
-
$massBlock->addItem('ksv_delete_orders', array(
|
12 |
-
'label'=> Mage::helper('core')->__('Delete'),
|
13 |
-
'url' => Mage::getUrl('ksv_delete_orders', array('_secure'=>true)),
|
14 |
-
'confirm' => Mage::helper('core')->__('Are you sure to delete the selected orders?'),
|
15 |
-
));
|
16 |
-
}
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
public function deleteOrderFromGrid($observer)
|
21 |
-
{
|
22 |
-
// This is actually not needed for databases with working foreign keys but some databases are corrupt :(
|
23 |
-
$order = $observer->getOrder();
|
24 |
-
if ($order->getId()) {
|
25 |
-
$coreResource = Mage::getSingleton('core/resource');
|
26 |
-
$writeConnection = $coreResource->getConnection('core_write');
|
27 |
-
$salesOrderGridTable = $coreResource->getTableName('sales_flat_order_grid');
|
28 |
-
$query = sprintf('Delete from %s where entity_id = %s', $salesOrderGridTable, (int)$order->getId());
|
29 |
-
$writeConnection->raw_query($query);
|
30 |
-
}
|
31 |
-
}
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Ksv/DeleteOrders/controllers/IndexController.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php';
|
4 |
-
|
5 |
-
class Ksv_DeleteOrders_IndexController extends Mage_Adminhtml_Sales_OrderController
|
6 |
-
{
|
7 |
-
public function indexAction()
|
8 |
-
{
|
9 |
-
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
10 |
-
$deletedOrders = 0;
|
11 |
-
if ($orderIds) {
|
12 |
-
foreach ($orderIds as $orderId) {
|
13 |
-
$order = Mage::getModel('sales/order')->load($orderId);
|
14 |
-
$transactionContainer = Mage::getModel('core/resource_transaction');
|
15 |
-
if ($order->getId()) {
|
16 |
-
$deletedOrders++;
|
17 |
-
// add invoices to delete
|
18 |
-
if ($order->hasInvoices()){
|
19 |
-
$invoices = Mage::getResourceModel('sales/order_invoice_collection')->setOrderFilter($orderId)->load();
|
20 |
-
if ($invoices) {
|
21 |
-
foreach ($invoices as $invoice){
|
22 |
-
$invoice = Mage::getModel('sales/order_invoice')->load($invoice->getId());
|
23 |
-
$transactionContainer->addObject($invoice);
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
// add shipments to delete
|
29 |
-
if ($order->hasShipments()){
|
30 |
-
$shipments = Mage::getResourceModel('sales/order_shipment_collection')->setOrderFilter($orderId)->load();
|
31 |
-
foreach ($shipments as $shipment){
|
32 |
-
$shipment = Mage::getModel('sales/order_shipment')->load($shipment->getId());
|
33 |
-
$transactionContainer->addObject($shipment);
|
34 |
-
}
|
35 |
-
}
|
36 |
-
//delete
|
37 |
-
$transactionContainer->addObject($order)->delete();
|
38 |
-
}
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
if ($deletedOrders) {
|
43 |
-
$this->_getSession()->addSuccess($this->__('%s order(s) was/were successfully deleted.', $deletedOrders));
|
44 |
-
}
|
45 |
-
$this->_redirect('adminhtml/sales_order/', array());
|
46 |
-
}
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Ksv/DeleteOrders/etc/config.xml
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Ksv_DeleteOrders>
|
5 |
-
<version>0.1.1</version>
|
6 |
-
</Ksv_DeleteOrders>
|
7 |
-
</modules>
|
8 |
-
<global>
|
9 |
-
<models>
|
10 |
-
<ksv_delete_orders>
|
11 |
-
<class>Ksv_DeleteOrders_Model</class>
|
12 |
-
</ksv_delete_orders>
|
13 |
-
</models>
|
14 |
-
<helpers>
|
15 |
-
<ksv_delete_orders>
|
16 |
-
<class>Mgt_DelteOrders_Helper</class>
|
17 |
-
</ksv_delete_orders>
|
18 |
-
</helpers>
|
19 |
-
</global>
|
20 |
-
<admin>
|
21 |
-
<routers>
|
22 |
-
<ksv_delete_orders>
|
23 |
-
<use>admin</use>
|
24 |
-
<args>
|
25 |
-
<module>Ksv_DeleteOrders</module>
|
26 |
-
<frontName>ksv_delete_orders</frontName>
|
27 |
-
</args>
|
28 |
-
</ksv_delete_orders>
|
29 |
-
</routers>
|
30 |
-
</admin>
|
31 |
-
<adminhtml>
|
32 |
-
<events>
|
33 |
-
<adminhtml_block_html_before>
|
34 |
-
<observers>
|
35 |
-
<ksv_delete_orders>
|
36 |
-
<class>ksv_delete_orders/observer</class>
|
37 |
-
<method>addOptionToSelect</method>
|
38 |
-
</ksv_delete_orders>
|
39 |
-
</observers>
|
40 |
-
</adminhtml_block_html_before>
|
41 |
-
<sales_order_delete_after>
|
42 |
-
<observers>
|
43 |
-
<ksv_delete_orders>
|
44 |
-
<class>ksv_delete_orders/observer</class>
|
45 |
-
<method>deleteOrderFromGrid</method>
|
46 |
-
</ksv_delete_orders>
|
47 |
-
</observers>
|
48 |
-
</sales_order_delete_after>
|
49 |
-
</events>
|
50 |
-
</adminhtml>
|
51 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Treasurebox_Deleteorder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
parent::__construct();
|
7 |
+
$this->setId('sales_order_grid');
|
8 |
+
$this->setUseAjax(true);
|
9 |
+
$this->setDefaultSort('created_at');
|
10 |
+
$this->setDefaultDir('DESC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Retrieve collection class
|
16 |
+
*
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
protected function _getCollectionClass()
|
20 |
+
{
|
21 |
+
return 'sales/order_grid_collection';
|
22 |
+
}
|
23 |
+
|
24 |
+
protected function _prepareCollection()
|
25 |
+
{
|
26 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
27 |
+
$this->setCollection($collection);
|
28 |
+
return parent::_prepareCollection();
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _prepareColumns()
|
32 |
+
{
|
33 |
+
|
34 |
+
$this->addColumn('real_order_id', array(
|
35 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
36 |
+
'width' => '80px',
|
37 |
+
'type' => 'text',
|
38 |
+
'index' => 'increment_id',
|
39 |
+
));
|
40 |
+
|
41 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
42 |
+
$this->addColumn('store_id', array(
|
43 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
44 |
+
'index' => 'store_id',
|
45 |
+
'type' => 'store',
|
46 |
+
'store_view'=> true,
|
47 |
+
'display_deleted' => true,
|
48 |
+
));
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->addColumn('created_at', array(
|
52 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
53 |
+
'index' => 'created_at',
|
54 |
+
'type' => 'datetime',
|
55 |
+
'width' => '100px',
|
56 |
+
));
|
57 |
+
|
58 |
+
$this->addColumn('billing_name', array(
|
59 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
60 |
+
'index' => 'billing_name',
|
61 |
+
));
|
62 |
+
|
63 |
+
$this->addColumn('shipping_name', array(
|
64 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
65 |
+
'index' => 'shipping_name',
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('base_grand_total', array(
|
69 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
70 |
+
'index' => 'base_grand_total',
|
71 |
+
'type' => 'currency',
|
72 |
+
'currency' => 'base_currency_code',
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addColumn('grand_total', array(
|
76 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
77 |
+
'index' => 'grand_total',
|
78 |
+
'type' => 'currency',
|
79 |
+
'currency' => 'order_currency_code',
|
80 |
+
));
|
81 |
+
|
82 |
+
$this->addColumn('status', array(
|
83 |
+
'header' => Mage::helper('sales')->__('Status'),
|
84 |
+
'index' => 'status',
|
85 |
+
'type' => 'options',
|
86 |
+
'width' => '70px',
|
87 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
88 |
+
));
|
89 |
+
|
90 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
91 |
+
$this->addColumn('action',
|
92 |
+
array(
|
93 |
+
'header' => Mage::helper('sales')->__('Action'),
|
94 |
+
'width' => '100px',
|
95 |
+
'type' => 'action',
|
96 |
+
'getter' => 'getId',
|
97 |
+
'renderer' => 'deleteorder/adminhtml_sales_order_render_delete',
|
98 |
+
'filter' => false,
|
99 |
+
'sortable' => false,
|
100 |
+
'index' => 'stores',
|
101 |
+
'is_system' => true,
|
102 |
+
));
|
103 |
+
}
|
104 |
+
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
105 |
+
|
106 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
107 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel XML'));
|
108 |
+
|
109 |
+
return parent::_prepareColumns();
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function _prepareMassaction()
|
113 |
+
{
|
114 |
+
$this->setMassactionIdField('entity_id');
|
115 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
116 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
117 |
+
|
118 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
119 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
120 |
+
'label'=> Mage::helper('sales')->__('Cancel'),
|
121 |
+
'url' => $this->getUrl('*/sales_order/massCancel'),
|
122 |
+
));
|
123 |
+
}
|
124 |
+
|
125 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
126 |
+
$this->getMassactionBlock()->addItem('hold_order', array(
|
127 |
+
'label'=> Mage::helper('sales')->__('Hold'),
|
128 |
+
'url' => $this->getUrl('*/sales_order/massHold'),
|
129 |
+
));
|
130 |
+
}
|
131 |
+
|
132 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
133 |
+
$this->getMassactionBlock()->addItem('unhold_order', array(
|
134 |
+
'label'=> Mage::helper('sales')->__('Unhold'),
|
135 |
+
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
136 |
+
));
|
137 |
+
}
|
138 |
+
|
139 |
+
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
140 |
+
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
141 |
+
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
142 |
+
));
|
143 |
+
|
144 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
145 |
+
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
146 |
+
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
147 |
+
));
|
148 |
+
|
149 |
+
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
150 |
+
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
151 |
+
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
152 |
+
));
|
153 |
+
|
154 |
+
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
155 |
+
'label'=> Mage::helper('sales')->__('Print All'),
|
156 |
+
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
157 |
+
));
|
158 |
+
|
159 |
+
$this->getMassactionBlock()->addItem('print_shipping_label', array(
|
160 |
+
'label'=> Mage::helper('sales')->__('Print Shipping Labels'),
|
161 |
+
'url' => $this->getUrl('*/sales_order_shipment/massPrintShippingLabel'),
|
162 |
+
));
|
163 |
+
|
164 |
+
$this->getMassactionBlock()->addItem('delete_order', array(
|
165 |
+
'label'=> Mage::helper('sales')->__('Delete Order'),
|
166 |
+
'url' => $this->getUrl('deleteorder/adminhtml_deleteorder/massDelete'),
|
167 |
+
'confirm' => Mage::helper('sales')->__('Are you sure you want to delete order?')
|
168 |
+
));
|
169 |
+
|
170 |
+
return $this;
|
171 |
+
}
|
172 |
+
public function getRowUrl($row)
|
173 |
+
{
|
174 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
175 |
+
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
176 |
+
}
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
|
180 |
+
public function getGridUrl()
|
181 |
+
{
|
182 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
183 |
+
}
|
184 |
+
|
185 |
+
}
|
186 |
+
?>
|
app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Treasurebox_Deleteorder_Block_Adminhtml_Sales_Order_Render_Delete extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
3 |
+
{
|
4 |
+
public function render(Varien_Object $row)
|
5 |
+
{
|
6 |
+
$getData = $row->getData();
|
7 |
+
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
|
8 |
+
$orderID = $getData['entity_id'];
|
9 |
+
$view = $this->getUrl('*/sales_order/view',array('order_id' => $orderID));
|
10 |
+
$delete = $this->getUrl('deleteorder/adminhtml_deleteorder/delete',array('order_id' => $orderID));
|
11 |
+
$link = '<a href="'.$view.'">View</a> <a href="#" onclick="deleteConfirm(\''.$message.'\', \'' . $delete . '\')">Delete</a>';
|
12 |
+
return $link;
|
13 |
+
}
|
14 |
+
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
?>
|
app/code/community/Treasurebox/Deleteorder/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Treasurebox_Deleteorder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
|
3 |
+
public function __construct() {
|
4 |
+
|
5 |
+
parent::__construct();
|
6 |
+
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
|
7 |
+
$this->_addButton('button_id', array(
|
8 |
+
'label' => Mage::helper('Sales')->__('Delete Order'),
|
9 |
+
'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getDeleteUrl() . '\')',
|
10 |
+
'class' => 'go'
|
11 |
+
), 0, 100, 'header', 'header');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function getDeleteUrl()
|
15 |
+
{
|
16 |
+
return $this->getUrl('deleteorder/adminhtml_deleteorder/delete', array('_current'=>true));
|
17 |
+
}
|
18 |
+
}
|
19 |
+
?>
|
app/code/community/Treasurebox/Deleteorder/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Treasurebox_Deleteorder_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Treasurebox/Deleteorder/controllers/Adminhtml/DeleteorderController.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Treasurebox_Deleteorder_Adminhtml_DeleteorderController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('deleteorder/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
protected function _initOrder()
|
14 |
+
{
|
15 |
+
$id = $this->getRequest()->getParam('order_id');
|
16 |
+
$order = Mage::getModel('sales/order')->load($id);
|
17 |
+
|
18 |
+
if (!$order->getId()) {
|
19 |
+
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
20 |
+
$this->_redirect('*/*/');
|
21 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
Mage::register('sales_order', $order);
|
25 |
+
Mage::register('current_order', $order);
|
26 |
+
return $order;
|
27 |
+
}
|
28 |
+
public function indexAction() {
|
29 |
+
$this->_initAction()
|
30 |
+
->renderLayout();
|
31 |
+
}
|
32 |
+
public function deleteAction() {
|
33 |
+
if($order = $this->_initOrder()) {
|
34 |
+
try {
|
35 |
+
$order->delete()->save();
|
36 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Order was successfully deleted'));
|
37 |
+
$this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/index'));
|
38 |
+
} catch (Exception $e) {
|
39 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
40 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('order_ids')));
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/index'));
|
44 |
+
}
|
45 |
+
public function massDeleteAction() {
|
46 |
+
$deleteorderIds = $this->getRequest()->getParam('order_ids');
|
47 |
+
if(!is_array($deleteorderIds)) {
|
48 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
49 |
+
} else {
|
50 |
+
try {
|
51 |
+
foreach ($deleteorderIds as $deleteorderId) {
|
52 |
+
Mage::getModel('sales/order')->load($deleteorderId)->delete();
|
53 |
+
}
|
54 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
55 |
+
Mage::helper('adminhtml')->__(
|
56 |
+
'Total of %d record(s) were successfully deleted', count($deleteorderIds)
|
57 |
+
)
|
58 |
+
);
|
59 |
+
} catch (Exception $e) {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$this->_redirectUrl(Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/index'));
|
64 |
+
}
|
65 |
+
}
|
app/code/community/Treasurebox/Deleteorder/etc/config.xml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Treasurebox_Deleteorder>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Treasurebox_Deleteorder>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<deleteorder>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Treasurebox_Deleteorder</module>
|
14 |
+
<frontName>deleteorder</frontName>
|
15 |
+
</args>
|
16 |
+
</deleteorder>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<deleteorder>
|
21 |
+
<file>deleteorder.xml</file>
|
22 |
+
</deleteorder>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<deleteorder>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Treasurebox_Deleteorder</module>
|
32 |
+
<frontName>deleteorder</frontName>
|
33 |
+
</args>
|
34 |
+
</deleteorder>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<acl>
|
39 |
+
<resources>
|
40 |
+
<all>
|
41 |
+
<title>Allow Everything</title>
|
42 |
+
</all>
|
43 |
+
<admin>
|
44 |
+
<children>
|
45 |
+
<Treasurebox_Deleteorder>
|
46 |
+
<title>Deleteorder Module</title>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
</Treasurebox_Deleteorder>
|
49 |
+
</children>
|
50 |
+
</admin>
|
51 |
+
</resources>
|
52 |
+
</acl>
|
53 |
+
<layout>
|
54 |
+
<updates>
|
55 |
+
<deleteorder>
|
56 |
+
<file>deleteorder.xml</file>
|
57 |
+
</deleteorder>
|
58 |
+
</updates>
|
59 |
+
</layout>
|
60 |
+
</adminhtml>
|
61 |
+
<global>
|
62 |
+
<models>
|
63 |
+
<deleteorder>
|
64 |
+
<class>Treasurebox_Deleteorder_Model</class>
|
65 |
+
<resourceModel>deleteorder_mysql4</resourceModel>
|
66 |
+
</deleteorder>
|
67 |
+
<deleteorder_mysql4>
|
68 |
+
<class>Treasurebox_Deleteorder_Model_Mysql4</class>
|
69 |
+
<entities>
|
70 |
+
<deleteorder>
|
71 |
+
<table>deleteorder</table>
|
72 |
+
</deleteorder>
|
73 |
+
</entities>
|
74 |
+
</deleteorder_mysql4>
|
75 |
+
</models>
|
76 |
+
<resources>
|
77 |
+
<deleteorder_setup>
|
78 |
+
<setup>
|
79 |
+
<module>Treasurebox_Deleteorder</module>
|
80 |
+
</setup>
|
81 |
+
<connection>
|
82 |
+
<use>core_setup</use>
|
83 |
+
</connection>
|
84 |
+
</deleteorder_setup>
|
85 |
+
<deleteorder_write>
|
86 |
+
<connection>
|
87 |
+
<use>core_write</use>
|
88 |
+
</connection>
|
89 |
+
</deleteorder_write>
|
90 |
+
<deleteorder_read>
|
91 |
+
<connection>
|
92 |
+
<use>core_read</use>
|
93 |
+
</connection>
|
94 |
+
</deleteorder_read>
|
95 |
+
</resources>
|
96 |
+
<blocks>
|
97 |
+
<adminhtml>
|
98 |
+
<rewrite>
|
99 |
+
<sales_order_grid>Treasurebox_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
100 |
+
</rewrite>
|
101 |
+
<rewrite>
|
102 |
+
<sales_order_view>Treasurebox_Deleteorder_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
103 |
+
</rewrite>
|
104 |
+
</adminhtml>
|
105 |
+
<deleteorder>
|
106 |
+
<class>Treasurebox_Deleteorder_Block</class>
|
107 |
+
</deleteorder>
|
108 |
+
</blocks>
|
109 |
+
<helpers>
|
110 |
+
<deleteorder>
|
111 |
+
<class>Treasurebox_Deleteorder_Helper</class>
|
112 |
+
</deleteorder>
|
113 |
+
</helpers>
|
114 |
+
</global>
|
115 |
+
</config>
|
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/{Ksv_DeleteOrders.xml → Treasurebox_Deleteorder.xml}
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
-
<
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
-
</
|
8 |
</modules>
|
9 |
-
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
<modules>
|
4 |
+
<Treasurebox_Deleteorder>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
+
</Treasurebox_Deleteorder>
|
8 |
</modules>
|
9 |
+
</config>
|
package.xml
CHANGED
@@ -1,44 +1,45 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ksv_deleteOrder</name>
|
4 |
-
<version>0.1
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Our Delete Order Extension allows you easy to delete in orders simple drop-down selection.</summary>
|
10 |
-
<description
|
11 |

|
12 |
-
By default Magneto does not allow you to delete orders. Our Delete Order Magneto
|
13 |
Extension allows you to delete orders in a safe way without any danger of losing
|
14 |
-
data.
|
|
|
15 |

|
16 |
-
Delete any order from the order page list
|
17 |
-
Delete any order from the order page
|
18 |
-
Delete mass order from the order page list
|
19 |

|
20 |
-
2. Features
|
21 |

|
22 |
-
Easy to delete order in
|
23 |
-
native Order Manager
|
24 |
-
Easy to install
|
25 |
-
Delete single order
|
26 |
-
Delete mass orders
|
27 |

|
28 |
-
Compatibility with Magneto Community Editions
|
29 |

|
30 |
-
3. Installation Process
|
31 |

|
32 |
-
1. Install the extension through Magneto Connect
|
33 |
-
2. Go to System > Cache Management > Click button Flush Magneto Cache
|
34 |
-
3. Logout out and re-login
|
35 |
-
If you want to delete only a few orders, our Delete Order Magento Extension is the perfect
|
36 |
-
solution for your business needs
|
37 |
-
<notes>
|
38 |
<authors><author><name>ksvcorporation</name><user>ksvcorporation</user><email>ksvcorporation@gmail.com</email></author></authors>
|
39 |
-
<date>2014-02
|
40 |
-
<time>
|
41 |
-
<contents><target name="magecommunity"><dir name="
|
42 |
<compatible/>
|
43 |
-
<dependencies><required><php><min>5.
|
44 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ksv_deleteOrder</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Our Delete Order Extension allows you easy to delete in orders simple drop-down selection.</summary>
|
10 |
+
<description><h1>1. Overview</h1>
|
11 |

|
12 |
+
<p>By default Magneto does not allow you to delete orders. Our Delete Order Magneto 
|
13 |
Extension allows you to delete orders in a safe way without any danger of losing
|
14 |
+
data. </p>
|
15 |
+
<p>We provide three options to delete any order:</p>
|
16 |

|
17 |
+
<li>Delete any order from the order page list</li>
|
18 |
+
<li>Delete any order from the order page</li>
|
19 |
+
<li>Delete mass order from the order page list</li>
|
20 |

|
21 |
+
<h2>2. Features</h2>
|
22 |

|
23 |
+
<li>Easy to delete order in back end seamlessly through the Action drop down box on the
|
24 |
+
native Order Manager</li>
|
25 |
+
<li>Easy to install</li>
|
26 |
+
<li>Delete single order</li>
|
27 |
+
<li>Delete mass orders</li>
|
28 |

|
29 |
+
<li>Compatibility with Magneto Community Editions</li>
|
30 |

|
31 |
+
<h2>3. Installation Process</h2>
|
32 |

|
33 |
+
<li>1. Install the extension through Magneto Connect.</li>
|
34 |
+
<li>2. Go to System &gt; Cache Management &gt; Click button Flush Magneto Cache.</li>
|
35 |
+
<li>3. Logout out and re-login.</li>
|
36 |
+
<li /><p>If you want to delete only a few orders, our Delete Order Magento Extension is the perfect
|
37 |
+
solution for your business needs.</p></description>
|
38 |
+
<notes>Support Magento Community V1.9</notes>
|
39 |
<authors><author><name>ksvcorporation</name><user>ksvcorporation</user><email>ksvcorporation@gmail.com</email></author></authors>
|
40 |
+
<date>2014-09-02</date>
|
41 |
+
<time>02:26:44</time>
|
42 |
+
<contents><target name="magecommunity"><dir name="Treasurebox"><dir name="Deleteorder"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="5d0056c133fcef6340273a47cb7e981a"/><dir name="Render"><file name="Delete.php" hash="2e629d5afda475171e8816ace7c754a9"/></dir><file name="View.php" hash="0fd166b2573001a9f68b6f578e90195b"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fbe3e88dd7c8bd2e11c7b006cbb1246d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteorderController.php" hash="f42adb9bedd091c682e2ad1e3cfc6b7a"/></dir></dir><dir name="etc"><file name="config.xml" hash="8fdb38f6e62bfbb89807328bb67e3dcc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Treasurebox_Deleteorder.xml" hash="ac994dec147194878f70b22c958e5726"/></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></contents>
|
43 |
<compatible/>
|
44 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.15</max></php></required></dependencies>
|
45 |
</package>
|