OrderMonitor - Version 1.2.0

Version Notes

N/A

Download this release

Release Info

Developer Sławomir Iwańczuk
Extension OrderMonitor
Version 1.2.0
Comparing to
See all releases


Version 1.2.0

app/code/community/Mage/OrderMonitor/Block/Info.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ class Mage_OrderMonitor_Block_Info
20
+ extends Mage_Adminhtml_Block_Abstract
21
+ implements Varien_Data_Form_Element_Renderer_Interface
22
+ {
23
+ protected $_template = 'ordermonitor/info.phtml';
24
+
25
+ public function render(Varien_Data_Form_Element_Abstract $element)
26
+ {
27
+ return $this->toHtml();
28
+ }
29
+ }
app/code/community/Mage/OrderMonitor/Helper/Data.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ class Mage_OrderMonitor_Helper_Data
20
+ extends Mage_Core_Helper_Abstract
21
+ {
22
+ const XML_PATH_CUSTOMER_CANCEL_NEW = 'ordermonitor/customer/cancel_new';
23
+ const XML_PATH_CUSTOMER_CANCEL_PENDING = 'ordermonitor/customer/cancel_pending';
24
+
25
+ const XML_PATH_CRON_CANCEL_PENDING = 'ordermonitor/cron/cancel_pending';
26
+ const XML_PATH_CRON_CANCEL_AFTER = 'ordermonitor/cron/cancel_after';
27
+
28
+ public function getCustomerCancelNew($store = null)
29
+ {
30
+ return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMER_CANCEL_NEW, $store);
31
+ }
32
+
33
+ public function getCustomerCancelPending($store = null)
34
+ {
35
+ return Mage::getStoreConfigFlag(self::XML_PATH_CUSTOMER_CANCEL_PENDING, $store);
36
+ }
37
+
38
+ public function getCronCancelPending($store = null)
39
+ {
40
+ return Mage::getStoreConfigFlag(self::XML_PATH_CRON_CANCEL_PENDING, $store);
41
+ }
42
+
43
+ public function getCronCancelAfter($store = null)
44
+ {
45
+ return Mage::getStoreConfig(self::XML_PATH_CRON_CANCEL_AFTER, $store);
46
+ }
47
+
48
+ public function canCancel(Mage_Sales_Model_Order $order)
49
+ {
50
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW
51
+ && $this->getCustomerCancelNew($order->getStore())) {
52
+ return $order->canCancel();
53
+ }
54
+
55
+ if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT
56
+ && $this->getCustomerCancelPending($order->getStore())) {
57
+ return $order->canCancel();
58
+ }
59
+
60
+ return false;
61
+ }
62
+ }
app/code/community/Mage/OrderMonitor/Model/Cron.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ class Mage_OrderMonitor_Model_Cron
20
+ {
21
+ public function run()
22
+ {
23
+ $stores = Mage::getModel('core/store')
24
+ ->getCollection()
25
+ ->addFieldToFilter('store_id', array('neq' => Mage_Core_Model_App::ADMIN_STORE_ID));
26
+
27
+ foreach ($stores as $store) {
28
+ if (!Mage::helper('ordermonitor')->getCronCancelPending($store)) {
29
+ continue;
30
+ }
31
+
32
+ if (!intval(Mage::helper('ordermonitor')->getCronCancelAfter($store))) {
33
+ continue;
34
+ }
35
+
36
+ $orders = Mage::getModel('sales/order')
37
+ ->getCollection()
38
+ ->addFieldToFilter('store_id', $store->getStoreId())
39
+ ->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)
40
+ ->addFieldToFilter('created_at', array('lt' => new Zend_Db_Expr("DATE_ADD('" . now() . "', INTERVAL -'" . intval(Mage::helper('ordermonitor')->getCronCancelAfter($store)) . "' MINUTE)")))
41
+ ->setCurPage(1)
42
+ ->setPageSize(10);
43
+
44
+ foreach ($orders as $order) {
45
+ if(!$order->canCancel()) {
46
+ continue;
47
+ }
48
+
49
+ $order->cancel();
50
+
51
+ $order->getStatusHistoryCollection()
52
+ ->getLastItem()
53
+ ->setComment(Mage::helper('ordermonitor')->__('Payment Expired.'));
54
+
55
+ $order->save();
56
+ }
57
+ }
58
+ }
59
+ }
app/code/community/Mage/OrderMonitor/controllers/OrderController.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ class Mage_OrderMonitor_OrderController
20
+ extends Mage_Core_Controller_Front_Action
21
+ {
22
+ public function preDispatch()
23
+ {
24
+ parent::preDispatch();
25
+
26
+ $action = $this->getRequest()->getActionName();
27
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
28
+
29
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
30
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
31
+ }
32
+ }
33
+
34
+ public function cancelAction()
35
+ {
36
+ $order = Mage::getModel('sales/order')->load(
37
+ $this->getRequest()->getParam('order_id')
38
+ );
39
+
40
+ if ($order->getId()) {
41
+ if ($order->getCustomerId() == Mage::getSingleton('customer/session')->getCustomerId()) {
42
+ if (in_array($order->getState(), Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates(), $strict = true)) {
43
+ if (Mage::helper('ordermonitor')->canCancel($order)) {
44
+ try {
45
+ $order->cancel();
46
+
47
+ $order->getStatusHistoryCollection()
48
+ ->getLastItem()
49
+ ->setComment($this->__('Canceled by Customer.'));
50
+
51
+ $order->save();
52
+
53
+ Mage::getSingleton('catalog/session')
54
+ ->addSuccess($this->__('Your order has been canceled.'));
55
+ } catch (Exception $e) {
56
+ Mage::getSingleton('catalog/session')
57
+ ->addException($e, $this->__('Cannot cancel your order.'));
58
+ }
59
+ } else {
60
+ Mage::getSingleton('catalog/session')
61
+ ->addError($this->__('Cannot cancel your order.'));
62
+ }
63
+
64
+ $this->_redirect('sales/order/history');
65
+
66
+ return;
67
+ }
68
+ }
69
+ }
70
+
71
+ $this->_forward('noRoute');
72
+ }
73
+ }
app/code/community/Mage/OrderMonitor/etc/config.xml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Copyright (C) 2011 Slawomir Iwanczuk
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ -->
20
+ <config>
21
+ <modules>
22
+ <Mage_OrderMonitor>
23
+ <version>1.2.0</version>
24
+ </Mage_OrderMonitor>
25
+ </modules>
26
+ <crontab>
27
+ <jobs>
28
+ <ordermonitor_cron>
29
+ <schedule>
30
+ <cron_expr>*/5 * * * *</cron_expr>
31
+ </schedule>
32
+ <run>
33
+ <model>ordermonitor/cron::run</model>
34
+ </run>
35
+ </ordermonitor_cron>
36
+ </jobs>
37
+ </crontab>
38
+ <global>
39
+ <models>
40
+ <ordermonitor>
41
+ <class>Mage_OrderMonitor_Model</class>
42
+ </ordermonitor>
43
+ </models>
44
+ <blocks>
45
+ <ordermonitor>
46
+ <class>Mage_OrderMonitor_Block</class>
47
+ </ordermonitor>
48
+ </blocks>
49
+ <helpers>
50
+ <ordermonitor>
51
+ <class>Mage_OrderMonitor_Helper</class>
52
+ </ordermonitor>
53
+ </helpers>
54
+ <sales>
55
+ <order>
56
+ <states>
57
+ <pending_payment>
58
+ <visible_on_front>1</visible_on_front>
59
+ </pending_payment>
60
+ </states>
61
+ </order>
62
+ </sales>
63
+ </global>
64
+ <adminhtml>
65
+ <translate>
66
+ <modules>
67
+ <Mage_OrderMonitor>
68
+ <files>
69
+ <default>Mage_OrderMonitor.csv</default>
70
+ </files>
71
+ </Mage_OrderMonitor>
72
+ </modules>
73
+ </translate>
74
+ <acl>
75
+ <resources>
76
+ <admin>
77
+ <children>
78
+ <system>
79
+ <children>
80
+ <config>
81
+ <children>
82
+ <ordermonitor translate="title" module="ordermonitor">
83
+ <title>OrderMonitor</title>
84
+ <sort_order>0</sort_order>
85
+ </ordermonitor>
86
+ </children>
87
+ </config>
88
+ </children>
89
+ </system>
90
+ </children>
91
+ </admin>
92
+ </resources>
93
+ </acl>
94
+ </adminhtml>
95
+ <frontend>
96
+ <routers>
97
+ <sales>
98
+ <args>
99
+ <modules>
100
+ <Mage_OrderMonitor before="Mage_Sales">Mage_OrderMonitor</Mage_OrderMonitor>
101
+ </modules>
102
+ </args>
103
+ </sales>
104
+ </routers>
105
+ <translate>
106
+ <modules>
107
+ <Mage_OrderMonitor>
108
+ <files>
109
+ <default>Mage_OrderMonitor.csv</default>
110
+ </files>
111
+ </Mage_OrderMonitor>
112
+ </modules>
113
+ </translate>
114
+ <layout>
115
+ <updates>
116
+ <ordermonitor module="Mage_OrderMonitor">
117
+ <file>ordermonitor.xml</file>
118
+ </ordermonitor>
119
+ </updates>
120
+ </layout>
121
+ </frontend>
122
+ <default>
123
+ <ordermonitor>
124
+ <customer>
125
+ <cancel_new>0</cancel_new>
126
+ <cancel_pending>0</cancel_pending>
127
+ </customer>
128
+ <cron>
129
+ <cancel_pending>0</cancel_pending>
130
+ <cancel_after>120</cancel_after>
131
+ </cron>
132
+ </ordermonitor>
133
+ </default>
134
+ </config>
app/code/community/Mage/OrderMonitor/etc/system.xml ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Copyright (C) 2011 Slawomir Iwanczuk
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ -->
20
+ <config>
21
+ <sections>
22
+ <ordermonitor translate="label" module="ordermonitor">
23
+ <label>OrderMonitor</label>
24
+ <tab>sales</tab>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>1000</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ <groups>
31
+ <info>
32
+ <frontend_model>ordermonitor/info</frontend_model>
33
+ <sort_order>0</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </info>
38
+ <customer translate="label">
39
+ <label>Customer Settings</label>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>10</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <fields>
46
+ <cancel_new translate="label">
47
+ <label>Allow Customers to Cancel New Orders</label>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>10</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </cancel_new>
55
+ <cancel_pending translate="label">
56
+ <label>Allow Customers to Cancel Pending Payment Orders</label>
57
+ <frontend_type>select</frontend_type>
58
+ <source_model>adminhtml/system_config_source_yesno</source_model>
59
+ <sort_order>20</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </cancel_pending>
64
+ </fields>
65
+ </customer>
66
+ <cron translate="label">
67
+ <label>Cron Settings</label>
68
+ <frontend_type>text</frontend_type>
69
+ <sort_order>20</sort_order>
70
+ <show_in_default>1</show_in_default>
71
+ <show_in_website>1</show_in_website>
72
+ <show_in_store>1</show_in_store>
73
+ <fields>
74
+ <cancel_pending translate="label">
75
+ <label>Cancel Pending Payment Orders</label>
76
+ <frontend_type>select</frontend_type>
77
+ <source_model>adminhtml/system_config_source_yesno</source_model>
78
+ <sort_order>10</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </cancel_pending>
83
+ <cancel_after translate="label">
84
+ <label>Cancel Pending Payment Orders After (minutes)</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>20</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </cancel_after>
91
+ </fields>
92
+ </cron>
93
+ </groups>
94
+ </ordermonitor>
95
+ </sections>
96
+ </config>
app/design/adminhtml/default/default/template/ordermonitor/info.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ ?>
19
+ <fieldset class="config"><?php echo $this->__('OrderMonitor is free, open-source software. If you want to make it better, contribute to the project or make a donation!') ?></fieldset>
app/design/frontend/base/default/layout/ordermonitor.xml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Copyright (C) 2011 Slawomir Iwanczuk
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ -->
20
+ <layout version="0.1.0">
21
+ <customer_account_index>
22
+ <reference name="customer_account_dashboard_top">
23
+ <action method="setTemplate">
24
+ <template>ordermonitor/recent.phtml</template>
25
+ </action>
26
+ </reference>
27
+ <reference name="head">
28
+ <action method="addCss">
29
+ <stylesheet>css/ordermonitor/styles.css</stylesheet>
30
+ </action>
31
+ </reference>
32
+ </customer_account_index>
33
+ <sales_order_history>
34
+ <reference name="sales.order.history">
35
+ <action method="setTemplate">
36
+ <template>ordermonitor/history.phtml</template>
37
+ </action>
38
+ </reference>
39
+ <reference name="head">
40
+ <action method="addCss">
41
+ <stylesheet>css/ordermonitor/styles.css</stylesheet>
42
+ </action>
43
+ </reference>
44
+ </sales_order_history>
45
+ <sales_order_view>
46
+ <reference name="sales.order.info.buttons">
47
+ <action method="setTemplate">
48
+ <template>ordermonitor/buttons.phtml</template>
49
+ </action>
50
+ </reference>
51
+ <reference name="head">
52
+ <action method="addCss">
53
+ <stylesheet>css/ordermonitor/styles.css</stylesheet>
54
+ </action>
55
+ </reference>
56
+ </sales_order_view>
57
+ </layout>
app/design/frontend/base/default/template/ordermonitor/buttons.phtml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ ?>
19
+
20
+ <?php $_order = $this->getOrder() ?>
21
+ <?php if($this->helper('rss/order')->isStatusNotificationAllow()): ?>
22
+ <a href="<?php echo $this->helper('rss/order')->getStatusHistoryRssUrl($_order) ?>" class="link-rss f-none"><?php echo $this->__('Subscribe to Order Status') ?></a>
23
+ <span class="separator">|</span>
24
+ <?php endif; ?>
25
+ <?php if ($this->helper('sales/reorder')->canReorder($_order)) : ?>
26
+ <a href="<?php echo $this->getReorderUrl($_order) ?>" class="link-reorder"><?php echo $this->__('Reorder') ?></a>
27
+ <span class="separator">|</span>
28
+ <?php endif ?>
29
+ <?php if ($this->helper('ordermonitor')->canCancel($_order)) : ?>
30
+ <a href="<?php echo $this->getUrl('sales/order/cancel', array('order_id' => $_order->getId())) ?>" class="link-cancel"><?php echo $this->__('Cancel') ?></a>
31
+ <span class="separator">|</span>
32
+ <?php endif ?>
33
+ <a href="<?php echo $this->getPrintUrl($_order) ?>" class="link-print" onclick="this.target='_blank';"><?php echo $this->__('Print Order') ?></a>
34
+ <?php echo $this->getChildHtml(); ?>
app/design/frontend/base/default/template/ordermonitor/history.phtml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ ?>
19
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
20
+ <?php $_orders = $this->getOrders(); ?>
21
+ <div class="page-title">
22
+ <h1><?php echo $this->__('My Orders') ?></h1>
23
+ </div>
24
+ <?php echo $this->getPagerHtml(); ?>
25
+ <?php if($_orders->getSize()): ?>
26
+ <table class="data-table" id="my-orders-table">
27
+ <col width="1" />
28
+ <col width="1" />
29
+ <col />
30
+ <col width="1" />
31
+ <col width="1" />
32
+ <col width="1" />
33
+ <thead>
34
+ <tr>
35
+ <th><?php echo $this->__('Order #') ?></th>
36
+ <th><?php echo $this->__('Date') ?></th>
37
+ <th><?php echo $this->__('Ship To') ?></th>
38
+ <th><span class="nobr"><?php echo $this->__('Order Total') ?></span></th>
39
+ <th><span class="nobr"><?php echo $this->__('Order Status') ?></span></th>
40
+ <th>&nbsp;</th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <?php $_odd = ''; ?>
45
+ <?php foreach ($_orders as $_order): ?>
46
+ <tr>
47
+ <td><?php echo $_order->getRealOrderId() ?></td>
48
+ <td><span class="nobr"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></span></td>
49
+ <td><?php echo $_order->getShippingAddress() ? $this->htmlEscape($_order->getShippingAddress()->getName()) : '&nbsp;' ?></td>
50
+ <td><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td>
51
+ <td><em><?php echo $_order->getStatusLabel() ?></em></td>
52
+ <td class="a-center">
53
+ <span class="nobr"><a href="<?php echo $this->getViewUrl($_order) ?>"><?php echo $this->__('View Order') ?></a>
54
+ <?php /*<span class="separator">|</span><a href="<?php echo $this->getTrackUrl($_order) ?>"><?php echo $this->__('Track Order') ?></a>&nbsp;*/ ?>
55
+ <?php if ($this->helper('sales/reorder')->canReorder($_order)) : ?>
56
+ <span class="separator">|</span> <a href="<?php echo $this->getReorderUrl($_order) ?>" class="link-reorder"><?php echo $this->__('Reorder') ?></a>
57
+ <?php endif ?>
58
+ <?php if ($this->helper('ordermonitor')->canCancel($_order)) : ?>
59
+ <span class="separator">|</span> <a href="<?php echo $this->getUrl('sales/order/cancel', array('order_id' => $_order->getId())) ?>" class="link-cancel"><?php echo $this->__('Cancel') ?></a>
60
+ <?php endif ?>
61
+ </span>
62
+ </td>
63
+ </tr>
64
+ <?php endforeach; ?>
65
+ </tbody>
66
+ </table>
67
+ <script type="text/javascript">decorateTable('my-orders-table');</script>
68
+ <?php echo $this->getPagerHtml(); ?>
69
+ <?php else: ?>
70
+ <p><?php echo $this->__('You have placed no orders.'); ?></p>
71
+ <?php endif ?>
app/design/frontend/base/default/template/ordermonitor/recent.phtml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (C) 2011 Slawomir Iwanczuk
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ ?>
19
+ <div class="box-account box-recent">
20
+ <?php $_orders = $this->getOrders(); ?>
21
+ <div class="box-head">
22
+ <h2><?php echo $this->__('Recent Orders') ?></h2>
23
+ <?php if( sizeof($_orders->getItems()) > 0 ): ?><a href="<?php echo $this->getUrl('sales/order/history') ?>"><?php echo $this->__('View All') ?></a><?php endif; ?>
24
+ </div>
25
+ <?php if( sizeof($_orders->getItems()) > 0 ): ?>
26
+ <table class="data-table" id="my-orders-table">
27
+ <col width="1" />
28
+ <col width="1" />
29
+ <col />
30
+ <col width="1" />
31
+ <col width="1" />
32
+ <col width="1" />
33
+ <thead>
34
+ <tr>
35
+ <th><?php echo $this->__('Order #') ?></th>
36
+ <th><?php echo $this->__('Date') ?></th>
37
+ <th><?php echo $this->__('Ship To') ?></th>
38
+ <th><span class="nobr"><?php echo $this->__('Order Total') ?></span></th>
39
+ <th><?php echo $this->__('Status') ?></th>
40
+ <th>&nbsp;</th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <?php foreach ($_orders as $_order): ?>
45
+ <tr>
46
+ <td><?php echo $_order->getRealOrderId() ?></td>
47
+ <td><span class="nobr"><?php echo $this->formatDate($_order->getCreatedAtStoreDate()) ?></span></td>
48
+ <td><?php echo $_order->getShippingAddress() ? $this->htmlEscape($_order->getShippingAddress()->getName()) : '&nbsp;' ?></td>
49
+ <td><?php echo $_order->formatPrice($_order->getGrandTotal()) ?></td>
50
+ <td><em><?php echo $_order->getStatusLabel() ?></em></td>
51
+ <td class="a-center">
52
+ <span class="nobr">
53
+ <a href="<?php echo $this->getViewUrl($_order) ?>"><?php echo $this->__('View Order') ?></a>
54
+ <?php if ($this->helper('sales/reorder')->canReorder($_order)) : ?>
55
+ <span class="separator">|</span> <a href="<?php echo $this->getReorderUrl($_order) ?>" class="link-reorder"><?php echo $this->__('Reorder') ?></a>
56
+ <?php endif ?>
57
+ <?php if ($this->helper('ordermonitor')->canCancel($_order)) : ?>
58
+ <span class="separator">|</span> <a href="<?php echo $this->getUrl('sales/order/cancel', array('order_id' => $_order->getId())) ?>" class="link-cancel"><?php echo $this->__('Cancel') ?></a>
59
+ <?php endif ?>
60
+ </span>
61
+ </td>
62
+ </tr>
63
+ <?php endforeach; ?>
64
+ </tbody>
65
+ </table>
66
+ <script type="text/javascript">decorateTable('my-orders-table')</script>
67
+ <?php else: ?>
68
+ <p><?php echo $this->__('You have placed no orders.'); ?></p>
69
+ <?php endif; ?>
70
+ </div>
app/etc/modules/Mage_OrderMonitor.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Copyright (C) 2011 Slawomir Iwanczuk
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ */
19
+ -->
20
+ <config>
21
+ <modules>
22
+ <Mage_OrderMonitor>
23
+ <active>true</active>
24
+ <codePool>community</codePool>
25
+ </Mage_OrderMonitor>
26
+ </modules>
27
+ </config>
app/locale/en_US/Mage_OrderMonitor.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "OrderMonitor","OrderMonitor"
2
+ "Customer Settings","Customer Settings"
3
+ "Allow Customers to Cancel New Orders","Allow Customers to Cancel New Orders"
4
+ "Allow Customers to Cancel Pending Payment Orders","Allow Customers to Cancel Pending Payment Orders"
5
+ "Select Status for Canceled Orders","Select Status for Canceled Orders"
6
+ "Cron Settings","Cron Settings"
7
+ "Cancel Pending Payment Orders","Cancel Pending Payment Orders"
8
+ "Cancel Pending Payment Orders After (minutes)","Cancel Pending Payment Orders After (minutes)"
9
+ "Payment Expired.","Payment Expired."
10
+ "Canceled by Customer.","Canceled by Customer."
11
+ "Your order has been canceled.","Your order has been canceled."
12
+ "Cannot cancel your order.","Cannot cancel your order."
13
+ "OrderMonitor is free, open-source software. If you want to make it better, contribute to the project or make a donation!","OrderMonitor is free, open-source software. If you want to make it better, contribute to the project or make a donation!"
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>OrderMonitor</name>
4
+ <version>1.2.0</version>
5
+ <stability>stable</stability>
6
+ <license>GPL v3</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Cancel unwanted orders automatically.</summary>
10
+ <description>From time to time your orders stay as unfinished for a long time. This usually happen when the customer did not complete payment for unknown reason.&#xD;
11
+ &#xD;
12
+ This extension allows your customers to cancel unwanted orders as well as automatically cancel unfinished pending payment orders to keep your store in consistent state.</description>
13
+ <notes>N/A</notes>
14
+ <authors><author><name>S&#x142;awomir Iwa&#x144;czuk</name><user>ART3GA</user><email>slawomir@iwanczuk.co</email></author></authors>
15
+ <date>2011-10-06</date>
16
+ <time>08:59:16</time>
17
+ <contents><target name="magecommunity"><dir name="Mage"><dir name="OrderMonitor"><dir name="Block"><file name="Info.php" hash="27f1e1b72fe8d39fbdf2382e299fd4c0"/></dir><dir name="Helper"><file name="Data.php" hash="6d1e41f88f790a0848f835b020c9de47"/></dir><dir name="Model"><file name="Cron.php" hash="7b16b57c8cdf8784388ec7f0b23d5159"/></dir><dir name="controllers"><file name="OrderController.php" hash="ff2b375890826ea60e81802caa3a5e08"/></dir><dir name="etc"><file name="config.xml" hash="f00a0beda62c7d234fccd2b51c02c091"/><file name="system.xml" hash="35de2ac9cbc3f814b8d8706fd727749d"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="ordermonitor"><file name="info.phtml" hash="bdcc5980f439cd773b9c79babcd12c53"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ordermonitor.xml" hash="3e3754bfc4d34d99c1e556d93ceef4aa"/></dir><dir name="template"><dir name="ordermonitor"><file name="buttons.phtml" hash="8702b9e6c0d1aa95b5e7f1a5f4d08749"/><file name="history.phtml" hash="f9c6f5d7aa9f7a0f64c817f6f069eff6"/><file name="recent.phtml" hash="d6adc7aebfc3bf7d9c54ff7e93cf92b7"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_OrderMonitor.xml" hash="0e6e19ba0558bec52e258727d0896016"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Mage_OrderMonitor.csv" hash="eee87e33c95340231c637ec388c7ea14"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="ordermonitor"><file name="styles.css" hash="3204ec41c42379a836a08eceaa141fa2"/></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>core</channel><min>1.6.0.0</min><max>1.6.1.0</max></package></required></dependencies>
20
+ </package>
skin/frontend/default/default/css/ordermonitor/styles.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Copyright (C) 2011 Slawomir Iwanczuk
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ .link-cancel {
19
+ color: #DC6809 !important;
20
+ font-weight: bold;
21
+ }