Version Notes
none
Download this release
Release Info
Developer | Wyomind |
Extension | Wyomind_OrdersEraser |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 3.0.1
- app/code/community/Wyomind/Orderseraser/Block/Order/Grid.php +1 -0
- app/code/community/Wyomind/Orderseraser/Model/Orderseraser.php +1 -0
- app/code/community/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php +1 -0
- app/code/community/Wyomind/Orderseraser/etc/config.xml +94 -0
- app/code/local/Wyomind/Orderseraser/Block/Enhancedgrid/Grid.php +0 -1
- app/code/local/Wyomind/Orderseraser/Block/Erasergrid/Grid.php +0 -1
- app/code/local/Wyomind/Orderseraser/Block/Orderseraser.php +0 -19
- app/code/local/Wyomind/Orderseraser/Helper/Data.php +0 -6
- app/code/local/Wyomind/Orderseraser/Model/Orderseraser.php +0 -17
- app/code/local/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php +0 -5
- app/code/local/Wyomind/Orderseraser/etc/config.xml +0 -127
- app/design/adminhtml/default/default/layout/Orderseraser.xml +0 -10
- app/etc/modules/Wyomind_Orderseraser.xml +16 -8
- package.xml +8 -8
app/code/community/Wyomind/Orderseraser/Block/Order/Grid.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
public function __construct() {
|
1 |
parent::__construct();
|
2 |
|
3 |
}
|
4 |
|
5 |
protected function _prepareCollection() {
|
6 |
|
7 |
$actions = array();
|
8 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
9 |
$actions[] = array(
|
10 |
'caption' => Mage::helper('sales')->__('View'),
|
11 |
'url' => array('base' => '*/sales_order/view'),
|
12 |
'field' => 'order_id'
|
13 |
);
|
14 |
}
|
15 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
16 |
$actions[] = array(
|
17 |
'caption' => Mage::helper('sales')->__('Delete'),
|
18 |
'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
|
19 |
'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
|
20 |
'field' => 'order_id'
|
21 |
);
|
22 |
}
|
23 |
$this->addColumn('action', array(
|
24 |
'header' => Mage::helper('sales')->__('Action'),
|
25 |
'width' => '50px',
|
26 |
'type' => 'action',
|
27 |
'getter' => 'getId',
|
28 |
'actions' => $actions,
|
29 |
'filter' => false,
|
30 |
'sortable' => false,
|
31 |
'index' => 'stores',
|
32 |
'is_system' => true,
|
33 |
));
|
34 |
|
35 |
return parent::_prepareCollection();
|
36 |
}
|
37 |
|
38 |
protected function _prepareColumns() {
|
39 |
return parent::_prepareColumns();
|
40 |
}
|
41 |
protected function _prepareMassaction() {
|
42 |
|
43 |
parent::_prepareMassaction();
|
44 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
45 |
$this->getMassactionBlock()->addItem('delete_order', array(
|
46 |
'label' => Mage::helper('sales')->__('Delete'),
|
47 |
'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
|
48 |
));
|
49 |
}
|
50 |
return $this;
|
51 |
}
|
1 |
+
<?php
|
2 |
public function __construct() {
|
3 |
parent::__construct();
|
4 |
|
5 |
}
|
6 |
|
7 |
protected function _prepareCollection() {
|
8 |
|
9 |
$actions = array();
|
10 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
11 |
$actions[] = array(
|
12 |
'caption' => Mage::helper('sales')->__('View'),
|
13 |
'url' => array('base' => '*/sales_order/view'),
|
14 |
'field' => 'order_id'
|
15 |
);
|
16 |
}
|
17 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
18 |
$actions[] = array(
|
19 |
'caption' => Mage::helper('sales')->__('Delete'),
|
20 |
'url' => array('base' => 'orderseraser/adminhtml_orderseraser/delete'),
|
21 |
'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
|
22 |
'field' => 'order_id'
|
23 |
);
|
24 |
}
|
25 |
$this->addColumn('action', array(
|
26 |
'header' => Mage::helper('sales')->__('Action'),
|
27 |
'width' => '50px',
|
28 |
'type' => 'action',
|
29 |
'getter' => 'getId',
|
30 |
'actions' => $actions,
|
31 |
'filter' => false,
|
32 |
'sortable' => false,
|
33 |
'index' => 'stores',
|
34 |
'is_system' => true,
|
35 |
));
|
36 |
|
37 |
return parent::_prepareCollection();
|
38 |
}
|
39 |
|
40 |
protected function _prepareColumns() {
|
41 |
return parent::_prepareColumns();
|
42 |
}
|
43 |
protected function _prepareMassaction() {
|
44 |
|
45 |
parent::_prepareMassaction();
|
46 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
47 |
$this->getMassactionBlock()->addItem('delete_order', array(
|
48 |
'label' => Mage::helper('sales')->__('Delete'),
|
49 |
'url' => $this->getUrl('orderseraser/adminhtml_orderseraser/massdelete'),
|
50 |
));
|
51 |
}
|
52 |
return $this;
|
53 |
}
|
app/code/community/Wyomind/Orderseraser/Model/Orderseraser.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
public function _erase($orderId) {
|
1 |
$resource = Mage::getSingleton('core/resource');
|
2 |
$delete = $resource->getConnection('core_read');
|
3 |
$tableSo = $resource->getTableName('sales_order');
|
4 |
$tableSoe = $resource->getTableName('sales_order_entity');
|
5 |
$tableSoei = $resource->getTableName('sales_order_entity_int');
|
6 |
$tableEa = $resource->getTableName('eav_attribute');
|
7 |
$tableSfoi = $resource->getTableName('sales_flat_order_item');
|
8 |
$sql = "DELETE FROM " . $tableSo . " WHERE entity_id = " . $orderId . ";";
|
9 |
$delete->query($sql);
|
10 |
$sql = "DELETE FROM " . $tableSoe . " WHERE parent_id = " . $orderId . ";";
|
11 |
$delete->query($sql);
|
12 |
$sql = "DELETE s FROM " . $tableSoe . " s
|
13 |
$delete->query($sql);
|
14 |
$sql = "DELETE FROM " . $tableSfoi . " WHERE order_id=" . $orderId . ";";
|
15 |
$delete->query($sql);
|
16 |
return true;
|
17 |
}
|
1 |
+
<?php
|
2 |
public function _erase($orderId) {
|
3 |
$resource = Mage::getSingleton('core/resource');
|
4 |
$delete = $resource->getConnection('core_read');
|
5 |
$tableSo = $resource->getTableName('sales_order');
|
6 |
$tableSoe = $resource->getTableName('sales_order_entity');
|
7 |
$tableSoei = $resource->getTableName('sales_order_entity_int');
|
8 |
$tableEa = $resource->getTableName('eav_attribute');
|
9 |
$tableSfoi = $resource->getTableName('sales_flat_order_item');
|
10 |
$sql = "DELETE FROM " . $tableSo . " WHERE entity_id = " . $orderId . ";";
|
11 |
$delete->query($sql);
|
12 |
$sql = "DELETE FROM " . $tableSoe . " WHERE parent_id = " . $orderId . ";";
|
13 |
$delete->query($sql);
|
14 |
$sql = "DELETE s FROM " . $tableSoe . " s
|
15 |
$delete->query($sql);
|
16 |
$sql = "DELETE FROM " . $tableSfoi . " WHERE order_id=" . $orderId . ";";
|
17 |
$delete->query($sql);
|
18 |
return true;
|
19 |
}
|
app/code/community/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php
ADDED
@@ -0,0 +1 @@
|
|
|
|
0 |
public function getVersion() {
|
1 |
return substr(Mage::getVersion(), 0, 3);
|
2 |
}
|
3 |
protected function _initOrder() {
|
4 |
$id = $this->getRequest()->getParam('order_id');
|
5 |
$order = Mage::getModel('sales/order')->load($id);
|
6 |
if (!$order->getId()) {
|
7 |
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
8 |
if (!$this->getRequest()->getParam('eraser'))
|
9 |
$this->_redirect('adminhtml/sales_order/');
|
10 |
else
|
11 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
12 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
13 |
return false;
|
14 |
}
|
15 |
Mage::register('sales_order', $order);
|
16 |
Mage::register('current_order', $order);
|
17 |
return $order;
|
18 |
}
|
19 |
public function massDeleteAction() {
|
20 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
21 |
$countDeleteOrder = 0;
|
22 |
foreach ($orderIds as $orderId) {
|
23 |
if ($this->getVersion() <= 1.3 && Mage::getModel('orderseraser/orderseraser')->_erase($orderId))
|
24 |
$countDeleteOrder++;
|
25 |
elseif (Mage::getModel('sales/order')->load($orderId)->delete())
|
26 |
$countDeleteOrder++;
|
27 |
}
|
28 |
if ($countDeleteOrder > 0) {
|
29 |
$this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
|
30 |
} else {
|
31 |
$this->_getSession()->addError($this->__('Unable to delete orders.'));
|
32 |
}
|
33 |
if (!$this->getRequest()->getParam('eraser'))
|
34 |
$this->_redirect('adminhtml/sales_order/');
|
35 |
else
|
36 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
37 |
}
|
38 |
public function deleteAction() {
|
39 |
if ($order = $this->_initOrder()) {
|
40 |
try {
|
41 |
if ($this->getVersion() <= 1.3)
|
42 |
Mage::getModel('orderseraser/orderseraser')->_erase($order->getId());
|
43 |
else
|
44 |
$order->delete();
|
45 |
$this->_getSession()->addSuccess(
|
46 |
$this->__('Order was successfully deleted.')
|
47 |
);
|
48 |
} catch (Mage_Core_Exception $e) {
|
49 |
$this->_getSession()->addError($e->getMessage());
|
50 |
} catch (Exception $e) {
|
51 |
$this->_getSession()->addError($this->__('Unable to delete order.'));
|
52 |
}
|
53 |
if (!$this->getRequest()->getParam('eraser'))
|
54 |
$this->_redirect('adminhtml/sales_order/');
|
55 |
else
|
56 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
57 |
}
|
58 |
}
|
1 |
+
<?php
|
2 |
public function getVersion() {
|
3 |
return substr(Mage::getVersion(), 0, 3);
|
4 |
}
|
5 |
protected function _initOrder() {
|
6 |
$id = $this->getRequest()->getParam('order_id');
|
7 |
$order = Mage::getModel('sales/order')->load($id);
|
8 |
if (!$order->getId()) {
|
9 |
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
10 |
if (!$this->getRequest()->getParam('eraser'))
|
11 |
$this->_redirect('adminhtml/sales_order/');
|
12 |
else
|
13 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
14 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
15 |
return false;
|
16 |
}
|
17 |
Mage::register('sales_order', $order);
|
18 |
Mage::register('current_order', $order);
|
19 |
return $order;
|
20 |
}
|
21 |
public function massDeleteAction() {
|
22 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
23 |
$countDeleteOrder = 0;
|
24 |
foreach ($orderIds as $orderId) {
|
25 |
if ($this->getVersion() <= 1.3 && Mage::getModel('orderseraser/orderseraser')->_erase($orderId))
|
26 |
$countDeleteOrder++;
|
27 |
elseif (Mage::getModel('sales/order')->load($orderId)->delete())
|
28 |
$countDeleteOrder++;
|
29 |
}
|
30 |
if ($countDeleteOrder > 0) {
|
31 |
$this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
|
32 |
} else {
|
33 |
$this->_getSession()->addError($this->__('Unable to delete orders.'));
|
34 |
}
|
35 |
if (!$this->getRequest()->getParam('eraser'))
|
36 |
$this->_redirect('adminhtml/sales_order/');
|
37 |
else
|
38 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
39 |
}
|
40 |
public function deleteAction() {
|
41 |
if ($order = $this->_initOrder()) {
|
42 |
try {
|
43 |
if ($this->getVersion() <= 1.3)
|
44 |
Mage::getModel('orderseraser/orderseraser')->_erase($order->getId());
|
45 |
else
|
46 |
$order->delete();
|
47 |
$this->_getSession()->addSuccess(
|
48 |
$this->__('Order was successfully deleted.')
|
49 |
);
|
50 |
} catch (Mage_Core_Exception $e) {
|
51 |
$this->_getSession()->addError($e->getMessage());
|
52 |
} catch (Exception $e) {
|
53 |
$this->_getSession()->addError($this->__('Unable to delete order.'));
|
54 |
}
|
55 |
if (!$this->getRequest()->getParam('eraser'))
|
56 |
$this->_redirect('adminhtml/sales_order/');
|
57 |
else
|
58 |
$this->_redirect('orderseraser/adminhtml_orderseraser');
|
59 |
}
|
60 |
}
|
app/code/community/Wyomind/Orderseraser/etc/config.xml
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
|
4 |
+
<config>
|
5 |
+
|
6 |
+
<modules>
|
7 |
+
|
8 |
+
<Wyomind_Orderseraser>
|
9 |
+
|
10 |
+
<version>3.0.1</version>
|
11 |
+
|
12 |
+
</Wyomind_Orderseraser>
|
13 |
+
|
14 |
+
</modules>
|
15 |
+
|
16 |
+
<admin>
|
17 |
+
<routers>
|
18 |
+
<orderseraser>
|
19 |
+
<use>admin</use>
|
20 |
+
<args>
|
21 |
+
<module>Wyomind_Orderseraser</module>
|
22 |
+
<frontName>orderseraser</frontName>
|
23 |
+
</args>
|
24 |
+
</orderseraser>
|
25 |
+
</routers>
|
26 |
+
</admin>
|
27 |
+
<adminhtml>
|
28 |
+
<acl>
|
29 |
+
<resources>
|
30 |
+
<all>
|
31 |
+
<title>Allow Everything</title>
|
32 |
+
</all>
|
33 |
+
<admin>
|
34 |
+
<children>
|
35 |
+
<sales>
|
36 |
+
<children>
|
37 |
+
<order>
|
38 |
+
<children>
|
39 |
+
<actions>
|
40 |
+
<children>
|
41 |
+
<delete translate="title">
|
42 |
+
<title>Delete (Orders Eraser)</title>
|
43 |
+
</delete>
|
44 |
+
</children>
|
45 |
+
</actions>
|
46 |
+
</children>
|
47 |
+
</order>
|
48 |
+
</children>
|
49 |
+
</sales>
|
50 |
+
</children>
|
51 |
+
</admin>
|
52 |
+
</resources>
|
53 |
+
</acl>
|
54 |
+
|
55 |
+
</adminhtml>
|
56 |
+
<global>
|
57 |
+
|
58 |
+
<models>
|
59 |
+
<orderseraser>
|
60 |
+
<class>Wyomind_Orderseraser_Model</class>
|
61 |
+
</orderseraser>
|
62 |
+
</models>
|
63 |
+
<resources>
|
64 |
+
<orderseraser_write>
|
65 |
+
<connection>
|
66 |
+
<use>core_write</use>
|
67 |
+
</connection>
|
68 |
+
</orderseraser_write>
|
69 |
+
<orderseraser_read>
|
70 |
+
<connection>
|
71 |
+
<use>core_read</use>
|
72 |
+
</connection>
|
73 |
+
</orderseraser_read>
|
74 |
+
</resources>
|
75 |
+
<blocks>
|
76 |
+
<adminhtml>
|
77 |
+
<rewrite>
|
78 |
+
<sales_order_grid>Wyomind_Orderseraser_Block_Order_Grid</sales_order_grid>
|
79 |
+
</rewrite>
|
80 |
+
</adminhtml>
|
81 |
+
</blocks>
|
82 |
+
<helpers>
|
83 |
+
<orderseraser>
|
84 |
+
<class>Wyomind_Orderseraser_Helper</class>
|
85 |
+
</orderseraser>
|
86 |
+
</helpers>
|
87 |
+
</global>
|
88 |
+
</config>
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
app/code/local/Wyomind/Orderseraser/Block/Enhancedgrid/Grid.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php
|
2 |
public function __construct()
|
3 |
{
|
4 |
parent::__construct();
|
5 |
$this->setId('sales_order_grid');
|
6 |
$this->setUseAjax(true);
|
7 |
$this->setDefaultSort('created_at');
|
8 |
$this->setDefaultDir('DESC');
|
9 |
$this->setSaveParametersInSession(true);
|
10 |
}
|
11 |
/**
|
12 |
* Retrieve collection class
|
13 |
*
|
14 |
* @return string
|
15 |
*/
|
16 |
public function getVersion(){
|
17 |
return substr(Mage::getVersion(),0,3);
|
18 |
}
|
19 |
|
20 |
{
|
21 |
|
22 |
}
|
23 |
{
|
24 |
return 'sales/order_grid_collection';
|
25 |
}
|
26 |
|
27 |
{
|
28 |
$this->addColumn('real_order_id', array(
|
29 |
'header'=> Mage::helper('sales')->__('Order #'),
|
30 |
'width' => '80px',
|
31 |
'type' => 'text',
|
32 |
'index' => 'increment_id',
|
33 |
));
|
34 |
if (!Mage::app()->isSingleStoreMode()) {
|
35 |
$this->addColumn('store_id', array(
|
36 |
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
37 |
'index' => 'store_id',
|
38 |
'type' => 'store',
|
39 |
'store_view'=> true,
|
40 |
'display_deleted' => true,
|
41 |
));
|
42 |
}
|
43 |
$this->addColumn('created_at', array(
|
44 |
'header' => Mage::helper('sales')->__('Purchased On'),
|
45 |
'index' => 'created_at',
|
46 |
'type' => 'datetime',
|
47 |
'width' => '100px',
|
48 |
));
|
49 |
$this->addColumn('billing_name', array(
|
50 |
'header' => Mage::helper('sales')->__('Bill to Name'),
|
51 |
'index' => 'billing_name',
|
52 |
));
|
53 |
$this->addColumn('shipping_name', array(
|
54 |
'header' => Mage::helper('sales')->__('Ship to Name'),
|
55 |
'index' => 'shipping_name',
|
56 |
));
|
57 |
$this->addColumn('base_grand_total', array(
|
58 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
59 |
'index' => 'base_grand_total',
|
60 |
'type' => 'currency',
|
61 |
'currency' => 'base_currency_code',
|
62 |
));
|
63 |
$this->addColumn('grand_total', array(
|
64 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
65 |
'index' => 'grand_total',
|
66 |
'type' => 'currency',
|
67 |
'currency' => 'order_currency_code',
|
68 |
));
|
69 |
$this->addColumn('status', array(
|
70 |
'header' => Mage::helper('sales')->__('Status'),
|
71 |
'index' => 'status',
|
72 |
'type' => 'options',
|
73 |
'width' => '70px',
|
74 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
75 |
));
|
76 |
$actions[]= array(
|
77 |
'caption' => Mage::helper('sales')->__('View'),
|
78 |
'url' => array('base'=>'*/sales_order/view'),
|
79 |
'field' => 'order_id'
|
80 |
);
|
81 |
|
82 |
}
|
83 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
84 |
$actions[]= array(
|
85 |
'caption' => Mage::helper('sales')->__('Delete'),
|
86 |
'url' => array('base'=>'orderseraser/adminhtml_orderseraser/delete'),
|
87 |
'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
|
88 |
'field' => 'order_id'
|
89 |
);
|
90 |
}
|
91 |
|
92 |
|
93 |
$this->addColumn('action',
|
94 |
array(
|
95 |
'header' => Mage::helper('sales')->__('Action'),
|
96 |
'width' => '50px',
|
97 |
'type' => 'action',
|
98 |
'getter' => 'getId',
|
99 |
'actions' => $actions,
|
100 |
'filter' => false,
|
101 |
'sortable' => false,
|
102 |
'index' => 'stores',
|
103 |
'is_system' => true,
|
104 |
));
|
105 |
|
106 |
$this->addRssList('rss/order/new', Mage::helper('sales')->__('New Order RSS'));
|
107 |
if($this->getVersion()>1.3){
|
108 |
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
109 |
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
110 |
}
|
111 |
return parent::_prepareColumns();
|
112 |
}
|
113 |
protected function _prepareMassaction()
|
114 |
{
|
115 |
$this->setMassactionIdField('entity_id');
|
116 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
117 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
118 |
|
119 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
120 |
}
|
121 |
|
122 |
$this->getMassactionBlock()->addItem('cancel_order', array(
|
123 |
'label'=> Mage::helper('sales')->__('Cancel'),
|
124 |
'url' => $this->getUrl('*/sales_order/massCancel'),
|
125 |
));
|
126 |
}
|
127 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/hold')) {
|
128 |
$this->getMassactionBlock()->addItem('hold_order', array(
|
129 |
'label'=> Mage::helper('sales')->__('Hold'),
|
130 |
'url' => $this->getUrl('*/sales_order/massHold'),
|
131 |
));
|
132 |
}
|
133 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
134 |
$this->getMassactionBlock()->addItem('unhold_order', array(
|
135 |
'label'=> Mage::helper('sales')->__('Unhold'),
|
136 |
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
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 |
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
144 |
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
145 |
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
146 |
));
|
147 |
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
148 |
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
149 |
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
150 |
));
|
151 |
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
152 |
'label'=> Mage::helper('sales')->__('Print All'),
|
153 |
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
154 |
));
|
155 |
return $this;
|
156 |
}
|
157 |
public function getRowUrl($row)
|
158 |
{
|
159 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
160 |
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
161 |
}
|
162 |
return false;
|
163 |
}
|
164 |
public function getGridUrl()
|
165 |
{
|
166 |
return $this->getUrl('*/*/grid', array('_current'=>true));
|
167 |
}
|
|
|
0 |
public function __construct()
|
1 |
{
|
2 |
parent::__construct();
|
3 |
$this->setId('sales_order_grid');
|
4 |
$this->setUseAjax(true);
|
5 |
$this->setDefaultSort('created_at');
|
6 |
$this->setDefaultDir('DESC');
|
7 |
$this->setSaveParametersInSession(true);
|
8 |
}
|
9 |
/**
|
10 |
* Retrieve collection class
|
11 |
*
|
12 |
* @return string
|
13 |
*/
|
14 |
public function getVersion(){
|
15 |
return substr(Mage::getVersion(),0,3);
|
16 |
}
|
17 |
|
18 |
{
|
19 |
|
20 |
}
|
21 |
{
|
22 |
return 'sales/order_grid_collection';
|
23 |
}
|
24 |
|
25 |
{
|
26 |
$this->addColumn('real_order_id', array(
|
27 |
'header'=> Mage::helper('sales')->__('Order #'),
|
28 |
'width' => '80px',
|
29 |
'type' => 'text',
|
30 |
'index' => 'increment_id',
|
31 |
));
|
32 |
if (!Mage::app()->isSingleStoreMode()) {
|
33 |
$this->addColumn('store_id', array(
|
34 |
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
35 |
'index' => 'store_id',
|
36 |
'type' => 'store',
|
37 |
'store_view'=> true,
|
38 |
'display_deleted' => true,
|
39 |
));
|
40 |
}
|
41 |
$this->addColumn('created_at', array(
|
42 |
'header' => Mage::helper('sales')->__('Purchased On'),
|
43 |
'index' => 'created_at',
|
44 |
'type' => 'datetime',
|
45 |
'width' => '100px',
|
46 |
));
|
47 |
$this->addColumn('billing_name', array(
|
48 |
'header' => Mage::helper('sales')->__('Bill to Name'),
|
49 |
'index' => 'billing_name',
|
50 |
));
|
51 |
$this->addColumn('shipping_name', array(
|
52 |
'header' => Mage::helper('sales')->__('Ship to Name'),
|
53 |
'index' => 'shipping_name',
|
54 |
));
|
55 |
$this->addColumn('base_grand_total', array(
|
56 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
57 |
'index' => 'base_grand_total',
|
58 |
'type' => 'currency',
|
59 |
'currency' => 'base_currency_code',
|
60 |
));
|
61 |
$this->addColumn('grand_total', array(
|
62 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
63 |
'index' => 'grand_total',
|
64 |
'type' => 'currency',
|
65 |
'currency' => 'order_currency_code',
|
66 |
));
|
67 |
$this->addColumn('status', array(
|
68 |
'header' => Mage::helper('sales')->__('Status'),
|
69 |
'index' => 'status',
|
70 |
'type' => 'options',
|
71 |
'width' => '70px',
|
72 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
73 |
));
|
74 |
$actions[]= array(
|
75 |
'caption' => Mage::helper('sales')->__('View'),
|
76 |
'url' => array('base'=>'*/sales_order/view'),
|
77 |
'field' => 'order_id'
|
78 |
);
|
79 |
|
80 |
}
|
81 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
82 |
$actions[]= array(
|
83 |
'caption' => Mage::helper('sales')->__('Delete'),
|
84 |
'url' => array('base'=>'orderseraser/adminhtml_orderseraser/delete'),
|
85 |
'confirm' => Mage::helper('sales')->__('Are your sure your want to delete this order and to erase all linked data ? '),
|
86 |
'field' => 'order_id'
|
87 |
);
|
88 |
}
|
89 |
|
90 |
|
91 |
$this->addColumn('action',
|
92 |
array(
|
93 |
'header' => Mage::helper('sales')->__('Action'),
|
94 |
'width' => '50px',
|
95 |
'type' => 'action',
|
96 |
'getter' => 'getId',
|
97 |
'actions' => $actions,
|
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 |
if($this->getVersion()>1.3){
|
106 |
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
107 |
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
108 |
}
|
109 |
return parent::_prepareColumns();
|
110 |
}
|
111 |
protected function _prepareMassaction()
|
112 |
{
|
113 |
$this->setMassactionIdField('entity_id');
|
114 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
115 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
116 |
|
117 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
118 |
}
|
119 |
|
120 |
$this->getMassactionBlock()->addItem('cancel_order', array(
|
121 |
'label'=> Mage::helper('sales')->__('Cancel'),
|
122 |
'url' => $this->getUrl('*/sales_order/massCancel'),
|
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 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/unhold')) {
|
132 |
$this->getMassactionBlock()->addItem('unhold_order', array(
|
133 |
'label'=> Mage::helper('sales')->__('Unhold'),
|
134 |
'url' => $this->getUrl('*/sales_order/massUnhold'),
|
135 |
));
|
136 |
}
|
137 |
$this->getMassactionBlock()->addItem('pdfinvoices_order', array(
|
138 |
'label'=> Mage::helper('sales')->__('Print Invoices'),
|
139 |
'url' => $this->getUrl('*/sales_order/pdfinvoices'),
|
140 |
));
|
141 |
$this->getMassactionBlock()->addItem('pdfshipments_order', array(
|
142 |
'label'=> Mage::helper('sales')->__('Print Packingslips'),
|
143 |
'url' => $this->getUrl('*/sales_order/pdfshipments'),
|
144 |
));
|
145 |
$this->getMassactionBlock()->addItem('pdfcreditmemos_order', array(
|
146 |
'label'=> Mage::helper('sales')->__('Print Credit Memos'),
|
147 |
'url' => $this->getUrl('*/sales_order/pdfcreditmemos'),
|
148 |
));
|
149 |
$this->getMassactionBlock()->addItem('pdfdocs_order', array(
|
150 |
'label'=> Mage::helper('sales')->__('Print All'),
|
151 |
'url' => $this->getUrl('*/sales_order/pdfdocs'),
|
152 |
));
|
153 |
return $this;
|
154 |
}
|
155 |
public function getRowUrl($row)
|
156 |
{
|
157 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
158 |
return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
|
159 |
}
|
160 |
return false;
|
161 |
}
|
162 |
public function getGridUrl()
|
163 |
{
|
164 |
return $this->getUrl('*/*/grid', array('_current'=>true));
|
165 |
}
|
app/code/local/Wyomind/Orderseraser/Block/Erasergrid/Grid.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php
|
2 |
public function __construct()
|
3 |
{
|
4 |
|
5 |
parent::__construct();
|
6 |
$this->setId('sales_order_grid');
|
7 |
$this->setUseAjax(true);
|
8 |
$this->setDefaultSort('created_at');
|
9 |
$this->setDefaultDir('DESC');
|
10 |
$this->setSaveParametersInSession(true);
|
11 |
}
|
12 |
/**
|
13 |
* Retrieve collection class
|
14 |
*
|
15 |
* @return string
|
16 |
*/
|
17 |
public function getVersion(){
|
18 |
return substr(Mage::getVersion(),0,3);
|
19 |
}
|
20 |
|
21 |
{
|
22 |
|
23 |
}
|
24 |
{
|
25 |
return 'sales/order_grid_collection';
|
26 |
}
|
27 |
|
28 |
{
|
29 |
$this->addColumn('real_order_id', array(
|
30 |
'header'=> Mage::helper('sales')->__('Order #'),
|
31 |
'width' => '80px',
|
32 |
'type' => 'text',
|
33 |
'index' => 'increment_id',
|
34 |
));
|
35 |
if (!Mage::app()->isSingleStoreMode()) {
|
36 |
$this->addColumn('store_id', array(
|
37 |
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
38 |
'index' => 'store_id',
|
39 |
'type' => 'store',
|
40 |
'store_view'=> true,
|
41 |
'display_deleted' => true,
|
42 |
));
|
43 |
}
|
44 |
$this->addColumn('created_at', array(
|
45 |
'header' => Mage::helper('sales')->__('Purchased On'),
|
46 |
'index' => 'created_at',
|
47 |
'type' => 'datetime',
|
48 |
'width' => '100px',
|
49 |
));
|
50 |
$this->addColumn('billing_name', array(
|
51 |
'header' => Mage::helper('sales')->__('Bill to Name'),
|
52 |
'index' => 'billing_name',
|
53 |
));
|
54 |
$this->addColumn('shipping_name', array(
|
55 |
'header' => Mage::helper('sales')->__('Ship to Name'),
|
56 |
'index' => 'shipping_name',
|
57 |
));
|
58 |
$this->addColumn('base_grand_total', array(
|
59 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
60 |
'index' => 'base_grand_total',
|
61 |
'type' => 'currency',
|
62 |
'currency' => 'base_currency_code',
|
63 |
));
|
64 |
$this->addColumn('grand_total', array(
|
65 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
66 |
'index' => 'grand_total',
|
67 |
'type' => 'currency',
|
68 |
'currency' => 'order_currency_code',
|
69 |
));
|
70 |
$this->addColumn('status', array(
|
71 |
'header' => Mage::helper('sales')->__('Status'),
|
72 |
'index' => 'status',
|
73 |
'type' => 'options',
|
74 |
'width' => '70px',
|
75 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
76 |
));
|
77 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
78 |
$this->addColumn('action',
|
79 |
array(
|
80 |
'header' => Mage::helper('sales')->__('Action'),
|
81 |
'width' => '50px',
|
82 |
'type' => 'action',
|
83 |
'getter' => 'getId',
|
84 |
'actions' => array(
|
85 |
|
86 |
'caption' => Mage::helper('sales')->__('Delete'),
|
87 |
'url' => array('base'=>'orderseraser/adminhtml_orderseraser/delete/eraser/1'),
|
88 |
'field' => 'order_id'
|
89 |
)
|
90 |
),
|
91 |
'filter' => false,
|
92 |
'sortable' => false,
|
93 |
'index' => 'stores',
|
94 |
'is_system' => true,
|
95 |
));
|
96 |
}
|
97 |
|
98 |
return parent::_prepareColumns();
|
99 |
}
|
100 |
protected function _prepareMassaction()
|
101 |
{
|
102 |
$this->setMassactionIdField('entity_id');
|
103 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
104 |
|
105 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
106 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
107 |
|
108 |
}
|
109 |
return $this;
|
110 |
}
|
111 |
|
|
|
0 |
public function __construct()
|
1 |
{
|
2 |
|
3 |
parent::__construct();
|
4 |
$this->setId('sales_order_grid');
|
5 |
$this->setUseAjax(true);
|
6 |
$this->setDefaultSort('created_at');
|
7 |
$this->setDefaultDir('DESC');
|
8 |
$this->setSaveParametersInSession(true);
|
9 |
}
|
10 |
/**
|
11 |
* Retrieve collection class
|
12 |
*
|
13 |
* @return string
|
14 |
*/
|
15 |
public function getVersion(){
|
16 |
return substr(Mage::getVersion(),0,3);
|
17 |
}
|
18 |
|
19 |
{
|
20 |
|
21 |
}
|
22 |
{
|
23 |
return 'sales/order_grid_collection';
|
24 |
}
|
25 |
|
26 |
{
|
27 |
$this->addColumn('real_order_id', array(
|
28 |
'header'=> Mage::helper('sales')->__('Order #'),
|
29 |
'width' => '80px',
|
30 |
'type' => 'text',
|
31 |
'index' => 'increment_id',
|
32 |
));
|
33 |
if (!Mage::app()->isSingleStoreMode()) {
|
34 |
$this->addColumn('store_id', array(
|
35 |
'header' => Mage::helper('sales')->__('Purchased From (Store)'),
|
36 |
'index' => 'store_id',
|
37 |
'type' => 'store',
|
38 |
'store_view'=> true,
|
39 |
'display_deleted' => true,
|
40 |
));
|
41 |
}
|
42 |
$this->addColumn('created_at', array(
|
43 |
'header' => Mage::helper('sales')->__('Purchased On'),
|
44 |
'index' => 'created_at',
|
45 |
'type' => 'datetime',
|
46 |
'width' => '100px',
|
47 |
));
|
48 |
$this->addColumn('billing_name', array(
|
49 |
'header' => Mage::helper('sales')->__('Bill to Name'),
|
50 |
'index' => 'billing_name',
|
51 |
));
|
52 |
$this->addColumn('shipping_name', array(
|
53 |
'header' => Mage::helper('sales')->__('Ship to Name'),
|
54 |
'index' => 'shipping_name',
|
55 |
));
|
56 |
$this->addColumn('base_grand_total', array(
|
57 |
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
58 |
'index' => 'base_grand_total',
|
59 |
'type' => 'currency',
|
60 |
'currency' => 'base_currency_code',
|
61 |
));
|
62 |
$this->addColumn('grand_total', array(
|
63 |
'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
|
64 |
'index' => 'grand_total',
|
65 |
'type' => 'currency',
|
66 |
'currency' => 'order_currency_code',
|
67 |
));
|
68 |
$this->addColumn('status', array(
|
69 |
'header' => Mage::helper('sales')->__('Status'),
|
70 |
'index' => 'status',
|
71 |
'type' => 'options',
|
72 |
'width' => '70px',
|
73 |
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
|
74 |
));
|
75 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
76 |
$this->addColumn('action',
|
77 |
array(
|
78 |
'header' => Mage::helper('sales')->__('Action'),
|
79 |
'width' => '50px',
|
80 |
'type' => 'action',
|
81 |
'getter' => 'getId',
|
82 |
'actions' => array(
|
83 |
|
84 |
'caption' => Mage::helper('sales')->__('Delete'),
|
85 |
'url' => array('base'=>'orderseraser/adminhtml_orderseraser/delete/eraser/1'),
|
86 |
'field' => 'order_id'
|
87 |
)
|
88 |
),
|
89 |
'filter' => false,
|
90 |
'sortable' => false,
|
91 |
'index' => 'stores',
|
92 |
'is_system' => true,
|
93 |
));
|
94 |
}
|
95 |
|
96 |
return parent::_prepareColumns();
|
97 |
}
|
98 |
protected function _prepareMassaction()
|
99 |
{
|
100 |
$this->setMassactionIdField('entity_id');
|
101 |
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
102 |
|
103 |
$this->getMassactionBlock()->setUseSelectAll(false);
|
104 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/delete')) {
|
105 |
|
106 |
}
|
107 |
return $this;
|
108 |
}
|
109 |
|
app/code/local/Wyomind/Orderseraser/Block/Orderseraser.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Wyomind_Orderseraser_Block_Orderseraser extends Mage_Adminhtml_Block_Widget_Grid_Container
|
4 |
-
{
|
5 |
-
|
6 |
-
public function __construct()
|
7 |
-
{
|
8 |
-
|
9 |
-
//on indique ou va se trouver le controller
|
10 |
-
$this->_controller = 'erasergrid';
|
11 |
-
$this->_blockGroup = 'orderseraser';
|
12 |
-
|
13 |
-
//le texte du header qui s�affichera dans l�admin
|
14 |
-
$this->_headerText = "<strike style='color:white;'><span style='color:#EB5E00;'>".$this->__('Orders Eraser')."</span></strike>";
|
15 |
-
//le nom du bouton pour ajouter une un contact
|
16 |
-
parent::__construct();
|
17 |
-
$this->removeButton('add');
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wyomind/Orderseraser/Helper/Data.php
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Wyomind_Orderseraser_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wyomind/Orderseraser/Model/Orderseraser.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Wyomind_Orderseraser_Model_Orderseraser extends Varien_Object{
|
3 |
-
|
4 |
-
public function _erase($orderId){
|
5 |
-
$resource = Mage::getSingleton('core/resource');
|
6 |
-
$sql="DELETE FROM ".$tableSoe." WHERE parent_id = ".$orderId.";";
|
7 |
-
$delete->query($sql);
|
8 |
-
$sql="DELETE s FROM ".$tableSoe." s
|
9 |
-
JOIN ".$tableSoei." si on s.entity_id = si.entity_id
|
10 |
-
JOIN ".$tableEa." a on si.attribute_id = a.attribute_id
|
11 |
-
WHERE a.attribute_code = 'order_id'
|
12 |
-
AND si.value = ".$orderId.";";
|
13 |
-
$delete->query($sql);
|
14 |
-
return true;
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wyomind/Orderseraser/controllers/Adminhtml/OrderseraserController.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
{
|
3 |
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
4 |
->_addBreadcrumb($this->__('Orders'), $this->__('Orders'))
|
5 |
->renderLayout();
|
6 |
return substr(Mage::getVersion(),0,3);
|
7 |
-
protected function _initOrder()
|
8 |
-
{
|
9 |
$id = $this->getRequest()->getParam('order_id');
|
10 |
$order = Mage::getModel('sales/order')->load($id);
|
11 |
if (!$order->getId()) {
|
12 |
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
13 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
14 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
15 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
16 |
return false;
|
17 |
}
|
18 |
Mage::register('sales_order', $order);
|
19 |
Mage::register('current_order', $order);
|
20 |
return $order;
|
21 |
}
|
22 |
{
|
23 |
|
24 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
25 |
$countDeleteOrder = 0;
|
26 |
foreach ($orderIds as $orderId) {
|
27 |
if ( $this->getVersion()<=1.3 && Mage::getModel('orderseraser/orderseraser')->_erase($orderId)) $countDeleteOrder++;
|
28 |
elseif(Mage::getModel('sales/order')->load($orderId)->delete()) $countDeleteOrder++;
|
29 |
}
|
30 |
if ($countDeleteOrder>0) {
|
31 |
$this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
|
32 |
}
|
33 |
else {
|
34 |
$this->_getSession()->addError($this->__('Unable to delete orders.'));
|
35 |
}
|
36 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
37 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
38 |
}
|
39 |
-
if ($order = $this->_initOrder()) {
|
40 |
try {
|
41 |
|
42 |
if ( $this->getVersion()<=1.3) Mage::getModel('orderseraser/orderseraser')->_erase($order->getId());
|
43 |
$this->__('Order was successfully deleted.')
|
44 |
);
|
45 |
}
|
46 |
catch (Mage_Core_Exception $e) {
|
47 |
$this->_getSession()->addError($e->getMessage());
|
48 |
}
|
49 |
catch (Exception $e) {
|
50 |
$this->_getSession()->addError($this->__('Unable to delete order.'));
|
51 |
}
|
52 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
53 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
54 |
}
|
|
|
|
|
0 |
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
|
1 |
->_addBreadcrumb($this->__('Orders'), $this->__('Orders'))
|
2 |
->renderLayout();
|
3 |
return substr(Mage::getVersion(),0,3);
|
|
|
|
|
4 |
$id = $this->getRequest()->getParam('order_id');
|
5 |
$order = Mage::getModel('sales/order')->load($id);
|
6 |
if (!$order->getId()) {
|
7 |
$this->_getSession()->addError($this->__('This order no longer exists.'));
|
8 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
9 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
10 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
11 |
return false;
|
12 |
}
|
13 |
Mage::register('sales_order', $order);
|
14 |
Mage::register('current_order', $order);
|
15 |
return $order;
|
16 |
}
|
17 |
{
|
18 |
|
19 |
$orderIds = $this->getRequest()->getPost('order_ids', array());
|
20 |
$countDeleteOrder = 0;
|
21 |
foreach ($orderIds as $orderId) {
|
22 |
if ( $this->getVersion()<=1.3 && Mage::getModel('orderseraser/orderseraser')->_erase($orderId)) $countDeleteOrder++;
|
23 |
elseif(Mage::getModel('sales/order')->load($orderId)->delete()) $countDeleteOrder++;
|
24 |
}
|
25 |
if ($countDeleteOrder>0) {
|
26 |
$this->_getSession()->addSuccess($this->__('%s order(s) successfully deleted', $countDeleteOrder));
|
27 |
}
|
28 |
else {
|
29 |
$this->_getSession()->addError($this->__('Unable to delete orders.'));
|
30 |
}
|
31 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
32 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
33 |
}
|
|
|
34 |
try {
|
35 |
|
36 |
if ( $this->getVersion()<=1.3) Mage::getModel('orderseraser/orderseraser')->_erase($order->getId());
|
37 |
$this->__('Order was successfully deleted.')
|
38 |
);
|
39 |
}
|
40 |
catch (Mage_Core_Exception $e) {
|
41 |
$this->_getSession()->addError($e->getMessage());
|
42 |
}
|
43 |
catch (Exception $e) {
|
44 |
$this->_getSession()->addError($this->__('Unable to delete order.'));
|
45 |
}
|
46 |
if(!$this->getRequest()->getParam('eraser')) $this->_redirect('adminhtml/sales_order/');
|
47 |
else $this->_redirect('orderseraser/adminhtml_orderseraser');
|
48 |
}
|
app/code/local/Wyomind/Orderseraser/etc/config.xml
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<modules>
|
5 |
-
<Wyomind_Orderseraser>
|
6 |
-
<version>2.0.2</version>
|
7 |
-
</Wyomind_Orderseraser>
|
8 |
-
</modules>
|
9 |
-
<admin>
|
10 |
-
<routers>
|
11 |
-
<orderseraser>
|
12 |
-
<use>admin</use>
|
13 |
-
<args>
|
14 |
-
<module>Wyomind_Orderseraser</module>
|
15 |
-
<frontName>orderseraser</frontName>
|
16 |
-
</args>
|
17 |
-
</orderseraser>
|
18 |
-
</routers>
|
19 |
-
</admin>
|
20 |
-
<adminhtml>
|
21 |
-
<layout>
|
22 |
-
<updates>
|
23 |
-
<orderseraser>
|
24 |
-
<file>orderseraser.xml</file>
|
25 |
-
</orderseraser>
|
26 |
-
</updates>
|
27 |
-
</layout>
|
28 |
-
<menu>
|
29 |
-
<sales>
|
30 |
-
<children>
|
31 |
-
<orderseraser translate="title" module="orderseraser">
|
32 |
-
<title>Orders eraser ***</title>
|
33 |
-
<sort_order>1</sort_order>
|
34 |
-
<action>orderseraser/adminhtml_orderseraser</action>
|
35 |
-
</orderseraser>
|
36 |
-
</children>
|
37 |
-
</sales>
|
38 |
-
</menu>
|
39 |
-
<acl>
|
40 |
-
<resources>
|
41 |
-
<all>
|
42 |
-
<title>Allow Everything</title>
|
43 |
-
</all>
|
44 |
-
<admin>
|
45 |
-
<children>
|
46 |
-
<sales>
|
47 |
-
<children>
|
48 |
-
<order>
|
49 |
-
<children>
|
50 |
-
<actions>
|
51 |
-
<children>
|
52 |
-
<delete translate="title">
|
53 |
-
<title>Delete (Orders Eraser)</title>
|
54 |
-
</delete>
|
55 |
-
</children>
|
56 |
-
</actions>
|
57 |
-
</children>
|
58 |
-
</order>
|
59 |
-
</children>
|
60 |
-
</sales>
|
61 |
-
</children>
|
62 |
-
</admin>
|
63 |
-
</resources>
|
64 |
-
</acl>
|
65 |
-
|
66 |
-
</adminhtml>
|
67 |
-
<global>
|
68 |
-
<models>
|
69 |
-
<orderseraser>
|
70 |
-
<class>Wyomind_Orderseraser_Model</class>
|
71 |
-
<resourceModel>orderseraser_mysql4</resourceModel>
|
72 |
-
</orderseraser>
|
73 |
-
<orderseraser_mysql4>
|
74 |
-
<class>Wyomind_Orderseraser_Model_Mysql4</class>
|
75 |
-
<entities>
|
76 |
-
<orderseraser>
|
77 |
-
<table>orderseraser</table>
|
78 |
-
</orderseraser>
|
79 |
-
</entities>
|
80 |
-
</orderseraser_mysql4>
|
81 |
-
</models>
|
82 |
-
<orderseraser_setup>
|
83 |
-
<setup>
|
84 |
-
<module>Wyomind_Orderseraser</module>
|
85 |
-
</setup>
|
86 |
-
<connection>
|
87 |
-
<use>core_setup</use>
|
88 |
-
</connection>
|
89 |
-
</orderseraser_setup>
|
90 |
-
<orderseraser_write>
|
91 |
-
<connection>
|
92 |
-
<use>core_write</use>
|
93 |
-
</connection>
|
94 |
-
</orderseraser_write>
|
95 |
-
<orderseraser_read>
|
96 |
-
<connection>
|
97 |
-
<use>core_read</use>
|
98 |
-
</connection>
|
99 |
-
</orderseraser_read>
|
100 |
-
</resources>
|
101 |
-
<blocks>
|
102 |
-
<adminhtml>
|
103 |
-
<rewrite>
|
104 |
-
<sales_order_grid>Wyomind_Orderseraser_Block_Enhancedgrid_Grid</sales_order_grid>
|
105 |
-
</rewrite>
|
106 |
-
</adminhtml>
|
107 |
-
<orderseraser>
|
108 |
-
<class>Wyomind_Orderseraser_Block</class>
|
109 |
-
</orderseraser>
|
110 |
-
</blocks>
|
111 |
-
<helpers>
|
112 |
-
<orderseraser>
|
113 |
-
<class>Wyomind_Orderseraser_Helper</class>
|
114 |
-
</orderseraser>
|
115 |
-
</helpers>
|
116 |
-
|
117 |
-
|
118 |
-
</global>
|
119 |
-
|
120 |
-
|
121 |
-
</config>
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/layout/Orderseraser.xml
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
|
4 |
-
<orderseraser_adminhtml_orderseraser_index>
|
5 |
-
<reference name="content">
|
6 |
-
<block type="orderseraser/orderseraser" name="orderseraser" />
|
7 |
-
</reference>
|
8 |
-
</orderseraser_adminhtml_orderseraser_index>
|
9 |
-
|
10 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Wyomind_Orderseraser.xml
CHANGED
@@ -1,10 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
</config>
|
1 |
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
|
4 |
+
<config>
|
5 |
+
|
6 |
+
<modules>
|
7 |
+
|
8 |
+
<Wyomind_Orderseraser>
|
9 |
+
|
10 |
+
<active>true</active>
|
11 |
+
|
12 |
+
<codePool>community</codePool>
|
13 |
+
|
14 |
+
</Wyomind_Orderseraser>
|
15 |
+
|
16 |
+
</modules>
|
17 |
+
|
18 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Wyomind_OrdersEraser</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Orders eraser allows
|
10 |
-
<description>Orders eraser allows
|
11 |
<notes>none</notes>
|
12 |
-
<authors><author><name>
|
13 |
-
<date>
|
14 |
-
<time>10:
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
-
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Wyomind_OrdersEraser</name>
|
4 |
+
<version>3.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</summary>
|
10 |
+
<description>Orders eraser allows to simply clean your sales database by deleting any useless orders and linked invoices and/or shipping in once.</description>
|
11 |
<notes>none</notes>
|
12 |
+
<authors><author><name>Wyomind</name><user>Pierre</user><email>contact@wyomind.com</email></author></authors>
|
13 |
+
<date>2012-04-10</date>
|
14 |
+
<time>10:05:24</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Wyomind_Orderseraser.xml" hash="43aa1ed1daf4f94fee1dddde51b9160c"/></dir></target><target name="magecommunity"><dir name="Wyomind"><dir name="Orderseraser"><dir name="Block"><dir name="Order"><file name="Grid.php" hash="4005a0d98668faa75bb080abc27008ba"/></dir></dir><dir name="Model"><file name="Orderseraser.php" hash="ad10c5807fdd519809ce5b132cc25f52"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="OrderseraserController.php" hash="7ae57f8b115f99d72417917fb323dec3"/></dir></dir><dir name="etc"><file name="config.xml" hash="f804eafe8443e795744fa03d16df12d0"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
|
18 |
</package>
|