webskills_deleteorder - Version 0.1.0

Version Notes

Delete Orders form magento store.Supported versions are above 1.7 community edition.

Download this release

Release Info

Developer Rohit Dhiman
Extension webskills_deleteorder
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Webskills/Deleteorder/Block/Adminhtml/Deleteorderbackend.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ class Webskills_Deleteorder_Block_Adminhtml_Deleteorderbackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ }
app/code/local/Webskills/Deleteorder/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Deleteorder_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
3
+ {
4
+
5
+ protected function _prepareMassaction()
6
+ {
7
+ parent::_prepareMassaction();
8
+
9
+ // Append new mass action option
10
+ $this->getMassactionBlock()->addItem(
11
+ 'deleteorder',
12
+ array('label' => $this->__('Webskills - Delete order'),
13
+ 'url' => $this->getUrl('deleteorder/adminhtml_deleteorderbackend/Deleteorder') //this should be the url where there will be mass operation
14
+ )
15
+ );
16
+ }
17
+ }
18
+
app/code/local/Webskills/Deleteorder/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Webskills_Deleteorder_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/local/Webskills/Deleteorder/controllers/Adminhtml/DeleteorderbackendController.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Author: Rohit Dhiman
3
+ * Website: http://store.webskills.in
4
+ *
5
+ *
6
+ * */
7
+ class Webskills_Deleteorder_Adminhtml_DeleteorderbackendController extends Mage_Adminhtml_Controller_Action
8
+ {
9
+ public function indexAction()
10
+ {
11
+ $this->loadLayout();
12
+ $this->_title($this->__("Backend Page Title"));
13
+ $this->renderLayout();
14
+ }
15
+
16
+ public function DeleteorderAction()
17
+ {
18
+ $orderIds = $this->getRequest()->getParam('order_ids');
19
+ if (empty($orderIds)) {
20
+ Mage::getSingleton('adminhtml/session')->addError('There is no order to process');
21
+ $this->_redirect('adminhtml/sales_order');
22
+ return;
23
+ }
24
+ try{
25
+ $invoices = Mage::getResourceModel('sales/order_invoice_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
26
+ foreach($invoices as $invoice) $invoice->delete();
27
+
28
+ $gridInvoices = Mage::getResourceModel('sales/order_invoice_grid_collection')->addFieldToFilter('order_id',array('in',$orderIds));
29
+ foreach($gridInvoices as $invoice) $invoice->delete();
30
+
31
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
32
+ foreach($shipments as $shipment) $shipment->delete();
33
+
34
+ $gridShipments = Mage::getResourceModel('sales/order_shipment_grid_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
35
+ foreach($gridShipments as $shipment) $shipment->delete();
36
+
37
+ $creditmemos = Mage::getResourceModel('sales/order_creditmemo_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
38
+ foreach($creditmemos as $creditmemo) $creditmemo->delete();
39
+
40
+ $gridCreditMemos = Mage::getResourceModel('sales/order_creditmemo_grid_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
41
+ foreach($gridCreditMemos as $creditmemo) $creditmemo->delete();
42
+
43
+ $transactions = Mage::getResourceModel('sales/order_payment_transaction_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
44
+ foreach($transactions as $transaction) $transaction->delete();
45
+
46
+ foreach($orderIds as $orderId) Mage::getModel('sales/order')->load($orderId)->delete();
47
+
48
+ $gridOrders = Mage::getResourceModel('sales/order_grid_collection')->addAttributeToSelect('*')->addFieldToFilter('entity_id',array('in',$orderIds));
49
+ foreach($gridOrders as $order) $order->delete();
50
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%s has been deleted successfully',count($orderIds)));
51
+ }catch(Exception $e){
52
+ Mage::getSingleton('core/session')->addError($e->getMessage());
53
+ }
54
+ $this->_redirect('adminhtml/sales_order');
55
+ }
56
+ }
app/code/local/Webskills/Deleteorder/etc/config.xml ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webskills_Deleteorder>
5
+ <version>0.1.0</version>
6
+ </Webskills_Deleteorder>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <deleteorder>
11
+ <class>Webskills_Deleteorder_Helper</class>
12
+ </deleteorder>
13
+ </helpers>
14
+ <blocks>
15
+ <deleteorder>
16
+ <class>Webskills_Deleteorder_Block</class>
17
+ </deleteorder>
18
+ <adminhtml>
19
+ <rewrite>
20
+ <sales_order_grid>Webskills_Deleteorder_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
21
+ </rewrite>
22
+ </adminhtml>
23
+ </blocks>
24
+ </global>
25
+ <admin>
26
+ <routers>
27
+ <deleteorder>
28
+ <use>admin</use>
29
+ <args>
30
+ <module>Webskills_Deleteorder</module>
31
+ <frontName>deleteorder</frontName>
32
+ </args>
33
+ </deleteorder>
34
+ </routers>
35
+ </admin>
36
+ <adminhtml>
37
+ <acl>
38
+ <resources>
39
+ <all>
40
+ <title>Allow Everything</title>
41
+ </all>
42
+ <admin>
43
+ <children>
44
+ <deleteorder translate="title" module="deleteorder">
45
+ <title>Deleteorder</title>
46
+ <sort_order>1000</sort_order>
47
+ <children>
48
+ <deleteorderbackend translate="title">
49
+ <title>Backend Page Title</title>
50
+ </deleteorderbackend>
51
+ </children>
52
+ </deleteorder>
53
+ </children>
54
+ </admin>
55
+ </resources>
56
+ </acl>
57
+ <layout>
58
+ <updates>
59
+ <deleteorder>
60
+ <file>deleteorder.xml</file>
61
+ </deleteorder>
62
+ </updates>
63
+ </layout>
64
+ </adminhtml>
65
+ </config>
app/design/adminhtml/default/default/layout/deleteorder.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <deleteorder_adminhtml_deleteorderbackend_index>
4
+ <reference name="content">
5
+ <block type="deleteorder/adminhtml_deleteorderbackend" name="deleteorderbackend" template="deleteorder/deleteorderbackend.phtml"/>
6
+ </reference>
7
+ </deleteorder_adminhtml_deleteorderbackend_index>
8
+ </layout>
app/design/adminhtml/default/default/template/deleteorder/deleteorderbackend.phtml ADDED
@@ -0,0 +1 @@
 
1
+ Demo Backend Page Content
app/etc/modules/Webskills_Deleteorder.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Webskills_Deleteorder>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Webskills_Deleteorder>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>webskills_deleteorder</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Delete Magento Orders.</summary>
10
+ <description>This extension will allow you to delete order(s) from your magento store.</description>
11
+ <notes>Delete Orders form magento store.Supported versions are above 1.7 community edition.</notes>
12
+ <authors><author><name>Rohit Dhiman</name><user>rohitjesus</user><email>rohitdoll@gmail.com</email></author></authors>
13
+ <date>2014-10-26</date>
14
+ <time>16:41:21</time>
15
+ <contents><target name="magelocal"><dir name="Webskills"><dir name="Deleteorder"><dir name="Block"><dir name="Adminhtml"><file name="Deleteorderbackend.php" hash="363263df30367590fc5cdddf13861a37"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="03afff8f395871a5beccfdb6ad8fa8ed"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f6f25e0c5daa1a2f5e0dadfa661b60e7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeleteorderbackendController.php" hash="9baf340f1d6d25be5594ffad2adf4b6c"/></dir></dir><dir name="etc"><file name="config.xml" hash="2ca55343c608a7b62d30cc848587ffd2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deleteorder.xml" hash="660b8f56f65f6d6871b76dbcc11b413f"/></dir><dir name="template"><dir name="deleteorder"><file name="deleteorderbackend.phtml" hash="93ad3e798b60ad33539a944088478690"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Webskills_Deleteorder.xml" hash="60ae6591be9c020cf948de96651ace46"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>