Version Notes
Easy to delete order in backend seamlessly through the Action dropdown box on the native Order Manager.
Download this release
Release Info
Developer | Yesha |
Extension | YS_DeleteOrder |
Version | 1.0.5 |
Comparing to | |
See all releases |
Version 1.0.5
app/code/community/YS/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Adminhtml sales orders grid
|
29 |
+
*
|
30 |
+
* @category Mage
|
31 |
+
* @package Mage_Adminhtml
|
32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
33 |
+
*/
|
34 |
+
class YS_DeleteOrder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
|
35 |
+
{
|
36 |
+
|
37 |
+
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
parent::__construct();
|
41 |
+
$this->setId('sales_order_grid');
|
42 |
+
$this->setUseAjax(true);
|
43 |
+
$this->setDefaultSort('created_at');
|
44 |
+
$this->setDefaultDir('DESC');
|
45 |
+
$this->setSaveParametersInSession(true);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Retrieve collection class
|
50 |
+
*
|
51 |
+
* @return string
|
52 |
+
*/
|
53 |
+
/*protected function _getCollectionClass()
|
54 |
+
{
|
55 |
+
return 'sales/order_grid_collection';
|
56 |
+
}*/
|
57 |
+
|
58 |
+
protected function _prepareCollection()
|
59 |
+
{
|
60 |
+
$collection = Mage::getResourceModel($this->_getCollectionClass());
|
61 |
+
$this->setCollection($collection);
|
62 |
+
return parent::_prepareCollection();
|
63 |
+
}
|
64 |
+
|
65 |
+
protected function _prepareColumns()
|
66 |
+
{
|
67 |
+
|
68 |
+
$this->addColumn('real_order_id', array(
|
69 |
+
'header'=> Mage::helper('sales')->__('Order #'),
|
70 |
+
'width' => '80px',
|
71 |
+
'type' => 'text',
|
72 |
+
'index' => 'increment_id',
|
73 |
+
));
|
74 |
+
|
75 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
76 |
+
$this->addColumn('store_id', array(
|
77 |
+
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
78 |
+
'index' => 'store_id',
|
79 |
+
'type' => 'store',
|
80 |
+
'store_view'=> true,
|
81 |
+
'display_deleted' => true,
|
82 |
+
));
|
83 |
+
}
|
84 |
+
|
85 |
+
$this->addColumn('created_at', array(
|
86 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
87 |
+
'index' => 'created_at',
|
88 |
+
'type' => 'datetime',
|
89 |
+
'width' => '100px',
|
90 |
+
));
|
91 |
+
|
92 |
+
$this->addColumn('billing_name', array(
|
93 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
94 |
+
'index' => 'billing_name',
|
95 |
+
));
|
96 |
+
|
97 |
+
$this->addColumn('shipping_name', array(
|
98 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
99 |
+
'index' => 'shipping_name',
|
100 |
+
));
|
101 |
+
|
102 |
+
$this->addColumn('base_grand_total', array(
|
103 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
104 |
+
'index' => 'base_grand_total',
|
105 |
+
'type' => 'currency',
|
106 |
+
'currency' => 'base_currency_code',
|
107 |
+
));
|
108 |
+
|
109 |
+
$this->addColumn('grand_total', array(
|
110 |
+
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
111 |
+
'index' => 'grand_total',
|
112 |
+
'type' => 'currency',
|
113 |
+
'currency' => 'order_currency_code',
|
114 |
+
));
|
115 |
+
|
116 |
+
$this->addColumn('status', array(
|
117 |
+
'header' => Mage::helper('sales')->__('Status'),
|
118 |
+
'index' => 'status',
|
119 |
+
'type' => 'options',
|
120 |
+
'width' => '70px',
|
121 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
122 |
+
));
|
123 |
+
|
124 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
125 |
+
$this->addColumn('action',
|
126 |
+
array(
|
127 |
+
'header' => Mage::helper('sales')->__('Action'),
|
128 |
+
'width' => '50px',
|
129 |
+
'type' => 'action',
|
130 |
+
'getter' => 'getId',
|
131 |
+
'actions' => array(
|
132 |
+
array(
|
133 |
+
'caption' => Mage::helper('sales')->__('View'),
|
134 |
+
'url' => array('base'=>'*/sales_order/view'),
|
135 |
+
'field' => 'order_id'
|
136 |
+
)
|
137 |
+
),
|
138 |
+
'filter' => false,
|
139 |
+
'sortable' => false,
|
140 |
+
'index' => 'stores',
|
141 |
+
'is_system' => true,
|
142 |
+
));
|
143 |
+
}
|
144 |
+
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
145 |
+
|
146 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
147 |
+
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
148 |
+
|
149 |
+
return parent::_prepareColumns();
|
150 |
+
}
|
151 |
+
|
152 |
+
protected function _prepareMassaction()
|
153 |
+
{
|
154 |
+
$this->setMassactionIdField('entity_id');
|
155 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
156 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
157 |
+
|
158 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/cancel')) {
|
159 |
+
$this->getMassactionBlock()->addItem('cancel_order', array(
|
160 |
+
'label'=> Mage::helper('sales')->__('Cancel'),
|
161 |
+
'url' => $this->getUrl('*/sales_order/massCancel'),
|
162 |
+
));
|
163 |
+
}
|
164 |
+
|
165 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
166 |
+
$this->getMassactionBlock()->addItem('hold_order', array(
|
167 |
+
'label'=> Mage::helper('sales')->__('Hold'),
|
168 |
+
'url' => $this->getUrl('*/sales_order/massHold'),
|
169 |
+
));
|
170 |
+
}
|
171 |
+
|
172 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
173 |
+
$this->getMassactionBlock()->addItem('unhold_order', array(
|
174 |
+
'label'=> Mage::helper('sales')->__('Unhold'),
|
175 |
+
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
176 |
+
));
|
177 |
+
}
|
178 |
+
|
179 |
+
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
180 |
+
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
181 |
+
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
182 |
+
));
|
183 |
+
|
184 |
+
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
185 |
+
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
186 |
+
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
187 |
+
));
|
188 |
+
|
189 |
+
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
190 |
+
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
191 |
+
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
192 |
+
));
|
193 |
+
|
194 |
+
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
195 |
+
'label'=> Mage::helper('sales')->__('Print All'),
|
196 |
+
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
197 |
+
));
|
198 |
+
$this->getMassactionBlock()->addItem('delete_order', array(
|
199 |
+
'label'=> Mage::helper('sales')->__('Delete order'),
|
200 |
+
'url' => $this->getUrl('*/sales_order/deleteorder'),
|
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/YS/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php';
|
3 |
+
class YS_DeleteOrder_Adminhtml_Sales_OrderController extends Mage_Adminhtml_Sales_OrderController
|
4 |
+
{
|
5 |
+
public function deleteorderAction()
|
6 |
+
{
|
7 |
+
|
8 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
9 |
+
$flag = false;
|
10 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
11 |
+
$query="show tables";
|
12 |
+
$rsc_table=$write->fetchCol($query);
|
13 |
+
|
14 |
+
$table_sales_flat_order = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
|
15 |
+
$table_sales_flat_creditmemo_comment= Mage::getSingleton('core/resource')->getTableName('sales_flat_creditmemo_comment');
|
16 |
+
$table_sales_flat_creditmemo_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_creditmemo_item');
|
17 |
+
$table_sales_flat_creditmemo= Mage::getSingleton('core/resource')->getTableName('sales_flat_creditmemo');
|
18 |
+
$table_sales_flat_creditmemo_grid= Mage::getSingleton('core/resource')->getTableName('sales_flat_creditmemo_grid');
|
19 |
+
$table_sales_flat_invoice_comment= Mage::getSingleton('core/resource')->getTableName('sales_flat_invoice_comment');
|
20 |
+
$table_sales_flat_invoice_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_invoice_item');
|
21 |
+
$table_sales_flat_invoice= Mage::getSingleton('core/resource')->getTableName('sales_flat_invoice');
|
22 |
+
$table_sales_flat_invoice_grid= Mage::getSingleton('core/resource')->getTableName('sales_flat_invoice_grid');
|
23 |
+
$table_sales_flat_quote_address_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_address_item');
|
24 |
+
$table_sales_flat_quote_item_option= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_item_option');
|
25 |
+
$table_sales_flat_quote= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote');
|
26 |
+
$table_sales_flat_quote_address= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_address');
|
27 |
+
$table_sales_flat_quote_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_item');
|
28 |
+
$table_sales_flat_quote_payment= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_payment');
|
29 |
+
$table_sales_flat_shipment_comment= Mage::getSingleton('core/resource')->getTableName('sales_flat_shipment_comment');
|
30 |
+
$table_sales_flat_shipment_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_shipment_item');
|
31 |
+
$table_sales_flat_shipment_track= Mage::getSingleton('core/resource')->getTableName('sales_flat_shipment_track');
|
32 |
+
$table_sales_flat_shipment= Mage::getSingleton('core/resource')->getTableName('sales_flat_shipment');
|
33 |
+
$table_sales_flat_shipment_grid= Mage::getSingleton('core/resource')->getTableName('sales_flat_shipment_grid');
|
34 |
+
$table_sales_flat_order_address= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_address');
|
35 |
+
$table_sales_flat_order_item= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_item');
|
36 |
+
$table_sales_flat_order_payment= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_payment');
|
37 |
+
$table_sales_flat_order_status_history= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_status_history');
|
38 |
+
$table_sales_flat_order_grid= Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid');
|
39 |
+
$table_log_quote= Mage::getSingleton('core/resource')->getTableName('log_quote');
|
40 |
+
$quoteId='';
|
41 |
+
if (!empty($orderIds)) {
|
42 |
+
foreach ($orderIds as $orderId) {
|
43 |
+
$query=null;
|
44 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
45 |
+
if($order->increment_id){
|
46 |
+
/*$query="show tables like 'sales_flat_order'";
|
47 |
+
$rs=$write->fetchAll($query);*/
|
48 |
+
$incId=$order->increment_id;
|
49 |
+
if(in_array($table_sales_flat_order,$rsc_table)){
|
50 |
+
$query='SELECT entity_id FROM '.$table_sales_flat_order.' WHERE increment_id="'.mysql_escape_string($incId).'"';
|
51 |
+
|
52 |
+
$rs=$write->fetchAll($query);
|
53 |
+
|
54 |
+
$query='SELECT quote_id FROM '.$table_sales_flat_order.' WHERE entity_id="'.mysql_escape_string($orderId).'"';
|
55 |
+
$rs1=$write->fetchAll($query);
|
56 |
+
$quoteId=$rs1[0]['quote_id'];
|
57 |
+
}
|
58 |
+
|
59 |
+
$query='SET FOREIGN_KEY_CHECKS=1';
|
60 |
+
$rs3=$write->query($query);
|
61 |
+
//print_r($rsc_table);
|
62 |
+
//echo $table_sales_flat_creditmemo_comment;
|
63 |
+
if(in_array($table_sales_flat_creditmemo_comment,$rsc_table)){
|
64 |
+
//echo "DELETE FROM ".$table_sales_flat_creditmemo_comment." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_creditmemo." WHERE order_id=".$orderId.")";
|
65 |
+
//die;
|
66 |
+
$write->query("DELETE FROM ".$table_sales_flat_creditmemo_comment." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_creditmemo." WHERE order_id='".mysql_escape_string($orderId)."')");
|
67 |
+
}
|
68 |
+
//die;
|
69 |
+
|
70 |
+
|
71 |
+
if(in_array('sales_flat_creditmemo_item',$rsc_table)){
|
72 |
+
$write->query("DELETE FROM ".$table_sales_flat_creditmemo_item." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_creditmemo." WHERE order_id='".mysql_escape_string($orderId)."')");
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
if(in_array($table_sales_flat_creditmemo,$rsc_table)){
|
77 |
+
$write->query("DELETE FROM ".$table_sales_flat_creditmemo." WHERE order_id='".mysql_escape_string($orderId)."'");
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
if(in_array($table_sales_flat_creditmemo_grid,$rsc_table)){
|
83 |
+
$write->query("DELETE FROM ".$table_sales_flat_creditmemo_grid." WHERE order_id='".mysql_escape_string($orderId)."'");
|
84 |
+
}
|
85 |
+
|
86 |
+
|
87 |
+
if(in_array($table_sales_flat_invoice_comment,$rsc_table)){
|
88 |
+
|
89 |
+
$write->query("DELETE FROM ".$table_sales_flat_invoice_comment." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_invoice." WHERE order_id='".mysql_escape_string($orderId)."')");
|
90 |
+
}
|
91 |
+
|
92 |
+
if(in_array($table_sales_flat_invoice_item,$rsc_table)){
|
93 |
+
|
94 |
+
$write->query("DELETE FROM ".$table_sales_flat_invoice_item." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_invoice." WHERE order_id='".mysql_escape_string($orderId)."')");
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
if(in_array($table_sales_flat_invoice,$rsc_table)){
|
99 |
+
|
100 |
+
$write->query("DELETE FROM ".$table_sales_flat_invoice." WHERE order_id='".mysql_escape_string($orderId)."'");
|
101 |
+
}
|
102 |
+
|
103 |
+
if(in_array($table_sales_flat_invoice_grid,$rsc_table)){
|
104 |
+
|
105 |
+
$write->query("DELETE FROM ".$table_sales_flat_invoice_grid." WHERE order_id='".mysql_escape_string($orderId)."'");
|
106 |
+
}
|
107 |
+
|
108 |
+
if($quoteId){
|
109 |
+
if(in_array($table_sales_flat_quote_address_item,$rsc_table)){
|
110 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_address_item." WHERE parent_item_id IN (SELECT address_id FROM ".$table_sales_flat_quote_address." WHERE quote_id=".$quoteId.")");
|
111 |
+
}
|
112 |
+
|
113 |
+
$table_sales_flat_quote_shipping_rate= Mage::getSingleton('core/resource')->getTableName('sales_flat_quote_shipping_rate');
|
114 |
+
if(in_array($table_sales_flat_quote_shipping_rate,$rsc_table)){
|
115 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_shipping_rate." WHERE address_id IN (SELECT address_id FROM ".$table_sales_flat_quote_address." WHERE quote_id=".$quoteId.")");
|
116 |
+
}
|
117 |
+
|
118 |
+
if(in_array($table_sales_flat_quote_item_option,$rsc_table)){
|
119 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_item_option." WHERE item_id IN (SELECT item_id FROM ".$table_sales_flat_quote_item." WHERE quote_id=".$quoteId.")");
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
if(in_array($table_sales_flat_quote,$rsc_table)){
|
124 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote." WHERE entity_id=".$quoteId);
|
125 |
+
}
|
126 |
+
|
127 |
+
if(in_array($table_sales_flat_quote_address,$rsc_table)){
|
128 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_address." WHERE quote_id=".$quoteId);
|
129 |
+
}
|
130 |
+
|
131 |
+
if(in_array($table_sales_flat_quote_item,$rsc_table)){
|
132 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_item." WHERE quote_id=".$quoteId);
|
133 |
+
}
|
134 |
+
|
135 |
+
if(in_array('sales_flat_quote_payment',$rsc_table)){
|
136 |
+
$write->query("DELETE FROM ".$table_sales_flat_quote_payment." WHERE quote_id=".$quoteId);
|
137 |
+
}
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
if(in_array($table_sales_flat_shipment_comment,$rsc_table)){
|
143 |
+
$write->query("DELETE FROM ".$table_sales_flat_shipment_comment." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_shipment." WHERE order_id='".mysql_escape_string($orderId)."')");
|
144 |
+
}
|
145 |
+
|
146 |
+
if(in_array($table_sales_flat_shipment_item,$rsc_table)){
|
147 |
+
$write->query("DELETE FROM ".$table_sales_flat_shipment_item." WHERE parent_id IN (SELECT entity_id FROM ".$table_sales_flat_shipment." WHERE order_id='".mysql_escape_string($orderId)."')");
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
if(in_array($table_sales_flat_shipment_track,$rsc_table)){
|
152 |
+
$write->query("DELETE FROM ".$table_sales_flat_shipment_track." WHERE order_id IN (SELECT entity_id FROM ".$table_sales_flat_shipment." WHERE order_id='".mysql_escape_string($orderId)."')");
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
if(in_array($table_sales_flat_shipment,$rsc_table)){
|
157 |
+
|
158 |
+
$write->query("DELETE FROM ".$table_sales_flat_shipment." WHERE order_id='".mysql_escape_string($orderId)."'");
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
if(in_array($table_sales_flat_shipment_grid,$rsc_table)){
|
163 |
+
$write->query("DELETE FROM ".$table_sales_flat_shipment_grid." WHERE order_id='".mysql_escape_string($orderId)."'");
|
164 |
+
}
|
165 |
+
|
166 |
+
if(in_array($table_sales_flat_order,$rsc_table)){
|
167 |
+
$write->query("DELETE FROM ".$table_sales_flat_order." WHERE entity_id='".mysql_escape_string($orderId)."'");
|
168 |
+
}
|
169 |
+
|
170 |
+
if(in_array($table_sales_flat_order_address,$rsc_table)){
|
171 |
+
$write->query("DELETE FROM ".$table_sales_flat_order_address." WHERE parent_id='".mysql_escape_string($orderId)."'");
|
172 |
+
}
|
173 |
+
|
174 |
+
if(in_array($table_sales_flat_order_item,$rsc_table)){
|
175 |
+
$write->query("DELETE FROM ".$table_sales_flat_order_item." WHERE order_id='".mysql_escape_string($orderId)."'");
|
176 |
+
}
|
177 |
+
if(in_array($table_sales_flat_order_payment,$rsc_table)){
|
178 |
+
$write->query("DELETE FROM ".$table_sales_flat_order_payment." WHERE parent_id='".mysql_escape_string($orderId)."'");
|
179 |
+
}
|
180 |
+
if(in_array($table_sales_flat_order_status_history,$rsc_table)){
|
181 |
+
$write->query("DELETE FROM ".$table_sales_flat_order_status_history." WHERE parent_id='".mysql_escape_string($orderId)."'");
|
182 |
+
}
|
183 |
+
if($incId&&in_array($table_sales_flat_order_grid,$rsc_table)){
|
184 |
+
$write->query("DELETE FROM ".$table_sales_flat_order_grid." WHERE increment_id='".mysql_escape_string($incId)."'");
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
$query="show tables like '%".$table_log_quote."'";
|
189 |
+
$rsc_table_l=$write->fetchCol($query);
|
190 |
+
if($quoteId&&$rsc_table_l){
|
191 |
+
$write->query("DELETE FROM ".$table_log_quote." WHERE quote_id=".$quoteId);
|
192 |
+
}
|
193 |
+
$write->query("SET FOREIGN_KEY_CHECKS=1");
|
194 |
+
}
|
195 |
+
}
|
196 |
+
$this->_getSession()->addSuccess($this->__('Order(s) deleted.'));
|
197 |
+
}else{
|
198 |
+
$this->_getSession()->addError($this->__('Order(s) error.'));
|
199 |
+
}
|
200 |
+
$this->_redirect('*/*/');
|
201 |
+
}
|
202 |
+
}
|
app/code/community/YS/DeleteOrder/etc/config.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<YS_DeleteOrder>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</YS_DeleteOrder>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<rewrite>
|
10 |
+
<ys_ysadmin_adminhtml_sales_order>
|
11 |
+
<from><![CDATA[#/admin/sales_order/#]]></from>
|
12 |
+
<to>/ysadmin/adminhtml_sales_order/</to>
|
13 |
+
</ys_ysadmin_adminhtml_sales_order>
|
14 |
+
</rewrite>
|
15 |
+
|
16 |
+
<blocks>
|
17 |
+
<adminhtml>
|
18 |
+
<rewrite>
|
19 |
+
<sales_order_grid>YS_DeleteOrder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
20 |
+
</rewrite>
|
21 |
+
</adminhtml>
|
22 |
+
</blocks>
|
23 |
+
</global>
|
24 |
+
<admin>
|
25 |
+
<routers>
|
26 |
+
<ys_deleteorder>
|
27 |
+
<use>admin</use>
|
28 |
+
<args>
|
29 |
+
<module>YS_DeleteOrder</module>
|
30 |
+
<frontName>ysadmin</frontName>
|
31 |
+
</args>
|
32 |
+
</ys_deleteorder>
|
33 |
+
<adminhtml>
|
34 |
+
<args>
|
35 |
+
<modules>
|
36 |
+
<YS_DeleteOrder_Adminhtml before="Mage_Adminhtml">YS_DeleteOrder_Adminhtml</YS_DeleteOrder_Adminhtml>
|
37 |
+
</modules>
|
38 |
+
</args>
|
39 |
+
</adminhtml>
|
40 |
+
</routers>
|
41 |
+
</admin>
|
42 |
+
</config>
|
app/etc/modules/YS_DeleteOrder.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<YS_DeleteOrder>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</YS_DeleteOrder>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>YS_DeleteOrder</name>
|
4 |
+
<version>1.0.5</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Easy to delete order </summary>
|
10 |
+
<description>Easy to delete order in backend through the Action dropdown box on the native Order Manager. </description>
|
11 |
+
<notes>Easy to delete order in backend seamlessly through the Action dropdown box on the native Order Manager. </notes>
|
12 |
+
<authors><author><name>Yesha</name><user>Yesha</user><email>yesha3012@hotmail.com</email></author></authors>
|
13 |
+
<date>2011-12-26</date>
|
14 |
+
<time>11:02:45</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="YS_DeleteOrder.xml" hash="0081dc52606bbd0c2cdf2d3918e94e25"/></dir></target><target name="magecommunity"><dir name="YS"><dir name="DeleteOrder"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="0366abf7710b1c1593a787c510218efc"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><file name="OrderController.php" hash="c090dbb1b6d02c63f559b375348627ca"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="84a41c35f216fc4aa4b77bb42b69f647"/></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|