Version Notes
This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7
Download this release
Release Info
Developer | Rave Infosys |
Extension | Raveinfosys_Deleteorder |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Deleteorder.php +12 -0
- app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php +186 -0
- app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php +18 -0
- app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/View.php +19 -0
- app/code/local/Raveinfosys/Deleteorder/Block/Deleteorder.php +17 -0
- app/code/local/Raveinfosys/Deleteorder/Helper/Data.php +6 -0
- app/code/local/Raveinfosys/Deleteorder/Model/Deleteorder.php +10 -0
- app/code/local/Raveinfosys/Deleteorder/Model/Mysql4/Deleteorder.php +10 -0
- app/code/local/Raveinfosys/Deleteorder/Model/Mysql4/Deleteorder/Collection.php +10 -0
- app/code/local/Raveinfosys/Deleteorder/Model/Status.php +15 -0
- app/code/local/Raveinfosys/Deleteorder/controllers/Adminhtml/DeleteorderController.php +65 -0
- app/code/local/Raveinfosys/Deleteorder/controllers/IndexController.php +47 -0
- app/code/local/Raveinfosys/Deleteorder/etc/config.xml +115 -0
- app/code/local/Raveinfosys/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php +17 -0
- app/etc/modules/Raveinfosys_Deleteorder.xml +9 -0
- package.xml +18 -0
app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Deleteorder.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Deleteorder_Block_Adminhtml_Deleteorder extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_deleteorder';
|
7 |
+
$this->_blockGroup = 'deleteorder';
|
8 |
+
$this->_headerText = Mage::helper('deleteorder')->__('Delete Order');
|
9 |
+
// $this->_addButtonLabel = Mage::helper('deleteorder')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_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/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/Render/Delete.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_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/local/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/View.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_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/local/Raveinfosys/Deleteorder/Block/Deleteorder.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Deleteorder_Block_Deleteorder extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getDeleteorder()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('deleteorder')) {
|
12 |
+
$this->setData('deleteorder', Mage::registry('deleteorder'));
|
13 |
+
}
|
14 |
+
return $this->getData('deleteorder');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_Deleteorder_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Model/Deleteorder.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_Deleteorder_Model_Deleteorder extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('deleteorder/deleteorder');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Model/Mysql4/Deleteorder.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_Deleteorder_Model_Mysql4_Deleteorder extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the deleteorder_id refers to the key field in your database table.
|
8 |
+
$this->_init('deleteorder/deleteorder', 'deleteorder_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Model/Mysql4/Deleteorder/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_Deleteorder_Model_Mysql4_Deleteorder_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('deleteorder/deleteorder');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_Deleteorder_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('deleteorder')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('deleteorder')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/controllers/Adminhtml/DeleteorderController.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Raveinfosys_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::getBaseUrl().'admin/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::getBaseUrl().'admin/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::getBaseUrl().'admin/sales_order/index');
|
64 |
+
}
|
65 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Raveinfosys_Deleteorder_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/deleteorder?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/deleteorder/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$deleteorder_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($deleteorder_id != null && $deleteorder_id != '') {
|
18 |
+
$deleteorder = Mage::getModel('deleteorder/deleteorder')->load($deleteorder_id)->getData();
|
19 |
+
} else {
|
20 |
+
$deleteorder = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($deleteorder == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$deleteorderTable = $resource->getTableName('deleteorder');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($deleteorderTable,array('deleteorder_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$deleteorder = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('deleteorder', $deleteorder);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Raveinfosys/Deleteorder/etc/config.xml
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Raveinfosys_Deleteorder>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Raveinfosys_Deleteorder>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<deleteorder>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Raveinfosys_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>Raveinfosys_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 |
+
<Raveinfosys_Deleteorder>
|
46 |
+
<title>Deleteorder Module</title>
|
47 |
+
<sort_order>10</sort_order>
|
48 |
+
</Raveinfosys_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>Raveinfosys_Deleteorder_Model</class>
|
65 |
+
<resourceModel>deleteorder_mysql4</resourceModel>
|
66 |
+
</deleteorder>
|
67 |
+
<deleteorder_mysql4>
|
68 |
+
<class>Raveinfosys_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>Raveinfosys_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>Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
|
100 |
+
</rewrite>
|
101 |
+
<rewrite>
|
102 |
+
<sales_order_view>Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_View</sales_order_view>
|
103 |
+
</rewrite>
|
104 |
+
</adminhtml>
|
105 |
+
<deleteorder>
|
106 |
+
<class>Raveinfosys_Deleteorder_Block</class>
|
107 |
+
</deleteorder>
|
108 |
+
</blocks>
|
109 |
+
<helpers>
|
110 |
+
<deleteorder>
|
111 |
+
<class>Raveinfosys_Deleteorder_Helper</class>
|
112 |
+
</deleteorder>
|
113 |
+
</helpers>
|
114 |
+
</global>
|
115 |
+
</config>
|
app/code/local/Raveinfosys/Deleteorder/sql/deleteorder_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('deleteorder')};
|
10 |
+
CREATE TABLE {$this->getTable('deleteorder')} (
|
11 |
+
`deleteorder_id` int(11) NOT NULL auto_increment,
|
12 |
+
`internal_company_id` varchar(80) NOT NULL default '',
|
13 |
+
PRIMARY KEY (`deleteorder_id`)
|
14 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
15 |
+
");
|
16 |
+
|
17 |
+
$installer->endSetup();
|
app/etc/modules/Raveinfosys_Deleteorder.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Raveinfosys_Deleteorder>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Raveinfosys_Deleteorder>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Raveinfosys_Deleteorder</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension allows you to delete orders. </summary>
|
10 |
+
<description>Magento doesn't allow you to delete orders. You can only mark it to cancelled but you can't delete it. This extension allows you to seamlessly delete any order. We have provided three options to delete any order. 1) option to delete any order from the order list page, 2) option to delete any order from the order page, 3) option to delete mass order from the order list page. </description>
|
11 |
+
<notes>This version is properly tested on the following Magento CE versions: 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7</notes>
|
12 |
+
<authors><author><name>Rave Infosys</name><user>raveinfo</user><email>lpext@raveinfosys.com</email></author><author><name>Mayank Sharma</name><user>mayank3008</user><email>mynk.sharma@gmail.com</email></author></authors>
|
13 |
+
<date>2012-07-12</date>
|
14 |
+
<time>12:03:32</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Raveinfosys"><dir name="Deleteorder"><dir name="Block"><dir name="Adminhtml"><file name="Deleteorder.php" hash="66241fe8429b10523868a1ecbcdb3e44"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="9d3870026701ef1250c7cf2d50d8e5bf"/><dir name="Render"><file name="Delete.php" hash="f2b03ab25c61f1af2bf2149c72eb8405"/></dir><file name="View.php" hash="927f52f9bdee13b6a9db09fb2830f2cc"/></dir></dir></dir><file name="Deleteorder.php" hash="dc22c254cc532804d274227eea4524c6"/></dir><dir name="Helper"><file name="Data.php" hash="c169154213a43dffd8e20c11db9b4085"/></dir><dir name="Model"><file name="Deleteorder.php" hash="f175492f275a0141d9192b05b3e05284"/><dir name="Mysql4"><dir name="Deleteorder"><file name="Collection.php" hash="24637131fe79866384efd5ea9d159627"/></dir><file name="Deleteorder.php" hash="df59ff12b26c8b9fa2352f7e3be62e2c"/></dir><file name="Status.php" hash="5afe1e5c00832cbb331742854d1a1cb3"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteorderController.php" hash="a4ae6d98146deb74c007daf7ba3863d1"/></dir><file name="IndexController.php" hash="c58aa57a138856907620ae0446077dce"/></dir><dir name="etc"><file name="config.xml" hash="1da7a12e990885aa7318ec995bad0c58"/></dir><dir name="sql"><dir name="deleteorder_setup"><file name="mysql4-install-0.1.0.php" hash="cd3d47fd247da8aedf3f61fb9943b9ed"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deleteorder.xml" hash=""/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Deleteorder.xml" hash="286345b20bc0777c9a1d089d5ad77361"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.3.10</max></php></required></dependencies>
|
18 |
+
</package>
|