AW_Onpulse - Version 1.0.3

Version Notes

Dashboard

The dashboard displays the latest sales data as well as gives a fast look at yesterday’s sales;
orders with max/min/ average values;
the number of registered users and online visitors.

Sales

Attractive bar chart showing sales statistics for the past 15 days.

Orders

The latest orders are sorted by date and include order ID, client name, status information, and other purchase details.
Tap on email or phone number to contact your customer.

Clients

The list of customers that contains personal information and purchase activity.

Download this release

Release Info

Developer AW_Core_Team
Extension AW_Onpulse
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/local/AW/Onpulse/Model/Aggregator/Components/Statistics.php CHANGED
@@ -5,6 +5,14 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
5
  const COUNT_CUSTOMERS = 5;
6
  const MYSQL_DATE_FORMAT = 'Y-m-d';
7
 
 
 
 
 
 
 
 
 
8
  private function _getCurrentDate()
9
  {
10
  $now = Mage::app()->getLocale()->date();
@@ -26,6 +34,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
26
 
27
  return $dateObj;
28
  }
 
29
  public function pushData($event = null)
30
  {
31
  $aggregator = $event->getEvent()->getAggregator();
@@ -42,16 +51,20 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
42
  private function _getByers($date) {
43
  /** @var $todayRegistered Mage_Customer_Model_Resource_Customer_Collection */
44
  $todayRegistered = Mage::getModel('customer/customer')->getCollection();
45
- $todayRegistered->addAttributeToFilter('created_at', array('from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)));
 
 
 
46
  $todayRegistered->addAttributeToSelect('*');
47
 
48
  /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
49
- //$collection = Mage::getResourceModel('reports/order_collection');
50
  $customerArray = array();
51
  $todayOrders = Mage::getModel('sales/order')->getCollection();
52
- $todayOrders->addAttributeToFilter('created_at', array('from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)));
 
 
 
53
  foreach ($todayOrders as $order) {
54
- //$order->getCustomerId();
55
  if ($order->getCustomerId()){
56
  $customerArray[] = $order->getCustomerId();
57
  }
@@ -75,16 +88,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
75
  $yesterdayCustomers = null;
76
  $todayCustomers = $this->_getByers($date);
77
  $yesterdayCustomers = $this->_getByers($date->addDay(-1));
78
- //var_dump($yesterdayCustomers);
79
- /*$collection
80
- ->groupByCustomer()
81
- ->addAttributeToFilter('created_at', array('gteq' => $date->toString(Varien_Date::DATE_INTERNAL_FORMAT)))
82
- ->addOrdersCount()
83
- ->joinCustomerName();
84
- $buyers = 0;
85
- foreach ($collection as $item) {
86
- $buyers++;
87
- }*/
88
  return array('online_visistors' => $online, 'today_customers' => $todayCustomers, 'yesterday_customers' => $yesterdayCustomers);
89
  }
90
 
@@ -95,7 +99,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
95
 
96
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
97
  $yesterdayOrders = Mage::getResourceModel('sales/order_collection');
98
- // echo 'request'.$yesterdayOrders->getSelect().'<br>';die;
99
  $yesterdayOrders->addAttributeToFilter('created_at', array(
100
  'from' => $date->addDay(-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
101
  'to'=>$date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
@@ -144,19 +148,20 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
144
 
145
  private function _getSales($date)
146
  {
147
-
 
148
  $date->addDay(1);
149
  $revenue = array();
150
  for($i=0;$i<15;$i++){
151
-
152
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
153
  $orders = Mage::getModel('sales/order')->getCollection();
154
  $orders->addAttributeToFilter('created_at', array('from' => $date->addDay(-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),'to'=>$date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
155
  ->addAttributeToSelect('*')
156
  ->addAttributeToFilter('state', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
157
  $date->addDay(-1);
 
158
  $revenue[$i]['revenue']=0;
159
- $revenue[$i]['date']=$date->toString(Varien_Date::DATE_INTERNAL_FORMAT);
160
  foreach($orders as $order){
161
  $revenue[$i]['revenue']+=$order->getBaseGrandTotal();
162
 
@@ -164,6 +169,5 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
164
  }
165
  }
166
  return array('revenue'=>$revenue);
167
-
168
  }
169
  }
5
  const COUNT_CUSTOMERS = 5;
6
  const MYSQL_DATE_FORMAT = 'Y-m-d';
7
 
8
+ private function _getShiftedDate()
9
+ {
10
+ $timeShift = Mage::app()->getLocale()->date()->get(Zend_Date::TIMEZONE_SECS);
11
+ $now = date(self::MYSQL_DATE_FORMAT, time() + $timeShift);
12
+ $now = new Zend_Date($now);
13
+ return $now;
14
+ }
15
+
16
  private function _getCurrentDate()
17
  {
18
  $now = Mage::app()->getLocale()->date();
34
 
35
  return $dateObj;
36
  }
37
+
38
  public function pushData($event = null)
39
  {
40
  $aggregator = $event->getEvent()->getAggregator();
51
  private function _getByers($date) {
52
  /** @var $todayRegistered Mage_Customer_Model_Resource_Customer_Collection */
53
  $todayRegistered = Mage::getModel('customer/customer')->getCollection();
54
+ $todayRegistered->addAttributeToFilter('created_at', array(
55
+ 'from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
56
+ 'to' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
57
+ ));
58
  $todayRegistered->addAttributeToSelect('*');
59
 
60
  /* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
 
61
  $customerArray = array();
62
  $todayOrders = Mage::getModel('sales/order')->getCollection();
63
+ $todayOrders->addAttributeToFilter('created_at', array(
64
+ 'from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
65
+ 'to' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
66
+ ));
67
  foreach ($todayOrders as $order) {
 
68
  if ($order->getCustomerId()){
69
  $customerArray[] = $order->getCustomerId();
70
  }
88
  $yesterdayCustomers = null;
89
  $todayCustomers = $this->_getByers($date);
90
  $yesterdayCustomers = $this->_getByers($date->addDay(-1));
91
+
 
 
 
 
 
 
 
 
 
92
  return array('online_visistors' => $online, 'today_customers' => $todayCustomers, 'yesterday_customers' => $yesterdayCustomers);
93
  }
94
 
99
 
100
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
101
  $yesterdayOrders = Mage::getResourceModel('sales/order_collection');
102
+
103
  $yesterdayOrders->addAttributeToFilter('created_at', array(
104
  'from' => $date->addDay(-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
105
  'to'=>$date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
148
 
149
  private function _getSales($date)
150
  {
151
+ $shiftedDate = $this->_getShiftedDate();
152
+ $shiftedDate->addDay(1);
153
  $date->addDay(1);
154
  $revenue = array();
155
  for($i=0;$i<15;$i++){
 
156
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
157
  $orders = Mage::getModel('sales/order')->getCollection();
158
  $orders->addAttributeToFilter('created_at', array('from' => $date->addDay(-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),'to'=>$date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
159
  ->addAttributeToSelect('*')
160
  ->addAttributeToFilter('state', array('eq' => Mage_Sales_Model_Order::STATE_COMPLETE));
161
  $date->addDay(-1);
162
+ $shiftedDate->addDay(-1);
163
  $revenue[$i]['revenue']=0;
164
+ $revenue[$i]['date']=$shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
165
  foreach($orders as $order){
166
  $revenue[$i]['revenue']+=$order->getBaseGrandTotal();
167
 
169
  }
170
  }
171
  return array('revenue'=>$revenue);
 
172
  }
173
  }
app/code/local/AW/Onpulse/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <AW_Onpulse>
5
- <version>1.0.2</version>
6
  </AW_Onpulse>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <AW_Onpulse>
5
+ <version>1.0.3</version>
6
  </AW_Onpulse>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>AW_Onpulse</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://onpulse.info/TOS.pdf">EULA</license>
7
  <channel>community</channel>
@@ -30,9 +30,9 @@
30
  &#xD;
31
  </notes>
32
  <authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
33
- <date>2013-02-21</date>
34
- <time>06:55:31</time>
35
- <contents><target name="magelocal"><dir name="AW"><dir name="Onpulse"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Onpulse"><file name="Settings.php" hash="6ba04d380ea7140b42c54f00a0acc452"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9e18cf2dd18b58c00d8d945470c57054"/><file name="Data.php.orig" hash="b022898682ac190dec591c1bacf5c32f"/></dir><dir name="Model"><dir name="Aggregator"><file name="Component.php" hash="47a0a36eaca33135f61c1e422008dd95"/><dir name="Components"><file name="Customer.php" hash="52df2d3be2d6196ee957b2e2c0d92cb2"/><file name="Order.php" hash="905a436620ff34860e1132f3377466a8"/><file name="Statistics.php" hash="afacedfd9791b1e5269951ade6f031d9"/></dir></dir><file name="Aggregator.php" hash="fcb4342d583403a99ca7bc245115854f"/><file name="Credentials.php" hash="a23575f1507b1b79b3f688e7020af5c6"/></dir><dir name="etc"><file name="config.xml" hash="ee6c54508a498f5991d62c45fc144b82"/><file name="system.xml" hash="0a793ace64e8c5eed6a829a280d9c244"/></dir></dir><dir name="All"><dir name="Block"><file name="Jsinit.php" hash="2c4f7995f12128676353f3400ca2323d"/><dir name="Notification"><file name="Window.php" hash="c036a2d67d14ad780be19b18f3039ddf"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Awall"><file name="Extensions.php" hash="2daab2d11499b06f55db21d17673f830"/><file name="Store.php" hash="f79986ed3ea85f9c82f0408784784691"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="08c8ce64a72e17fdaded07bb481e1b84"/><file name="Data.php" hash="d5c25ae1427b94663ed85ba5af50c5cd"/><file name="Versions.php" hash="cad84ef6ab19bfc4882abd181b94a61d"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="9e4176fa37419492b35f38e346570a15"/><file name="Extensions.php" hash="09a440225ba3ba913d65c13b0ead939e"/><file name="Updates.php" hash="6f6bf9b18c589160cd712a8c77505db1"/></dir><file name="Feed.php" hash="649bc890b0089dbfc4d5d543752397eb"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="888c9ba1443415e52a7b8ee899f1c624"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35194b308565bedb01461b1b5a453589"/><file name="config.xml" hash="66e966899278037980837bff496f8605"/><file name="system.xml" hash="dc65c6a5469fb03482663e00c7a5d044"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_all.xml" hash="2f45307d61db1f1437489b761f0d80e3"/></dir><dir name="template"><dir name="aw_all"><file name="jsinit.phtml" hash="4791b4c4b577aa02f9cc08387f2889ac"/><dir><dir name="notification"><dir name="window"><file name="first-run.phtml" hash="7f1922658c950b8c97405110783ad173"/></dir><file name="window.phtml" hash="0cda3135865cd9dbb427e72355259eaf"/></dir></dir></dir><dir name="aw_onpulse"><file name="settings.phtml" hash="f528e96b676e5a527fb786dd9345aac3"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="AW_All.xml" hash="71ed195abb2bb9e07e3ab8691a80f3e6"/><file name="AW_Onpulse.xml" hash="de39a5ffebb31ee697fbaf56bb1bfb8a"/></dir></dir><dir name="locale"><dir name="en_US"><file name="AW_Onpulse.csv" hash="c8a9db33aa8349174fef636c95ac7063"/></dir></dir></dir><dir name="js"><dir name="aw_all"><file name="aw_all.js" hash="1d05048fe6c683b10f9643e411841c70"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="aw_all"><dir><dir name="css"><file name="window.css" hash="883499f1a1a11c7dd2a95749de6bad73"/></dir><dir name="images"><file name="bad.gif" hash="b8379f1ba7ab552ca46b9d5fd0452345"/><file name="delete.jpg" hash="6bb134dbca5cbde8e9873b4eb8f8faa8"/><file name="info.gif" hash="421f023bf6a8a17b9c0347ab851f167f"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="readme.png" hash="e18d543aceba4fef55b0052477dbf5a1"/><file name="store.png" hash="f2f0a8667df423a2b4eb763f4657c363"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/><dir name="window"><file name="arrow.gif" hash="9d5ea1a89fda9e986ba5b235caae8620"/><file name="btn-close.gif" hash="18b1c56f62eba1f3537b392797f9c4ff"/></dir></dir></dir></dir></dir></dir></dir></dir><dir><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_onpulse.xml" hash="5036d3b89b9a204c9420f40f3983d987"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
38
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>AW_Onpulse</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://onpulse.info/TOS.pdf">EULA</license>
7
  <channel>community</channel>
30
  &#xD;
31
  </notes>
32
  <authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
33
+ <date>2013-02-25</date>
34
+ <time>11:22:11</time>
35
+ <contents><target name="magelocal"><dir name="AW"><dir name="Onpulse"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Onpulse"><file name="Settings.php" hash="6ba04d380ea7140b42c54f00a0acc452"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="9e18cf2dd18b58c00d8d945470c57054"/><file name="Data.php.orig" hash="b022898682ac190dec591c1bacf5c32f"/></dir><dir name="Model"><dir name="Aggregator"><file name="Component.php" hash="47a0a36eaca33135f61c1e422008dd95"/><dir name="Components"><file name="Customer.php" hash="52df2d3be2d6196ee957b2e2c0d92cb2"/><file name="Order.php" hash="905a436620ff34860e1132f3377466a8"/><file name="Statistics.php" hash="c0aa6ec1a78e64b9001799a3d8cffa99"/></dir></dir><file name="Aggregator.php" hash="fcb4342d583403a99ca7bc245115854f"/><file name="Credentials.php" hash="a23575f1507b1b79b3f688e7020af5c6"/></dir><dir name="etc"><file name="config.xml" hash="d83c14298989f09fb4e6fb41bc01d714"/><file name="system.xml" hash="0a793ace64e8c5eed6a829a280d9c244"/></dir></dir><dir name="All"><dir name="Block"><file name="Jsinit.php" hash="2c4f7995f12128676353f3400ca2323d"/><dir name="Notification"><file name="Window.php" hash="c036a2d67d14ad780be19b18f3039ddf"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Awall"><file name="Extensions.php" hash="2daab2d11499b06f55db21d17673f830"/><file name="Store.php" hash="f79986ed3ea85f9c82f0408784784691"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="08c8ce64a72e17fdaded07bb481e1b84"/><file name="Data.php" hash="d5c25ae1427b94663ed85ba5af50c5cd"/><file name="Versions.php" hash="cad84ef6ab19bfc4882abd181b94a61d"/></dir><dir name="Model"><dir name="Feed"><file name="Abstract.php" hash="9e4176fa37419492b35f38e346570a15"/><file name="Extensions.php" hash="09a440225ba3ba913d65c13b0ead939e"/><file name="Updates.php" hash="6f6bf9b18c589160cd712a8c77505db1"/></dir><file name="Feed.php" hash="649bc890b0089dbfc4d5d543752397eb"/><dir name="Source"><dir name="Updates"><file name="Type.php" hash="888c9ba1443415e52a7b8ee899f1c624"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="35194b308565bedb01461b1b5a453589"/><file name="config.xml" hash="66e966899278037980837bff496f8605"/><file name="system.xml" hash="dc65c6a5469fb03482663e00c7a5d044"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_all.xml" hash="2f45307d61db1f1437489b761f0d80e3"/></dir><dir name="template"><dir name="aw_all"><file name="jsinit.phtml" hash="4791b4c4b577aa02f9cc08387f2889ac"/><dir><dir name="notification"><dir name="window"><file name="first-run.phtml" hash="7f1922658c950b8c97405110783ad173"/></dir><file name="window.phtml" hash="0cda3135865cd9dbb427e72355259eaf"/></dir></dir></dir><dir name="aw_onpulse"><file name="settings.phtml" hash="f528e96b676e5a527fb786dd9345aac3"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="AW_All.xml" hash="71ed195abb2bb9e07e3ab8691a80f3e6"/><file name="AW_Onpulse.xml" hash="de39a5ffebb31ee697fbaf56bb1bfb8a"/></dir></dir><dir name="locale"><dir name="en_US"><file name="AW_Onpulse.csv" hash="c8a9db33aa8349174fef636c95ac7063"/></dir></dir></dir><dir name="js"><dir name="aw_all"><file name="aw_all.js" hash="1d05048fe6c683b10f9643e411841c70"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="aw_all"><dir><dir name="css"><file name="window.css" hash="883499f1a1a11c7dd2a95749de6bad73"/></dir><dir name="images"><file name="bad.gif" hash="b8379f1ba7ab552ca46b9d5fd0452345"/><file name="delete.jpg" hash="6bb134dbca5cbde8e9873b4eb8f8faa8"/><file name="info.gif" hash="421f023bf6a8a17b9c0347ab851f167f"/><file name="ok.gif" hash="a38bc2ee6e116e39c6e2e3013ee50f5e"/><file name="readme.png" hash="e18d543aceba4fef55b0052477dbf5a1"/><file name="store.png" hash="f2f0a8667df423a2b4eb763f4657c363"/><file name="update.gif" hash="8342e11f7739fcfa25134707f0536ed6"/><dir name="window"><file name="arrow.gif" hash="9d5ea1a89fda9e986ba5b235caae8620"/><file name="btn-close.gif" hash="18b1c56f62eba1f3537b392797f9c4ff"/></dir></dir></dir></dir></dir></dir></dir></dir><dir><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_onpulse.xml" hash="5036d3b89b9a204c9420f40f3983d987"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
38
  </package>