Easy_PDF_Delete_Order - Version 1.0.0.3

Version Notes

Add feature "Delete Order" to your magento store.

Download this release

Release Info

Developer Easy PDF Invoice
Extension Easy_PDF_Delete_Order
Version 1.0.0.3
Comparing to
See all releases


Code changes from version 1.0.0.2 to 1.0.0.3

app/code/community/VES/DeleteOrder/controllers/Adminhtml/IndexController.php CHANGED
@@ -19,9 +19,36 @@ class VES_DeleteOrder_Adminhtml_IndexController extends Mage_Adminhtml_Controlle
19
  return;
20
  }
21
  try{
22
- foreach($orderIds as $orderId){
23
- Mage::getModel('sales/order')->load($orderId)->delete();
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%s has been deleted successfully',count($orderIds)));
26
  }catch(Exception $e){
27
  Mage::getSingleton('core/session')->addError($e->getMessage());
19
  return;
20
  }
21
  try{
22
+ /*Delete invoices which references to orders*/
23
+ $invoices = Mage::getResourceModel('sales/order_invoice_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
24
+ foreach($invoices as $invoice) $invoice->delete();
25
+
26
+ $gridInvoices = Mage::getResourceModel('sales/order_invoice_grid_collection')->addFieldToFilter('order_id',array('in',$orderIds));
27
+ foreach($gridInvoices as $invoice) $invoice->delete();
28
+
29
+ /*Delete shipments which references to orders*/
30
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
31
+ foreach($shipments as $shipment) $shipment->delete();
32
+
33
+ $gridShipments = Mage::getResourceModel('sales/order_shipment_grid_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
34
+ foreach($gridShipments as $shipment) $shipment->delete();
35
+
36
+ /*Delete credit memos which references to orders*/
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
+ /*Delete transactions which references to orders*/
44
+ $transactions = Mage::getResourceModel('sales/order_payment_transaction_collection')->addAttributeToSelect('*')->addFieldToFilter('order_id',array('in',$orderIds));
45
+ foreach($transactions as $transaction) $transaction->delete();
46
+
47
+ /*Delete orders */
48
+ foreach($orderIds as $orderId) Mage::getModel('sales/order')->load($orderId)->delete();
49
+
50
+ $gridOrders = Mage::getResourceModel('sales/order_grid_collection')->addAttributeToSelect('*')->addFieldToFilter('entity_id',array('in',$orderIds));
51
+ foreach($gridOrders as $order) $order->delete();
52
  Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('%s has been deleted successfully',count($orderIds)));
53
  }catch(Exception $e){
54
  Mage::getSingleton('core/session')->addError($e->getMessage());
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_PDF_Delete_Order</name>
4
- <version>1.0.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
7
  <channel>community</channel>
@@ -9,10 +9,10 @@
9
  <summary>Add feature "Delete Order" to your magento store.</summary>
10
  <description>Add feature "Delete Order" to your magento store.</description>
11
  <notes>Add feature "Delete Order" to your magento store.</notes>
12
- <authors><author><name>Easy PDF Invoice</name><user>auto-converted</user><email>easypdfinvoice@gmail.com</email></author></authors>
13
- <date>2013-02-04</date>
14
- <time>14:56:57</time>
15
- <contents><target name="magecommunity"><dir name="VES"><dir name="DeleteOrder"><dir name="Helper"><file name="Data.php" hash="e0c5ce0a9bad60b777c9704b60a56187"/></dir><dir name="Model"><file name="Observer.php" hash="5c537b33bd32ea55792d02b16cf019c5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="4834e46cd023dacf3ed72bd684f82804"/></dir></dir><dir name="etc"><file name="config.xml" hash="227a299693c92243aaf7c604642e0b6c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VES_DeleteOrder.xml" hash="0b255252ef4c0dd8bed263dc281757fd"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_PDF_Delete_Order</name>
4
+ <version>1.0.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL V3.0</license>
7
  <channel>community</channel>
9
  <summary>Add feature "Delete Order" to your magento store.</summary>
10
  <description>Add feature "Delete Order" to your magento store.</description>
11
  <notes>Add feature "Delete Order" to your magento store.</notes>
12
+ <authors><author><name>Easy PDF Invoice</name><user>easypdfinvoice</user><email>easypdfinvoice@gmail.com</email></author></authors>
13
+ <date>2014-02-12</date>
14
+ <time>10:25:03</time>
15
+ <contents><target name="magecommunity"><dir name="VES"><dir name="DeleteOrder"><dir name="Helper"><file name="Data.php" hash="e0c5ce0a9bad60b777c9704b60a56187"/></dir><dir name="Model"><file name="Observer.php" hash="5c537b33bd32ea55792d02b16cf019c5"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="1a993fe7935d2443aa72fb4fdfd185df"/></dir></dir><dir name="etc"><file name="config.xml" hash="227a299693c92243aaf7c604642e0b6c"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VES_DeleteOrder.xml" hash="0b255252ef4c0dd8bed263dc281757fd"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>