9wcVR4bIlRVxfPN0 - Version 1.0.1

Version Notes

This is to display the order report statistic summary on our website.

Download this release

Release Info

Developer e-Storeinfo
Extension 9wcVR4bIlRVxfPN0
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Estoreinfo/Report/controllers/IndexController.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Estoreinfo_Report_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $orders = array();
7
+ $resource = Mage::getSingleton('core/resource');
8
+ $readConnection = $resource->getConnection('core_read');
9
+ $order_table = $resource->getTableName('sales/order');
10
+ $creditmemo_table = $resource->getTableName('sales/creditmemo');
11
+
12
+ /*get all records*/
13
+ $orders['all']['total'] = Mage::getModel('sales/order')->getCollection()->getSize();
14
+ $orders['all']['cancelled'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CANCELED )->getSize();
15
+ $orders['all']['refunded'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CLOSED)->getSize();
16
+
17
+ $query = 'SELECT count(*) total_ontime FROM ' . $order_table . " WHERE HOUR(TIMEDIFF(created_at, updated_at)) < 48 AND state = '".Mage_Sales_Model_Order::STATE_COMPLETE."' LIMIT 1";
18
+ $orders['all']['ontime_shipment'] = $readConnection->fetchOne($query);
19
+
20
+ $query = 'SELECT count(*) total_return FROM ' . $creditmemo_table . " WHERE 1 LIMIT 1";
21
+ $orders['all']['returns'] = $readConnection->fetchOne($query);
22
+
23
+ /*get 30 days records*/
24
+ $fromDate = date('Y-m-d H:i:s', strtotime('-30 days'));
25
+ $orders['30_days']['total'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
26
+ $orders['30_days']['cancelled'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CANCELED )->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
27
+ $orders['30_days']['refunded'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CLOSED)->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
28
+
29
+ $query = 'SELECT count(*) total_ontime FROM ' . $order_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 30 DAY) AND HOUR(TIMEDIFF(created_at, updated_at)) < 48 AND state = '".Mage_Sales_Model_Order::STATE_COMPLETE."' LIMIT 1";
30
+ $orders['30_days']['ontime_shipment'] = $readConnection->fetchOne($query);
31
+
32
+ $query = 'SELECT count(*) total_return FROM ' . $creditmemo_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 30 DAY) LIMIT 1";
33
+ $orders['30_days']['returns'] = $readConnection->fetchOne($query);
34
+
35
+ /*get 90 days records*/
36
+ $fromDate = date('Y-m-d H:i:s', strtotime('-90 days'));
37
+ $orders['90_days']['total'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
38
+ $orders['90_days']['cancelled'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CANCELED )->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
39
+ $orders['90_days']['refunded'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CLOSED)->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
40
+
41
+ $query = 'SELECT count(*) total_ontime FROM ' . $order_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 90 DAY) AND HOUR(TIMEDIFF(created_at, updated_at)) < 48 AND state = '".Mage_Sales_Model_Order::STATE_COMPLETE."' LIMIT 1";
42
+ $orders['90_days']['ontime_shipment'] = $readConnection->fetchOne($query);
43
+
44
+ $query = 'SELECT count(*) total_return FROM ' . $creditmemo_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 90 DAY) LIMIT 1";
45
+ $orders['90_days']['returns'] = $readConnection->fetchOne($query);
46
+
47
+ /*get 1 year records*/
48
+ $fromDate = date('Y-m-d H:i:s', strtotime('-1 year'));
49
+ $orders['1_year']['total'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
50
+ $orders['1_year']['cancelled'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CANCELED )->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
51
+ $orders['1_year']['refunded'] = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_CLOSED)->addFieldToFilter('created_at', array('from'=>$fromDate))->getSize();
52
+
53
+ $query = 'SELECT count(*) total_ontime FROM ' . $order_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 1 YEAR) AND HOUR(TIMEDIFF(created_at, updated_at)) < 48 AND state = '".Mage_Sales_Model_Order::STATE_COMPLETE."' LIMIT 1";
54
+ $orders['1_year']['ontime_shipment'] = $readConnection->fetchOne($query);
55
+
56
+ $query = 'SELECT count(*) total_return FROM ' . $creditmemo_table . " WHERE `created_at` >= DATE_SUB(Now(), INTERVAL 1 YEAR) LIMIT 1";
57
+ $orders['1_year']['returns'] = $readConnection->fetchOne($query);
58
+
59
+ $orders_json = json_encode($orders);
60
+ echo $orders_json;
61
+ }
62
+ }
app/code/community/Estoreinfo/Report/etc/config.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Estoreinfo_Report>
5
+ <version>0.1.0</version> <!-- Version number of your module -->
6
+ </Estoreinfo_Report>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <mymodule>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Estoreinfo_Report</module>
14
+ <frontName>estoreinfodata</frontName>
15
+ </args>
16
+ </mymodule>
17
+ </routers>
18
+ </frontend>
19
+ </config>
app/etc/modules/Estoreinfo_Report.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Estoreinfo_Report>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Estoreinfo_Report>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>9wcVR4bIlRVxfPN0</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Improve your sites&#x2019;s online reputation and utilize it to drive traffic and increase conversion rates! </summary>
10
+ <description>e-Store Info helps e-commerce businesses manage their online reputation across the web to improve conversion rates by up to 100%. We utilize unique algorithm to process and evaluate business data based on predetermined performance metrics including: volume of orders, shipping and cancellation rates. e-Store offers its basic version of integration for Magento businesses FREE.</description>
11
+ <notes>This is to display the order report statistic summary on our website.</notes>
12
+ <authors><author><name>e-Storeinfo</name><user>estoreinfo</user><email>sales@estoreinfo.com</email></author></authors>
13
+ <date>2016-08-18</date>
14
+ <time>14:17:02</time>
15
+ <contents><target name="magecommunity"><dir name="Estoreinfo"><dir name="Report"><dir name="controllers"><file name="IndexController.php" hash="5419cbdd06fcf70fbf9befcf1d0d67e2"/></dir><dir name="etc"><file name="config.xml" hash="f9ecd322d884ddffc7d7014ab12d272f"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Estoreinfo_Report.xml" hash="c8127523507cb6cf2a6d9d4a263f62a8"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>7.0.8</max></php></required></dependencies>
18
+ </package>