AW_Onpulse - Version 2.0.1

Version Notes

Bugfix

Download this release

Release Info

Developer AW_Core_Team
Extension AW_Onpulse
Version 2.0.1
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.1

app/code/local/AW/Onpulse/Model/Aggregator/Components/Statistics.php CHANGED
@@ -274,7 +274,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
274
  $shiftedDate->addDay(1);
275
  $copyDate = clone $date;
276
  $revenue = array();
277
- for ($i = 0; $i < 15; $i++) {
278
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
279
  $orders = Mage::getModel('sales/order')->getCollection();
280
  $orders->addAttributeToFilter('created_at',
@@ -311,7 +311,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
311
  ->addAttributeToSelect('*')
312
  ->addAttributeToFilter('status', array('in' => $orderStatus));
313
  $thisMonthSoFar = array();
314
- foreach($orders as $order){
315
  if ($salesStatisticUnit == AW_Onpulse_Model_Source_ProfitRevenue::PROFIT_VALUE) {
316
  $baseTotalCost = 0;
317
  foreach ($order->getItemsCollection() as $item) {
@@ -333,15 +333,15 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
333
  $weekendDayList = array();
334
  $workDayLeft = 0;
335
  $weekendDayLeft = 0;
336
- $copyDate->subDay(intval($date->get(Zend_Date::DAY_SHORT)) - 1);
337
  for ($i = 0; $i < $copyDate->get(Zend_Date::MONTH_DAYS); $i++) {
338
- $weekdayDigit = intval($date->get(Zend_Date::WEEKDAY_DIGIT));//from Sunday to Saturday -> from 0 to 6;
339
  $isWeekday = in_array($weekdayDigit, $weekdayConfig);
340
- if (array_key_exists($i, $thisMonthSoFar)) {
341
  if ($isWeekday) {
342
- $weekendDayList[] = $thisMonthSoFar[$i];
343
  } else {
344
- $workDayList[] = $thisMonthSoFar[$i];
345
  }
346
  } else {
347
  $isWeekday?$weekendDayLeft++:$workDayLeft++;
@@ -350,7 +350,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
350
  }
351
  $workMedian = $this->_getMedianFromArray($workDayList);
352
  $weekendMedian = $this->_getMedianFromArray($weekendDayList);
353
- $thisMonthForecast = array_sum($thisMonthSoFar) + $workMedian * $workDayLeft + $weekendMedian * $workDayLeft;
354
 
355
  $thisMonth = array();
356
  $thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat(array_sum($thisMonthSoFar));
@@ -419,10 +419,14 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
419
  $revenue[$i]['date'] = $shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
420
  foreach($orders as $order){
421
  $revenue[$i]['revenue'] += $order->getTotalItemCount();
 
 
 
 
 
 
422
  }
423
- $thisMonthAvgList[] = $revenue[$i]['revenue'];
424
  }
425
-
426
  $thisMonthAvg = 0;
427
  if (count($thisMonthAvgList) > 0) {
428
  $thisMonthAvg = array_sum($thisMonthAvgList) / count($thisMonthAvgList);
274
  $shiftedDate->addDay(1);
275
  $copyDate = clone $date;
276
  $revenue = array();
277
+ for ($i = 0; $i < 32; $i++) {
278
  /** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
279
  $orders = Mage::getModel('sales/order')->getCollection();
280
  $orders->addAttributeToFilter('created_at',
311
  ->addAttributeToSelect('*')
312
  ->addAttributeToFilter('status', array('in' => $orderStatus));
313
  $thisMonthSoFar = array();
314
+ foreach($orders as $order) {
315
  if ($salesStatisticUnit == AW_Onpulse_Model_Source_ProfitRevenue::PROFIT_VALUE) {
316
  $baseTotalCost = 0;
317
  foreach ($order->getItemsCollection() as $item) {
333
  $weekendDayList = array();
334
  $workDayLeft = 0;
335
  $weekendDayLeft = 0;
336
+ $copyDate->subDay(intval($copyDate->get(Zend_Date::DAY_SHORT)) - 1);
337
  for ($i = 0; $i < $copyDate->get(Zend_Date::MONTH_DAYS); $i++) {
338
+ $weekdayDigit = intval($copyDate->get(Zend_Date::WEEKDAY_DIGIT));//from Sunday to Saturday -> from 0 to 6;
339
  $isWeekday = in_array($weekdayDigit, $weekdayConfig);
340
+ if ($i < $daysFrom1st) {
341
  if ($isWeekday) {
342
+ $weekendDayList[] = $revenue[$i]['revenue'];
343
  } else {
344
+ $workDayList[] = $revenue[$i]['revenue'];
345
  }
346
  } else {
347
  $isWeekday?$weekendDayLeft++:$workDayLeft++;
350
  }
351
  $workMedian = $this->_getMedianFromArray($workDayList);
352
  $weekendMedian = $this->_getMedianFromArray($weekendDayList);
353
+ $thisMonthForecast = array_sum($thisMonthSoFar) + $workMedian * $workDayLeft + $weekendMedian * $weekendDayLeft;
354
 
355
  $thisMonth = array();
356
  $thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat(array_sum($thisMonthSoFar));
419
  $revenue[$i]['date'] = $shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
420
  foreach($orders as $order){
421
  $revenue[$i]['revenue'] += $order->getTotalItemCount();
422
+ $thisMonthAvgList[] = $order->getTotalItemCount();
423
+ }
424
+ if (count($orders) > 0) {
425
+ $revenue[$i]['revenue'] = Mage::helper('awonpulse')->getPriceFormat(
426
+ $revenue[$i]['revenue']/count($orders)
427
+ );
428
  }
 
429
  }
 
430
  $thisMonthAvg = 0;
431
  if (count($thisMonthAvgList) > 0) {
432
  $thisMonthAvg = array_sum($thisMonthAvgList) / count($thisMonthAvgList);
app/code/local/AW/Onpulse/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <AW_Onpulse>
5
- <version>2.0.0</version>
6
  </AW_Onpulse>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <AW_Onpulse>
5
+ <version>2.0.1</version>
6
  </AW_Onpulse>
7
  </modules>
8
  <global>
package.xml CHANGED
@@ -1,25 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>AW_Onpulse</name>
4
- <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://onpulse.info/TOS.pdf">EULA</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Mobile administration for Magento</summary>
10
  <description>OnPulse provides you with an access to your sales statistics, the latest orders, and the clients list through any iOS or Android powered mobile device.</description>
11
- <notes>The update includes a number of all-new reports, improved sales forecast algorithm and the ability to search and view order and customer data. Here is the full list of new features:&#xD;
12
- - Ability to search and view all clients and orders by name, email or ID&#xD;
13
- - Displays sales stats as profit or revenue&#xD;
14
- - Sales by country report&#xD;
15
- - Items per order report (IPO)&#xD;
16
- - Average order value report (AOV)&#xD;
17
- - Last orders with items on the dashboard&#xD;
18
- - Improved sales forecast algorithm</notes>
19
  <authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
20
- <date>2015-03-17</date>
21
- <time>13:21:25</time>
22
- <contents><target name="mageetc"><dir name="modules"><file name="AW_Onpulse.xml" hash="de39a5ffebb31ee697fbaf56bb1bfb8a"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_onpulse.xml" hash="d09056058d50d23c5c6d23c977dd5597"/></dir><dir name="template"><dir name="aw_onpulse"><file name="access.phtml" hash="83d79128f5e5311afa966d14922e5639"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="AW_Onpulse.csv" hash="4aa10dde01a5cdcd2cf8393dad7c3307"/></dir></target><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="Access.php" hash="fd13a1db644a64d8c94f3d4a4c6d7209"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="739f1a113831f84b57e340faaf81b0b4"/></dir><dir name="Model"><dir name="Aggregator"><file name="Component.php" hash="f5fad1561e9416e2180915eb27338de0"/><dir name="Components"><file name="Customer.php" hash="154fc0cd3d6f05328297d2c210d074dc"/><file name="Order.php" hash="4d73ae227b6b259268207f9fdea11215"/><file name="Statistics.php" hash="b6c68cb748c294fc2ed506fce8443f86"/></dir></dir><file name="Aggregator.php" hash="25c9afc28898537ba928261ba6039d46"/><file name="Credentials.php" hash="5e47eeda766011b0c62eb3950a266013"/><dir name="Source"><file name="OrderStatus.php" hash="ee2303fe70a4079444f78c9f7f4b26f7"/><file name="ProfitRevenue.php" hash="9d62f0d63ee294a85952a59fe67865b8"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="c2f131fd09f9bcf903c4a759fcd7a3c4"/></dir><file name="IndexController.php" hash="10fb4c82c9d718b25cbc41b11ba390d5"/></dir><dir name="etc"><file name="config.xml" hash="2ef39dbb27830686ca3042dee1c3d67d"/><file name="system.xml" hash="1208189b11076e1f29a54fce5ea22eeb"/></dir><dir name="sql"><dir name="awonpulse_setup"><file name="mysql4-install-1.0.0.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.0-1.0.14.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.14-1.0.15.php" hash="82ed6ef244e3a14e61846f5dce1c7125"/><file name="mysql4-upgrade-1.0.15-1.0.17.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.17-2.0.0.php" hash="a7ce80bcd8e64c2b7f2a4ee227664680"/></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>AW_Onpulse</name>
4
+ <version>2.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://onpulse.info/TOS.pdf">EULA</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Mobile administration for Magento</summary>
10
  <description>OnPulse provides you with an access to your sales statistics, the latest orders, and the clients list through any iOS or Android powered mobile device.</description>
11
+ <notes>Bugfix</notes>
 
 
 
 
 
 
 
12
  <authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
13
+ <date>2015-03-18</date>
14
+ <time>12:50:41</time>
15
+ <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="Access.php" hash="fd13a1db644a64d8c94f3d4a4c6d7209"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="739f1a113831f84b57e340faaf81b0b4"/></dir><dir name="Model"><dir name="Aggregator"><file name="Component.php" hash="f5fad1561e9416e2180915eb27338de0"/><dir name="Components"><file name="Customer.php" hash="154fc0cd3d6f05328297d2c210d074dc"/><file name="Order.php" hash="4d73ae227b6b259268207f9fdea11215"/><file name="Statistics.php" hash="f2a1161cac5d3d601df2c784e8c1fb74"/></dir></dir><file name="Aggregator.php" hash="25c9afc28898537ba928261ba6039d46"/><file name="Credentials.php" hash="5e47eeda766011b0c62eb3950a266013"/><dir name="Source"><file name="OrderStatus.php" hash="ee2303fe70a4079444f78c9f7f4b26f7"/><file name="ProfitRevenue.php" hash="9d62f0d63ee294a85952a59fe67865b8"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ConfigController.php" hash="c2f131fd09f9bcf903c4a759fcd7a3c4"/></dir><file name="IndexController.php" hash="10fb4c82c9d718b25cbc41b11ba390d5"/></dir><dir name="etc"><file name="config.xml" hash="292b6f399e6c2c64866d34dd48a5cac4"/><file name="system.xml" hash="1208189b11076e1f29a54fce5ea22eeb"/></dir><dir name="sql"><dir name="awonpulse_setup"><file name="mysql4-install-1.0.0.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.0-1.0.14.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.14-1.0.15.php" hash="82ed6ef244e3a14e61846f5dce1c7125"/><file name="mysql4-upgrade-1.0.15-1.0.17.php" hash="f9df2f05fb3189102247b4c6fcee81e9"/><file name="mysql4-upgrade-1.0.17-2.0.0.php" hash="a7ce80bcd8e64c2b7f2a4ee227664680"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="aw_onpulse.xml" hash="d09056058d50d23c5c6d23c977dd5597"/></dir><dir name="template"><dir name="aw_onpulse"><file name="access.phtml" hash="83d79128f5e5311afa966d14922e5639"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="AW_Onpulse.xml" hash="de39a5ffebb31ee697fbaf56bb1bfb8a"/></dir></target><target name="magelocale"><dir name="en_US"><file name="AW_Onpulse.csv" hash="4aa10dde01a5cdcd2cf8393dad7c3307"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>