escoin_ordermanage - Version 0.1.0

Version Notes

Escoin_Ordermanage ver 0.1.0 stable

Download this release

Release Info

Developer Tarun Mukherjee
Extension escoin_ordermanage
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/Escoin/Ordermanage/Block/Order/History.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Escoin_Ordermanage extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Escoin
13
+ * @package Escoin_Ordermanage
14
+ * @copyright Copyright (c) 2014
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+
19
+ /**
20
+ * Orders history block
21
+ *
22
+ * @author Escoin <sales@espot.co.in>
23
+ * @see Mage_Sales_Block_Order_History
24
+ */
25
+ class Escoin_Ordermanage_Block_Order_History extends Mage_Sales_Block_Order_History
26
+ {
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+
31
+ // Replace default template
32
+ $this->setTemplate('escoin_ordermanage/sales/order/history.phtml');
33
+ }
34
+
35
+ }
app/code/community/Escoin/Ordermanage/Helper/Data.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Escoin_Ordermanage extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Escoin
13
+ * @package Escoin_Ordermanage
14
+ * @copyright Copyright (c) 2014
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ /**
18
+ * Ordermanage default helper
19
+ *
20
+ * @category Escoin
21
+ * @package Escoin_Ordermanage
22
+ * �(�
23
+ */
24
+ class Escoin_Ordermanage_Helper_Data extends Mage_Core_Helper_Abstract{
25
+ }
app/code/community/Escoin/Ordermanage/Model/Observer.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Escoin_Ordermanage extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Escoin
13
+ * @package Escoin_Ordermanage
14
+ * @copyright Copyright (c) 2014
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+ class Escoin_Ordermanage_Model_Observer
18
+ {
19
+ const SALES_ORDER_GRID_NAME = 'sales_order_grid';
20
+
21
+ public function addOptionToDelete($observer)
22
+ {
23
+ if (self::SALES_ORDER_GRID_NAME == $observer->getEvent()->getBlock()->getId()) {
24
+ $massBlock = $observer->getEvent()->getBlock()->getMassactionBlock();
25
+ if ($massBlock) {
26
+ $massBlock->addItem('escoin_delete_order', array(
27
+ 'label'=> Mage::helper('core')->__('Delete'),
28
+ 'url' => Mage::helper('adminhtml')->getUrl("adminhtml/ordermanage_order/delete"),
29
+ 'confirm' => Mage::helper('core')->__('Are you sure to delete the selected orders?'),
30
+ ));
31
+ }
32
+ }
33
+ }
34
+
35
+ public function deleteOrderFromGrid($observer)
36
+ {
37
+ //-- Delete the orders from the sales_order_grid table if not automatically done by the system --//
38
+ $order = $observer->getOrder();
39
+ if ($order->getId()) {
40
+ $coreResource = Mage::getSingleton('core/resource');
41
+ $writeConnection = $coreResource->getConnection('core_write');
42
+ $salesOrderGridTable = $coreResource->getTableName('sales_flat_order_grid');
43
+ $query = sprintf('Delete from %s where entity_id = %s', $salesOrderGridTable, (int)$order->getId());
44
+ $writeConnection->raw_query($query);
45
+ }
46
+ }
47
+ }
app/code/community/Escoin/Ordermanage/controllers/Adminhtml/Ordermanage/OrderController.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Escoin_Ordermanage extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Escoin
13
+ * @package Escoin_Ordermanage
14
+ * @copyright Copyright (c) 2014
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+ require_once 'Mage/Adminhtml/controllers/Sales/OrderController.php';
19
+
20
+ class Escoin_Ordermanage_Adminhtml_Ordermanage_OrderController extends Mage_Adminhtml_Sales_OrderController
21
+ {
22
+ public function deleteAction()
23
+ {
24
+
25
+
26
+ $orderIds = $this->getRequest()->getPost('order_ids', array());
27
+ $deletedOrders = 0;
28
+ if ($orderIds) {
29
+ foreach ($orderIds as $orderId) {
30
+ $order = Mage::getModel('sales/order')->load($orderId);
31
+ $transactionContainer = Mage::getModel('core/resource_transaction');
32
+ if ($order->getId()) {
33
+ $deletedOrders++;
34
+ // add invoices to delete
35
+ if ($order->hasInvoices()){
36
+ $invoices = Mage::getResourceModel('sales/order_invoice_collection')->setOrderFilter($orderId)->load();
37
+ if ($invoices) {
38
+ foreach ($invoices as $invoice){
39
+ $invoice = Mage::getModel('sales/order_invoice')->load($invoice->getId());
40
+ $transactionContainer->addObject($invoice);
41
+ }
42
+ }
43
+ }
44
+
45
+ // add shipments to delete
46
+ if ($order->hasShipments()){
47
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')->setOrderFilter($orderId)->load();
48
+ foreach ($shipments as $shipment){
49
+ $shipment = Mage::getModel('sales/order_shipment')->load($shipment->getId());
50
+ $transactionContainer->addObject($shipment);
51
+ }
52
+ }
53
+ //delete
54
+ $transactionContainer->addObject($order)->delete();
55
+ }
56
+ }
57
+ }
58
+
59
+ if ($deletedOrders) {
60
+
61
+ $val = ($deletedOrders > 1)?'were':'was';
62
+ $this->_getSession()->addSuccess($this->__('%s order(s) %s successfully deleted.', $deletedOrders,$val));
63
+ }
64
+ $this->_redirect('adminhtml/sales_order/', array());
65
+ }
66
+ }
app/code/community/Escoin/Ordermanage/controllers/OrderController.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Escoin_Ordermanage extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the MIT License
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/mit-license.php
11
+ *
12
+ * @category Escoin
13
+ * @package Escoin_Ordermanage
14
+ * @copyright Copyright (c) 2014
15
+ * @license http://opensource.org/licenses/mit-license.php MIT License
16
+ */
17
+
18
+ /**
19
+ * Escoin_Ordermanage_Order controller
20
+ */
21
+ class Escoin_Ordermanage_OrderController extends Mage_Core_Controller_Front_Action
22
+ {
23
+ /**
24
+ * Handles cancel order action
25
+ */
26
+ public function cancelAction()
27
+ {
28
+ $orderId = $this->getRequest()->get('order_id');
29
+
30
+
31
+
32
+ // Load order
33
+ if(!empty($orderId)) {
34
+ $order = Mage::getModel('sales/order')->load($orderId);
35
+ $order->cancel();
36
+ $order->save();
37
+ Mage::getSingleton('core/session')->addSuccess($this->__("Order was successfully cancelled."));
38
+ }
39
+
40
+ // Redirect back to orders list
41
+ $this->_redirect('sales/order/history/');
42
+ }
43
+ }
app/code/community/Escoin/Ordermanage/etc/config.xml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Escoin_Ordermanage extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Escoin
14
+ * @package Escoin_Ordermanage
15
+ * @copyright Copyright (c) 2014
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Escoin_Ordermanage>
22
+ <version>0.1.0</version>
23
+ </Escoin_Ordermanage>
24
+ </modules>
25
+ <global>
26
+ <blocks>
27
+ <ordermanage>
28
+ <class>Escoin_Ordermanage_Block</class>
29
+ </ordermanage>
30
+ <sales>
31
+ <rewrite>
32
+ <order_history>Escoin_Ordermanage_Block_Order_History</order_history>
33
+ </rewrite>
34
+ </sales>
35
+ </blocks>
36
+ <helpers>
37
+ <ordermanage>
38
+ <class>Escoin_Ordermanage_Helper</class>
39
+ </ordermanage>
40
+ </helpers>
41
+ <models>
42
+ <ordermanage>
43
+ <class>Escoin_Ordermanage_Model</class>
44
+ </ordermanage>
45
+
46
+ </models>
47
+ <rewrite>
48
+ <escoin_ordermanage>
49
+ <!-- be sure to have only # at the end or the source -->
50
+ <from><![CDATA[#^/sales/order/cancel/(.*)#]]></from>
51
+ <to><![CDATA[/ordermanage/order/cancel/$1]]></to>
52
+ </escoin_ordermanage>
53
+ </rewrite>
54
+ </global>
55
+ <frontend>
56
+ <routers>
57
+ <escoin_ordermanage>
58
+ <use>standard</use>
59
+ <args>
60
+ <module>Escoin_Ordermanage</module>
61
+ <frontName>ordermanage</frontName>
62
+ </args>
63
+ </escoin_ordermanage>
64
+ </routers>
65
+ <layout>
66
+ <updates>
67
+ <escoin_ordermanage>
68
+ <file>escoin_ordermanage.xml</file>
69
+ </escoin_ordermanage>
70
+ </updates>
71
+ </layout>
72
+ </frontend>
73
+ <adminhtml>
74
+ <layout>
75
+ <updates>
76
+ <escoin_ordermanage>
77
+ <file>escoin_ordermanage.xml</file>
78
+ </escoin_ordermanage>
79
+ </updates>
80
+ </layout>
81
+ <translate>
82
+ <modules>
83
+ <Escoin_Ordermanage>
84
+ <files>
85
+ <default>Escoin_Ordermanage.csv</default>
86
+ </files>
87
+ </Escoin_Ordermanage>
88
+ </modules>
89
+ </translate>
90
+ <events>
91
+ <adminhtml_block_html_before>
92
+ <observers>
93
+ <escoin_ordermanage>
94
+ <class>ordermanage/observer</class>
95
+ <method>addOptionToDelete</method>
96
+ </escoin_ordermanage>
97
+ </observers>
98
+ </adminhtml_block_html_before>
99
+ <sales_order_delete_after>
100
+ <observers>
101
+ <escoin_ordermanage>
102
+ <class>ordermanage/observer</class>
103
+ <method>deleteOrderFromGrid</method>
104
+ </escoin_ordermanage>
105
+ </observers>
106
+ </sales_order_delete_after>
107
+ </events>
108
+ </adminhtml>
109
+ <admin>
110
+ <routers>
111
+ <adminhtml>
112
+ <args>
113
+ <modules>
114
+ <Escoin_Ordermanage before="Mage_Adminhtml">Escoin_Ordermanage_Adminhtml</Escoin_Ordermanage>
115
+ </modules>
116
+ </args>
117
+ </adminhtml>
118
+ </routers>
119
+ </admin>
120
+ <default>
121
+ <ordermanage>
122
+ </ordermanage>
123
+ </default>
124
+ </config>
app/design/frontend/base/default/layout/escoin_ordermanage.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Escoin_Ordermanage extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Escoin
14
+ * @package Escoin_Ordermanage
15
+ * @copyright Copyright (c) 2014
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <layout>
20
+ <customer_account_index>
21
+ <reference name="customer_account_dashboard_top">
22
+ <action method="setTemplate"><template>escoin_ordermanage/sales/order/recent.phtml</template></action>
23
+ </reference>
24
+ </customer_account_index>
25
+ </layout>
app/etc/modules/Escoin_Ordermanage.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Escoin_Ordermanage extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the MIT License
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/mit-license.php
12
+ *
13
+ * @category Escoin
14
+ * @package Escoin_Ordermanage
15
+ * @copyright Copyright (c) 2014
16
+ * @license http://opensource.org/licenses/mit-license.php MIT License
17
+ */
18
+ -->
19
+ <config>
20
+ <modules>
21
+ <Escoin_Ordermanage>
22
+ <active>true</active>
23
+ <codePool>community</codePool>
24
+ <depends>
25
+ <Mage_Core />
26
+ </depends>
27
+ </Escoin_Ordermanage>
28
+ </modules>
29
+ </config>
app/locale/en_US/Escoin_Ordermanage.csv ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "",""
2
+ "Action","Action"
3
+ "Add Ordercancel","Add Ordercancel"
4
+ "Are you sure?","Are you sure?"
5
+ "CSV","CSV"
6
+ "Change status","Change status"
7
+ "Could not find ordercancel to delete.","Could not find ordercancel to delete."
8
+ "Delete Ordercancel","Delete Ordercancel"
9
+ "Delete","Delete"
10
+ "Disabled","Disabled"
11
+ "Edit Ordercancel '%s'","Edit Ordercancel '%s'"
12
+ "Edit","Edit"
13
+ "Enabled","Enabled"
14
+ "Excel","Excel"
15
+ "Home","Home"
16
+ "Id","Id"
17
+ "No","No"
18
+ "None","None"
19
+ "Ordercancel was successfully deleted.","Ordercancel was successfully deleted."
20
+ "Ordercancel was successfully saved","Ordercancel was successfully saved"
21
+ "Ordercancel","Ordercancel"
22
+ "Please select ordercancel to delete.","Please select ordercancel to delete."
23
+ "Please select ordercancel.","Please select ordercancel."
24
+ "Save And Continue Edit","Save And Continue Edit"
25
+ "Save Ordercancel","Save Ordercancel"
26
+ "Status","Status"
27
+ "Store views","Store views"
28
+ "There was a problem saving the ordercancel.","There was a problem saving the ordercancel."
29
+ "There was an error deleteing ordercancel.","There was an error deleteing ordercancel."
30
+ "There was an error updating ordercancel.","There was an error updating ordercancel."
31
+ "This ordercancel no longer exists.","This ordercancel no longer exists."
32
+ "Total of %d ordercancel were successfully deleted.","Total of %d ordercancel were successfully deleted."
33
+ "Total of %d ordercancel were successfully updated.","Total of %d ordercancel were successfully updated."
34
+ "Unable to find ordercancel to save.","Unable to find ordercancel to save."
35
+ "XML","XML"
36
+ "Yes","Yes"
37
+ "name","name"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>escoin_ordermanage</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/mit-license.php">MIT License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Escoin Ordermanage module to add delete functionality to magento</summary>
10
+ <description>Escoin Ordermanage module adds the functionality to delete orders in the admin end and the option for users to cancel their orders in the frontend.</description>
11
+ <notes>Escoin_Ordermanage ver 0.1.0 stable</notes>
12
+ <authors><author><name>Tarun Mukherjee</name><user>tmukherjee13</user><email>tmukherjee13@gmail.com</email></author></authors>
13
+ <date>2014-06-09</date>
14
+ <time>19:43:45</time>
15
+ <contents><target name="magecommunity"><dir name="Escoin"><dir name="Ordermanage"><dir name="Block"><dir name="Order"><file name="History.php" hash="1e58105669c01604fd57cdca07f0b28c"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Ordermanage"><file name="OrderController.php" hash="faf0708302e8b3529ecc29ab4f3ef525"/></dir></dir><file name="OrderController.php" hash="0084f51a0f19ab279b3f203e58d42e1b"/></dir><dir name="etc"><file name="config.xml" hash="259c642331b79a8c52b0cb28d81124fb"/></dir><dir name="Helper"><file name="Data.php" hash="52dc40aceed28ea0fad8ee885b02385a"/></dir><dir name="Model"><file name="Observer.php" hash="f6f75d978b2faa558840eee1000233ab"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Escoin_Ordermanage.xml" hash="3cdaee218f290b4dff9386cb8fa78c4f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="escoin_ordermanage.xml" hash="510f38130495a132f6bb211cd289bd56"/></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Escoin_Ordermanage.csv" hash="8c671e41dab92339bfb2e5917bbe3b7a"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>