Version Notes
Added custom order state and status for customer cancelled orders.
Download this release
Release Info
Developer | Escoin |
Extension | escoin_ordermanage |
Version | 0.4.0 |
Comparing to | |
See all releases |
Code changes from version 0.3.0 to 0.4.0
- app/code/community/Escoin/Ordermanage/Model/Resource/Setup.php +4 -0
- app/code/community/Escoin/Ordermanage/Model/System/Config/Order/State.php +13 -0
- app/code/community/Escoin/Ordermanage/controllers/OrderController.php +14 -3
- app/code/community/Escoin/Ordermanage/etc/config.xml +36 -1
- app/code/community/Escoin/Ordermanage/etc/system.xml +10 -0
- app/code/community/Escoin/Ordermanage/sql/ordermanage_setup/mysql4-install-0.4.0.php +57 -0
- package.xml +5 -5
app/code/community/Escoin/Ordermanage/Model/Resource/Setup.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Escoin_Ordermanage_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
|
4 |
+
}
|
app/code/community/Escoin/Ordermanage/Model/System/Config/Order/State.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Escoin_Ordermanage_Model_System_Config_Order_State
|
3 |
+
{
|
4 |
+
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 0, 'label' => Mage::helper('ordermanage')->__('Only cancellable orders')),
|
9 |
+
array('value' => 1, 'label' => Mage::helper('ordermanage')->__('All orders')),
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
app/code/community/Escoin/Ordermanage/controllers/OrderController.php
CHANGED
@@ -20,6 +20,8 @@
|
|
20 |
*/
|
21 |
class Escoin_Ordermanage_OrderController extends Mage_Core_Controller_Front_Action
|
22 |
{
|
|
|
|
|
23 |
/**
|
24 |
* Handles cancel order action
|
25 |
*/
|
@@ -27,12 +29,21 @@ class Escoin_Ordermanage_OrderController extends Mage_Core_Controller_Front_Acti
|
|
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 |
-
|
|
|
|
|
36 |
$order->save();
|
37 |
Mage::getSingleton('core/session')->addSuccess($this->__("Order was successfully cancelled."));
|
38 |
}
|
20 |
*/
|
21 |
class Escoin_Ordermanage_OrderController extends Mage_Core_Controller_Front_Action
|
22 |
{
|
23 |
+
|
24 |
+
|
25 |
/**
|
26 |
* Handles cancel order action
|
27 |
*/
|
29 |
{
|
30 |
$orderId = $this->getRequest()->get('order_id');
|
31 |
|
32 |
+
|
33 |
+
//var_dump(Mage_Sales_Model_Order::STATE_CANCELLED);die;
|
34 |
// Load order
|
35 |
if(!empty($orderId)) {
|
36 |
+
//$comment = "Order {$orderId} has been cancelled by user.";
|
37 |
+
$comment = "";
|
38 |
+
$state = 'customer_cancelled';
|
39 |
+
$status = 'customer_cancelled';
|
40 |
+
$isCustomerNotified = true;
|
41 |
+
|
42 |
+
|
43 |
$order = Mage::getModel('sales/order')->load($orderId);
|
44 |
+
//$order->setState(Mage_Sales_Model_Order::STATE_CUSTOMER_CANCELLED, true);
|
45 |
+
$order->setState($state, $status, $comment, $isCustomerNotified);
|
46 |
+
$order->sendOrderUpdateEmail(true, $comment);
|
47 |
$order->save();
|
48 |
Mage::getSingleton('core/session')->addSuccess($this->__("Order was successfully cancelled."));
|
49 |
}
|
app/code/community/Escoin/Ordermanage/etc/config.xml
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Escoin_Ordermanage>
|
22 |
-
<version>0.
|
23 |
</Escoin_Ordermanage>
|
24 |
</modules>
|
25 |
<global>
|
@@ -51,6 +51,41 @@
|
|
51 |
<to><![CDATA[/ordermanage/order/cancel/$1]]></to>
|
52 |
</escoin_ordermanage>
|
53 |
</rewrite>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
</global>
|
55 |
<frontend>
|
56 |
<routers>
|
19 |
<config>
|
20 |
<modules>
|
21 |
<Escoin_Ordermanage>
|
22 |
+
<version>0.4.0</version>
|
23 |
</Escoin_Ordermanage>
|
24 |
</modules>
|
25 |
<global>
|
51 |
<to><![CDATA[/ordermanage/order/cancel/$1]]></to>
|
52 |
</escoin_ordermanage>
|
53 |
</rewrite>
|
54 |
+
|
55 |
+
<resources>
|
56 |
+
<ordermanage_setup>
|
57 |
+
<setup>
|
58 |
+
<module>Escoin_Ordermanage</module>
|
59 |
+
<class>Escoin_Ordermanage_Model_Resource_Setup</class>
|
60 |
+
</setup>
|
61 |
+
</ordermanage_setup>
|
62 |
+
</resources>
|
63 |
+
|
64 |
+
<sales>
|
65 |
+
<order>
|
66 |
+
|
67 |
+
<statuses>
|
68 |
+
<customer_cancelled translate="label">
|
69 |
+
<label>Cancelled by Customer</label>
|
70 |
+
<visible_on_front>1</visible_on_front>
|
71 |
+
</customer_cancelled>
|
72 |
+
</statuses>
|
73 |
+
|
74 |
+
|
75 |
+
<states>
|
76 |
+
<customer_cancelled translate="label">
|
77 |
+
<label>Cancelled by Customer</label>
|
78 |
+
<statuses>
|
79 |
+
<customer_cancelled default="1"/>
|
80 |
+
</statuses>
|
81 |
+
<visible_on_front>1</visible_on_front>
|
82 |
+
</customer_cancelled>
|
83 |
+
|
84 |
+
</states>
|
85 |
+
|
86 |
+
</order>
|
87 |
+
</sales>
|
88 |
+
|
89 |
</global>
|
90 |
<frontend>
|
91 |
<routers>
|
app/code/community/Escoin/Ordermanage/etc/system.xml
CHANGED
@@ -42,6 +42,16 @@
|
|
42 |
<source_model>ordermanage/system_config_order_type</source_model>
|
43 |
<sort_order>20</sort_order>
|
44 |
</orderstate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</fields>
|
46 |
</frontend>
|
47 |
</groups>
|
42 |
<source_model>ordermanage/system_config_order_type</source_model>
|
43 |
<sort_order>20</sort_order>
|
44 |
</orderstate>
|
45 |
+
<!-- <cancelstate>
|
46 |
+
<label>Cancelled order state</label>
|
47 |
+
<comment>Status of orders cancelled by user.</comment>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>0</show_in_store>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>ordermanage/system_config_order_state</source_model>
|
53 |
+
<sort_order>20</sort_order>
|
54 |
+
</cancelstate> -->
|
55 |
</fields>
|
56 |
</frontend>
|
57 |
</groups>
|
app/code/community/Escoin/Ordermanage/sql/ordermanage_setup/mysql4-install-0.4.0.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
// $installer->addAttribute(
|
7 |
+
// 'order',
|
8 |
+
// 'is_cancelled',
|
9 |
+
// array(
|
10 |
+
// 'type' => 'int',
|
11 |
+
// 'default' => 0,
|
12 |
+
// 'grid' => true,
|
13 |
+
// 'unsigned' => true,
|
14 |
+
// )
|
15 |
+
// );
|
16 |
+
|
17 |
+
|
18 |
+
// Required tables
|
19 |
+
$statusTable = $installer->getTable('sales/order_status');
|
20 |
+
$statusStateTable = $installer->getTable('sales/order_status_state');
|
21 |
+
|
22 |
+
// Insert statuses
|
23 |
+
$installer->getConnection()->insertArray(
|
24 |
+
$statusTable,
|
25 |
+
array(
|
26 |
+
'status',
|
27 |
+
'label'
|
28 |
+
),
|
29 |
+
array(
|
30 |
+
|
31 |
+
array('status' => 'customer_cancelled', 'label' => 'Cancelled By Customer')
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
// Insert states and mapping of statuses to states
|
36 |
+
$installer->getConnection()->insertArray(
|
37 |
+
$statusStateTable,
|
38 |
+
array(
|
39 |
+
'status',
|
40 |
+
'state',
|
41 |
+
'is_default',
|
42 |
+
//'visible_on_front'
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
array(
|
46 |
+
'status' => 'customer_cancelled',
|
47 |
+
'state' => 'customer_cancelled',
|
48 |
+
'is_default' => 1,
|
49 |
+
//'visible_on_front' => 1
|
50 |
+
|
51 |
+
),
|
52 |
+
)
|
53 |
+
);
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
$installer->endSetup();
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>escoin_ordermanage</name>
|
4 |
-
<version>0.
|
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>Added
|
12 |
<authors><author><name>Escoin</name><user>escoin</user><email>info@espot.co.in</email></author></authors>
|
13 |
-
<date>2014-
|
14 |
-
<time>07:
|
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="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>escoin_ordermanage</name>
|
4 |
+
<version>0.4.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>Added custom order state and status for customer cancelled orders.</notes>
|
12 |
<authors><author><name>Escoin</name><user>escoin</user><email>info@espot.co.in</email></author></authors>
|
13 |
+
<date>2014-08-09</date>
|
14 |
+
<time>07:21:56</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="Helper"><file name="Data.php" hash="5d2b38816660bb7e3474048e763a8d24"/></dir><dir name="Model"><file name="Observer.php" hash="f6f75d978b2faa558840eee1000233ab"/><dir name="Resource"><file name="Setup.php" hash="34bc3d175ddf93875156321e579ee9c9"/></dir><dir name="System"><dir name="Config"><dir name="Order"><file name="State.php" hash="30b8d656684757ac0ef7d4000935a137"/><file name="Type.php" hash="76c109b72a3541454ab3cd682cddcaa0"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Ordermanage"><file name="OrderController.php" hash="faf0708302e8b3529ecc29ab4f3ef525"/></dir></dir><file name="OrderController.php" hash="cdff086143ddbe7b8f3e46bc331bf6ff"/></dir><dir name="etc"><file name="config.xml" hash="41fb971224d49d9cc94ef9d73e433029"/><file name="system.xml" hash="b933407ea59ca72c989d8f26e64ae8ae"/></dir><dir name="sql"><dir name="ordermanage_setup"><file name="mysql4-install-0.4.0.php" hash="cf0442e4160ee008f373562893e2f265"/></dir></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 name="template"><dir name="escoin_ordermanage"><dir name="sales"><dir name="order"><file name="history.phtml" hash="0d7062861fb13c21c1bcafc6a0cd725a"/><file name="recent.phtml" hash="d1cb95088a25806cd8b9dcc38c31ff3a"/></dir></dir></dir></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>
|