Version Notes
* minor bugfixes
Download this release
Release Info
Developer | AW_Core_Team |
Extension | AW_Onpulse |
Version | 1.0.11 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.0.11
app/code/local/AW/Onpulse/Helper/Data.php
CHANGED
@@ -123,7 +123,6 @@ class AW_Onpulse_Helper_Data extends Mage_Core_Helper_Abstract
|
|
123 |
public function processOutput($data)
|
124 |
{
|
125 |
$this->dateTimeFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
126 |
-
//var_dump($this->dateTimeFormat);die;
|
127 |
$clients = $data->getData('clients');
|
128 |
$orders = $data->getData('orders');
|
129 |
$dashboard = $data->getData('dashboard');
|
123 |
public function processOutput($data)
|
124 |
{
|
125 |
$this->dateTimeFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
|
|
126 |
$clients = $data->getData('clients');
|
127 |
$orders = $data->getData('orders');
|
128 |
$dashboard = $data->getData('dashboard');
|
app/code/local/AW/Onpulse/Model/Aggregator/Components/Statistics.php
CHANGED
@@ -46,7 +46,9 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
46 |
$dashboard['orders'] = $this->_getOrders($today);
|
47 |
$today = $this->_getCurrentDate();
|
48 |
$dashboard['customers'] = $this->_getCustomers($today);
|
|
|
49 |
$aggregator->setData('dashboard',$dashboard);
|
|
|
50 |
}
|
51 |
|
52 |
private function _getByers($date) {
|
@@ -94,6 +96,54 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
94 |
return array('online_visistors' => $online, 'today_customers' => $todayCustomers, 'yesterday_customers' => $yesterdayCustomers);
|
95 |
}
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
private function _getOrders($date)
|
98 |
{
|
99 |
|
@@ -162,6 +212,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
162 |
$shiftedDate = $this->_getShiftedDate();
|
163 |
$shiftedDate->addDay(1);
|
164 |
$date->addDay(1);
|
|
|
165 |
$revenue = array();
|
166 |
for($i=0;$i<15;$i++){
|
167 |
/** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
|
@@ -173,13 +224,32 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
173 |
$shiftedDate->addDay(-1);
|
174 |
$revenue[$i]['revenue']=0;
|
175 |
$revenue[$i]['date']=$shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
foreach($orders as $order){
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
}
|
181 |
}
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
}
|
46 |
$dashboard['orders'] = $this->_getOrders($today);
|
47 |
$today = $this->_getCurrentDate();
|
48 |
$dashboard['customers'] = $this->_getCustomers($today);
|
49 |
+
$dashboard['bestsellers'] = $this->_getBestsellers($today);
|
50 |
$aggregator->setData('dashboard',$dashboard);
|
51 |
+
|
52 |
}
|
53 |
|
54 |
private function _getByers($date) {
|
96 |
return array('online_visistors' => $online, 'today_customers' => $todayCustomers, 'yesterday_customers' => $yesterdayCustomers);
|
97 |
}
|
98 |
|
99 |
+
private function _getBestsellers($date)
|
100 |
+
{
|
101 |
+
/** @var $date Zend_Date */
|
102 |
+
$orderstatus = Mage::getStoreConfig('awonpulse/general/ordersstatus');
|
103 |
+
$orderstatus = explode(',', $orderstatus);
|
104 |
+
if (count($orderstatus)==0){
|
105 |
+
$orderstatus = array(Mage_Sales_Model_Order::STATE_COMPLETE);
|
106 |
+
}
|
107 |
+
//Collect all orders for last 30 days
|
108 |
+
/** @var $orders Mage_Sales_Model_Resource_Order_Collection */
|
109 |
+
$orders = Mage::getResourceModel('sales/order_collection');
|
110 |
+
$orders->addAttributeToFilter('created_at', array(
|
111 |
+
'from' => $date->addDay(-30)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
112 |
+
'to'=>$date->addDay(31)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
113 |
+
))->addAttributeToSelect('*')
|
114 |
+
->addAttributeToFilter('status', array('in' => $orderstatus));
|
115 |
+
$items = array();
|
116 |
+
|
117 |
+
/** @var $order Mage_Sales_Model_Order */
|
118 |
+
foreach($orders as $order) {
|
119 |
+
$orderItems = $order->getAllVisibleItems();
|
120 |
+
if(count($orderItems)>0) {
|
121 |
+
foreach($orderItems as $orderItem) {
|
122 |
+
$key = array_key_exists($orderItem->getProduct()->getId(),$items);
|
123 |
+
if($key === false) {
|
124 |
+
$items[$orderItem->getProduct()->getId()] = array(
|
125 |
+
'name'=>$orderItem->getProduct()->getName(),
|
126 |
+
'qty'=>0,
|
127 |
+
'amount' => 0
|
128 |
+
);
|
129 |
+
}
|
130 |
+
$items[$orderItem->getProduct()->getId()]['qty'] += $orderItem->getQtyOrdered();
|
131 |
+
$items[$orderItem->getProduct()->getId()]['amount'] += $orderItem->getBaseRowTotal()-$orderItem->getBaseDiscountInvoiced();
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
if(count($items) > 0) {
|
136 |
+
foreach ($items as $id => $row) {
|
137 |
+
|
138 |
+
$name[$id] = $row['name'];
|
139 |
+
$qty[$id] = $row['qty'];
|
140 |
+
}
|
141 |
+
array_multisort($qty, SORT_DESC, $name, SORT_ASC, $items);
|
142 |
+
}
|
143 |
+
return $items;
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
private function _getOrders($date)
|
148 |
{
|
149 |
|
212 |
$shiftedDate = $this->_getShiftedDate();
|
213 |
$shiftedDate->addDay(1);
|
214 |
$date->addDay(1);
|
215 |
+
$copyDate = clone $date;
|
216 |
$revenue = array();
|
217 |
for($i=0;$i<15;$i++){
|
218 |
/** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
|
224 |
$shiftedDate->addDay(-1);
|
225 |
$revenue[$i]['revenue']=0;
|
226 |
$revenue[$i]['date']=$shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
|
227 |
+
if($orders->getSize() > 0){
|
228 |
+
foreach($orders as $order){
|
229 |
+
$revenue[$i]['revenue']+=$order->getBaseGrandTotal();
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
$daysFrom1st=$copyDate->get(Zend_Date::DAY);
|
234 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
235 |
+
$orders->addAttributeToFilter('created_at', array('from' => $copyDate->addDay(-$daysFrom1st)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),'to'=>$copyDate->addDay($daysFrom1st)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
|
236 |
+
->addAttributeToSelect('*')
|
237 |
+
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
238 |
+
$thisMonthSoFar = 0;
|
239 |
+
if($orders->getSize() > 0){
|
240 |
foreach($orders as $order){
|
241 |
+
$thisMonthSoFar+=$order->getBaseGrandTotal();
|
|
|
|
|
242 |
}
|
243 |
}
|
244 |
+
$thisMonthForecast = 0;
|
245 |
+
$numberDaysInMonth = $copyDate->get(Zend_Date::MONTH_DAYS);
|
246 |
+
$thisMonthAvg = $thisMonthSoFar / $daysFrom1st;
|
247 |
+
$thisMonthForecast = $thisMonthAvg * $numberDaysInMonth;
|
248 |
+
$thisMonth = array();
|
249 |
+
$thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthSoFar);
|
250 |
+
$thisMonth['thisMonthAvg'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthAvg);
|
251 |
+
$thisMonth['thisMonthForecast'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthForecast);
|
252 |
+
|
253 |
+
return array('revenue'=>$revenue, 'thisMonth'=>$thisMonth);
|
254 |
}
|
255 |
}
|
app/code/local/AW/Onpulse/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<AW_Onpulse>
|
5 |
-
<version>1.0.
|
6 |
</AW_Onpulse>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<AW_Onpulse>
|
5 |
+
<version>1.0.11</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.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://onpulse.info/TOS.pdf">EULA</license>
|
7 |
<channel>community</channel>
|
@@ -11,9 +11,9 @@
|
|
11 |
</description>
|
12 |
<notes>* minor bugfixes</notes>
|
13 |
<authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
|
14 |
-
<date>2013-
|
15 |
-
<time>
|
16 |
-
<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="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AW_Onpulse</name>
|
4 |
+
<version>1.0.11</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://onpulse.info/TOS.pdf">EULA</license>
|
7 |
<channel>community</channel>
|
11 |
</description>
|
12 |
<notes>* minor bugfixes</notes>
|
13 |
<authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
|
14 |
+
<date>2013-07-01</date>
|
15 |
+
<time>12:03:21</time>
|
16 |
+
<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="1dda89d83241600e59ac0e6106701e4d"/><file name="Data.php.orig" hash="fb2ab95d3268d3d8a689143dff7ffdb8"/></dir><dir name="Model"><dir name="Aggregator"><file name="Component.php" hash="721719d0df46da388b229c10d137864b"/><dir name="Components"><file name="Customer.php" hash="52df2d3be2d6196ee957b2e2c0d92cb2"/><file name="Order.php" hash="a9a23d8f678a68f1b245b97126cc3116"/><file name="Statistics.php" hash="06186f171b8e6c7eaf12558a56345302"/></dir></dir><file name="Aggregator.php" hash="fcb4342d583403a99ca7bc245115854f"/><file name="Credentials.php" hash="56d886028ae6548937a9025d34e6e921"/></dir><dir name="etc"><file name="config.xml" hash="8e14a3e478fa2ba3ffe79d2416cbb158"/><file name="system.xml" hash="11fa0896cc56063c5c572d992622e224"/></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="aw_onpulse"><file name="settings.phtml" hash="10c6eea6457de53e501360b25eb50f1d"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="AW_Onpulse.xml" hash="de39a5ffebb31ee697fbaf56bb1bfb8a"/></dir></dir><dir name="locale"><dir name="en_US"><file name="AW_Onpulse.csv" hash="23f7bee483404129d0f811a2f53cf38d"/></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>
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|