Medma_RemoveallOrders - Version 1.0.0

Version Notes

This is a stable version

Download this release

Release Info

Developer Medma Infomatix
Extension Medma_RemoveallOrders
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Medma/Removeallorder/Block/Adminhtml/Sales/Order.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml sales orders block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+
35
+ class Medma_Removeallorder_Block_Adminhtml_Sales_Order extends Mage_Adminhtml_Block_Sales_Order
36
+ {
37
+ public function __construct()
38
+ {
39
+ $this->_controller = 'sales_order';
40
+ $this->_headerText = Mage::helper('sales')->__('Orders');
41
+ $this->_addButtonLabel = Mage::helper('sales')->__('Create New Order');
42
+
43
+
44
+ /* ----- Add button for removing all order --------------------*/
45
+
46
+ $this->_addButton('removeall', array(
47
+ 'label' => Mage::helper('adminhtml')->__('Remove all order'),
48
+ 'onclick' => "confirmSetLocation('Are you sure you want to remove all order?', '".$this->getUrl('removeallorder/adminhtml_removeallorder/index')."')",
49
+ 'class' => 'none',
50
+ ), -100);
51
+ /*-------------end functionality for removing all order----------*/
52
+
53
+
54
+ parent::__construct();
55
+ if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/create')) {
56
+ $this->_removeButton('add');
57
+ }
58
+ }
59
+
60
+ public function getCreateUrl()
61
+ {
62
+ return $this->getUrl('*/sales_order_create/start');
63
+ }
64
+
65
+ }
app/code/local/Medma/Removeallorder/controllers/Adminhtml/RemoveallorderController.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Medma_Removeallorder_Adminhtml_RemoveallorderController extends Mage_Adminhtml_Controller_action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ /*-------find all sales table -------*/
7
+ $salesEntitiesConf = array_merge(
8
+ Mage::getSingleton('core/config')->init()->getXpath('global/models/sales_entity/entities//table'),
9
+ Mage::getSingleton('core/config')->init()->getXpath('global/models/sales_resource/entities//table')
10
+ );
11
+ /* -------- getting connection with core resources-----*/
12
+ $resource = Mage::getSingleton('core/resource');
13
+ $connection = $resource->getConnection('core_write');
14
+
15
+ foreach($salesEntitiesConf as $table)
16
+ {
17
+ $table = $resource->getTableName($table);
18
+ if ($connection->isTableExists($table))
19
+ {
20
+ try
21
+ {
22
+ /*----- truncate table ----*/
23
+ $connection->truncateTable($table);
24
+ }
25
+ catch(Exception $e)
26
+ {
27
+ Mage::getSingleton('adminhtml/session')->addError($this->__('An error occured please try again'));
28
+ $this->_redirectReferer('*/*/');return;
29
+ }
30
+ }
31
+ }
32
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('All order removed successfully.'));
33
+ $this->_redirectReferer('*/*/');
34
+ }
35
+ }
app/code/local/Medma/Removeallorder/etc/config.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Medma_Removeallorder>
5
+ <version>1.0.0</version>
6
+ </Medma_Removeallorder>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <removeallorder>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Medma_Removeallorder</module>
14
+ <frontName>removeallorder</frontName>
15
+ </args>
16
+ </removeallorder>
17
+ </routers>
18
+ </admin>
19
+ <global>
20
+ <blocks>
21
+ <adminhtml>
22
+ <rewrite>
23
+ <sales_order>Medma_Removeallorder_Block_Adminhtml_Sales_Order</sales_order>
24
+ </rewrite>
25
+ </adminhtml>
26
+ </blocks>
27
+
28
+ </global>
29
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Medma_RemoveallOrders</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension provides the facility to remove all the orders on a single button click.</summary>
10
+ <description>This extension provides the facility to remove all the orders on a single button click.&#xD;
11
+ &#xD;
12
+ This extension is very useful for both merchants and developers.</description>
13
+ <notes>This is a stable version</notes>
14
+ <authors><author><name>Medma Infomatix</name><user>Medma_Infomatix</user><email>gaurav@medma.in</email></author></authors>
15
+ <date>2012-09-25</date>
16
+ <time>12:44:16</time>
17
+ <contents><target name="magelocal"><dir name="Medma"><dir name="Removeallorder"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><file name="Order.php" hash="9dd320db7bf2589098f0fa4aca73b7ce"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RemoveallorderController.php" hash="4a9d2b09a1dbbcf645791141a36f5e19"/></dir></dir><dir name="etc"><file name="config.xml" hash="4a8fa84a83b173b8f549b924f4130b27"/></dir></dir></dir><dir name="modules"><file name="Medma_Removeallorder.xml" hash=""/></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
+ </package>