Version Notes
+ performance improvements
Download this release
Release Info
Developer | AW_Core_Team |
Extension | AW_Onpulse |
Version | 1.0.13 |
Comparing to | |
See all releases |
Code changes from version 1.0.12 to 1.0.13
app/code/local/AW/Onpulse/Model/Aggregator/Components/Statistics.php
CHANGED
@@ -108,35 +108,38 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
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(-
|
112 |
-
'to'=>$date->addDay(
|
113 |
-
))->
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
$items = array();
|
116 |
|
117 |
/** @var $order Mage_Sales_Model_Order */
|
118 |
-
foreach($orders as $
|
119 |
-
$orderItems = $order->getAllVisibleItems();
|
120 |
-
if(count($orderItems)>0) {
|
121 |
-
foreach($orderItems as $orderItem) {
|
122 |
|
123 |
-
$key = array_key_exists($orderItem
|
124 |
if($key === false) {
|
125 |
-
|
126 |
continue;
|
127 |
-
}
|
128 |
-
|
129 |
-
$items[$
|
130 |
-
'name'=>$
|
131 |
'qty'=>0,
|
132 |
'amount' => 0
|
133 |
);
|
134 |
}
|
135 |
-
$items[$orderItem
|
136 |
-
$items[$orderItem
|
137 |
}
|
138 |
-
|
139 |
-
}
|
140 |
if(count($items) > 0) {
|
141 |
foreach ($items as $id => $row) {
|
142 |
|
@@ -237,7 +240,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
237 |
}
|
238 |
$daysFrom1st=$copyDate->get(Zend_Date::DAY);
|
239 |
$orders = Mage::getModel('sales/order')->getCollection();
|
240 |
-
$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)))
|
241 |
->addAttributeToSelect('*')
|
242 |
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
243 |
$thisMonthSoFar = 0;
|
@@ -248,7 +251,7 @@ class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model
|
|
248 |
}
|
249 |
$thisMonthForecast = 0;
|
250 |
$numberDaysInMonth = $copyDate->get(Zend_Date::MONTH_DAYS);
|
251 |
-
$thisMonthAvg = $thisMonthSoFar /
|
252 |
$thisMonthForecast = $thisMonthAvg * $numberDaysInMonth;
|
253 |
$thisMonth = array();
|
254 |
$thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthSoFar);
|
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(-15)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
112 |
+
'to'=>$date->addDay(16)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
113 |
+
))->addAttributeToFilter('status', array('in' => $orderstatus));
|
114 |
+
|
115 |
+
$orderIds = Mage::getSingleton('core/resource')->getConnection('sales_read')->query($orders->getSelect()->resetJoinLeft())->fetchAll(PDO::FETCH_COLUMN,0);
|
116 |
+
unset($orders);
|
117 |
+
|
118 |
+
$orders = Mage::getModel('sales/order_item')->getCollection()
|
119 |
+
->addFieldToFilter('order_id',array('in'=>$orderIds));
|
120 |
+
$orders = Mage::getSingleton('core/resource')->getConnection('sales_read')->query($orders->getSelect()->resetJoinLeft())->fetchAll();
|
121 |
+
|
122 |
$items = array();
|
123 |
|
124 |
/** @var $order Mage_Sales_Model_Order */
|
125 |
+
foreach($orders as $orderItem) {
|
|
|
|
|
|
|
126 |
|
127 |
+
$key = array_key_exists($orderItem['product_id'],$items);
|
128 |
if($key === false) {
|
129 |
+
/* if(count($items) > 15) {
|
130 |
continue;
|
131 |
+
}*/
|
132 |
+
//$product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
|
133 |
+
$items[$orderItem['product_id']] = array(
|
134 |
+
'name'=>$orderItem['name'],
|
135 |
'qty'=>0,
|
136 |
'amount' => 0
|
137 |
);
|
138 |
}
|
139 |
+
$items[$orderItem['product_id']]['qty'] += $orderItem['qty_ordered'];
|
140 |
+
$items[$orderItem['product_id']]['amount'] += Mage::helper('awonpulse')->getPriceFormat($orderItem['base_row_total']-$orderItem['base_discount_invoiced']);
|
141 |
}
|
142 |
+
|
|
|
143 |
if(count($items) > 0) {
|
144 |
foreach ($items as $id => $row) {
|
145 |
|
240 |
}
|
241 |
$daysFrom1st=$copyDate->get(Zend_Date::DAY);
|
242 |
$orders = Mage::getModel('sales/order')->getCollection();
|
243 |
+
$orders->addAttributeToFilter('created_at', array('from' => $copyDate->addDay(-$daysFrom1st)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),'to'=>$copyDate->addDay($daysFrom1st-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
|
244 |
->addAttributeToSelect('*')
|
245 |
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
246 |
$thisMonthSoFar = 0;
|
251 |
}
|
252 |
$thisMonthForecast = 0;
|
253 |
$numberDaysInMonth = $copyDate->get(Zend_Date::MONTH_DAYS);
|
254 |
+
$thisMonthAvg = $thisMonthSoFar /($daysFrom1st - 1);
|
255 |
$thisMonthForecast = $thisMonthAvg * $numberDaysInMonth;
|
256 |
$thisMonth = array();
|
257 |
$thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthSoFar);
|
app/code/local/AW/Onpulse/Model/Aggregator/Components/Statistics.php.orig
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AW_Onpulse_Model_Aggregator_Components_Statistics extends AW_Onpulse_Model_Aggregator_Component
|
4 |
+
{
|
5 |
+
const COUNT_CUSTOMERS = 5;
|
6 |
+
const MYSQL_DATE_FORMAT = 'Y-d-m';
|
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();
|
19 |
+
$dateObj = Mage::app()->getLocale()->date(null, null, Mage::app()->getLocale()->getDefaultLocale(), false);
|
20 |
+
|
21 |
+
//set default timezone for store (admin)
|
22 |
+
$dateObj->setTimezone(Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
|
23 |
+
|
24 |
+
//set begining of day
|
25 |
+
$dateObj->setHour(00);
|
26 |
+
$dateObj->setMinute(00);
|
27 |
+
$dateObj->setSecond(00);
|
28 |
+
|
29 |
+
//set date with applying timezone of store
|
30 |
+
$dateObj->set($now, Zend_Date::DATE_SHORT, Mage::app()->getLocale()->getDefaultLocale());
|
31 |
+
|
32 |
+
//convert store date to default date in UTC timezone without DST
|
33 |
+
$dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
|
34 |
+
|
35 |
+
return $dateObj;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function pushData($event = null)
|
39 |
+
{
|
40 |
+
$aggregator = $event->getEvent()->getAggregator();
|
41 |
+
$dashboard = array();
|
42 |
+
$today = $this->_getCurrentDate();
|
43 |
+
|
44 |
+
$dashboard['sales'] = $this->_getSales($today);
|
45 |
+
$today = $this->_getCurrentDate();
|
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) {
|
55 |
+
/** @var $todayRegistered Mage_Customer_Model_Resource_Customer_Collection */
|
56 |
+
$todayRegistered = Mage::getModel('customer/customer')->getCollection();
|
57 |
+
$todayRegistered->addAttributeToFilter('created_at', array(
|
58 |
+
'from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
59 |
+
'to' => $date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
60 |
+
));
|
61 |
+
$todayRegistered->addAttributeToSelect('*');
|
62 |
+
|
63 |
+
$date->addDay(-1);
|
64 |
+
/* @var $collection Mage_Reports_Model_Mysql4_Order_Collection */
|
65 |
+
$customerArray = array();
|
66 |
+
$todayOrders = Mage::getModel('sales/order')->getCollection();
|
67 |
+
$todayOrders->addAttributeToFilter('created_at', array(
|
68 |
+
'from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
69 |
+
'to' => $date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
70 |
+
));
|
71 |
+
foreach ($todayOrders as $order) {
|
72 |
+
if ($order->getCustomerId()){
|
73 |
+
$customerArray[] = $order->getCustomerId();
|
74 |
+
}
|
75 |
+
}
|
76 |
+
$customerArray = array_unique($customerArray);
|
77 |
+
$buyers = count($customerArray);
|
78 |
+
return array(
|
79 |
+
'buyers'=>$buyers,
|
80 |
+
'registered'=>$todayRegistered,
|
81 |
+
);
|
82 |
+
}
|
83 |
+
|
84 |
+
private function _getCustomers($date)
|
85 |
+
{
|
86 |
+
|
87 |
+
//collect online visitors
|
88 |
+
$online = Mage::getModel('log/visitor_online')
|
89 |
+
->prepare()
|
90 |
+
->getCollection()->getSize();
|
91 |
+
$todayCustomers = null;
|
92 |
+
$yesterdayCustomers = null;
|
93 |
+
$todayCustomers = $this->_getByers($date);
|
94 |
+
$yesterdayCustomers = $this->_getByers($date->addDay(-2));
|
95 |
+
|
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 |
+
|
123 |
+
$key = array_key_exists($orderItem->getProductId(),$items);
|
124 |
+
if($key === false) {
|
125 |
+
if(count($items) > 15) {
|
126 |
+
continue;
|
127 |
+
}
|
128 |
+
$product = Mage::getModel('catalog/product')->load($orderItem->getProductId());
|
129 |
+
$items[$product->getId()] = array(
|
130 |
+
'name'=>$product->getName(),
|
131 |
+
'qty'=>0,
|
132 |
+
'amount' => 0
|
133 |
+
);
|
134 |
+
}
|
135 |
+
$items[$orderItem->getProductId()]['qty'] += $orderItem->getQtyOrdered();
|
136 |
+
$items[$orderItem->getProductId()]['amount'] += Mage::helper('awonpulse')->getPriceFormat($orderItem->getBaseRowTotal()-$orderItem->getBaseDiscountInvoiced());
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
if(count($items) > 0) {
|
141 |
+
foreach ($items as $id => $row) {
|
142 |
+
|
143 |
+
$name[$id] = $row['name'];
|
144 |
+
$qty[$id] = $row['qty'];
|
145 |
+
}
|
146 |
+
array_multisort($qty, SORT_DESC, $name, SORT_ASC, $items);
|
147 |
+
}
|
148 |
+
return $items;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
private function _getOrders($date)
|
153 |
+
{
|
154 |
+
|
155 |
+
//collect yesterday orders count
|
156 |
+
$ordersstatus = Mage::getStoreConfig('awonpulse/general/ordersstatus');
|
157 |
+
$ordersstatus = explode(',', $ordersstatus);
|
158 |
+
if (count($ordersstatus)==0){
|
159 |
+
$ordersstatus = array(Mage_Sales_Model_Order::STATE_COMPLETE);
|
160 |
+
}
|
161 |
+
/** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
|
162 |
+
$yesterdayOrders = Mage::getResourceModel('sales/order_collection');
|
163 |
+
|
164 |
+
$yesterdayOrders->addAttributeToFilter('created_at', array(
|
165 |
+
'from' => $date->addDay(-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
|
166 |
+
'to'=>$date->addDay(1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)
|
167 |
+
))->addAttributeToSelect('*')
|
168 |
+
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
169 |
+
|
170 |
+
|
171 |
+
//collect today orders count
|
172 |
+
|
173 |
+
/** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
|
174 |
+
$todayOrders = Mage::getResourceModel('sales/order_collection');
|
175 |
+
$todayOrders->addAttributeToFilter('created_at', array('from' => $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
|
176 |
+
->addAttributeToSelect('*')
|
177 |
+
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
178 |
+
|
179 |
+
//collect max, min, average orders
|
180 |
+
$order = array();
|
181 |
+
if ($todayOrders->getSize()) {
|
182 |
+
$order['max'] = 0;
|
183 |
+
$order['min'] = 999999999999999;
|
184 |
+
$order['average'] = 0;
|
185 |
+
$ordersSum = 0;
|
186 |
+
|
187 |
+
foreach ($todayOrders as $item) {
|
188 |
+
|
189 |
+
if ($item->getBaseGrandTotal() > $order['max']) {
|
190 |
+
$order['max'] = Mage::helper('awonpulse')->getPriceFormat($item->getBaseGrandTotal());
|
191 |
+
}
|
192 |
+
|
193 |
+
if ($item->getBaseGrandTotal() < $order['min']) {
|
194 |
+
$order['min'] = Mage::helper('awonpulse')->getPriceFormat($item->getBaseGrandTotal());
|
195 |
+
}
|
196 |
+
|
197 |
+
$ordersSum += Mage::helper('awonpulse')->getPriceFormat($item->getBaseGrandTotal());
|
198 |
+
|
199 |
+
}
|
200 |
+
$order['average'] = Mage::helper('awonpulse')->getPriceFormat($ordersSum / $todayOrders->getSize());
|
201 |
+
} else {
|
202 |
+
$order['max'] = 0;
|
203 |
+
$order['min'] = 0;
|
204 |
+
$order['average'] = 0;
|
205 |
+
}
|
206 |
+
|
207 |
+
return array('yesterday_orders' => $yesterdayOrders->getSize(), 'today_orders' => $todayOrders->getSize(), 'orders_totals' => $order);
|
208 |
+
}
|
209 |
+
|
210 |
+
private function _getSales($date)
|
211 |
+
{
|
212 |
+
$ordersstatus = Mage::getStoreConfig('awonpulse/general/ordersstatus');
|
213 |
+
$ordersstatus = explode(',', $ordersstatus);
|
214 |
+
if (count($ordersstatus)==0){
|
215 |
+
$ordersstatus = array(Mage_Sales_Model_Order::STATE_COMPLETE);
|
216 |
+
}
|
217 |
+
$shiftedDate = $this->_getShiftedDate();
|
218 |
+
$shiftedDate->addDay(1);
|
219 |
+
$date->addDay(1);
|
220 |
+
$copyDate = clone $date;
|
221 |
+
$revenue = array();
|
222 |
+
for($i=0;$i<15;$i++){
|
223 |
+
/** @var $yesterdayOrders Mage_Sales_Model_Resource_Order_Collection */
|
224 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
225 |
+
$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)))
|
226 |
+
->addAttributeToSelect('*')
|
227 |
+
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
228 |
+
$date->addDay(-1);
|
229 |
+
$shiftedDate->addDay(-1);
|
230 |
+
$revenue[$i]['revenue']=0;
|
231 |
+
$revenue[$i]['date']=$shiftedDate->toString(Varien_Date::DATE_INTERNAL_FORMAT);
|
232 |
+
if($orders->getSize() > 0){
|
233 |
+
foreach($orders as $order){
|
234 |
+
$revenue[$i]['revenue']+=$order->getBaseGrandTotal();
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
$daysFrom1st=$copyDate->get(Zend_Date::DAY);
|
239 |
+
$orders = Mage::getModel('sales/order')->getCollection();
|
240 |
+
$orders->addAttributeToFilter('created_at', array('from' => $copyDate->addDay(-$daysFrom1st)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),'to'=>$copyDate->addDay($daysFrom1st-1)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)))
|
241 |
+
->addAttributeToSelect('*')
|
242 |
+
->addAttributeToFilter('status', array('in' => $ordersstatus));
|
243 |
+
$thisMonthSoFar = 0;
|
244 |
+
if($orders->getSize() > 0){
|
245 |
+
foreach($orders as $order){
|
246 |
+
$thisMonthSoFar+=$order->getBaseGrandTotal();
|
247 |
+
}
|
248 |
+
}
|
249 |
+
$thisMonthForecast = 0;
|
250 |
+
$numberDaysInMonth = $copyDate->get(Zend_Date::MONTH_DAYS);
|
251 |
+
$thisMonthAvg = $thisMonthSoFar /($daysFrom1st - 1);
|
252 |
+
$thisMonthForecast = $thisMonthAvg * $numberDaysInMonth;
|
253 |
+
$thisMonth = array();
|
254 |
+
$thisMonth['thisMonthSoFar'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthSoFar);
|
255 |
+
$thisMonth['thisMonthAvg'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthAvg);
|
256 |
+
$thisMonth['thisMonthForecast'] = Mage::helper('awonpulse')->getPriceFormat($thisMonthForecast);
|
257 |
+
|
258 |
+
return array('revenue'=>$revenue, 'thisMonth'=>$thisMonth);
|
259 |
+
}
|
260 |
+
}
|
app/code/local/AW/Onpulse/Model/Credentials.php
CHANGED
@@ -65,14 +65,6 @@ class AW_Onpulse_Model_Credentials extends Mage_Core_Model_Abstract
|
|
65 |
|
66 |
public function checkAuthorization()
|
67 |
{
|
68 |
-
if (Mage::getStoreConfig('advanced/modules_disable_output/AW_Onpulse')) {
|
69 |
-
$result = array(
|
70 |
-
'result'=>false,
|
71 |
-
'error'=>4,
|
72 |
-
'message'=>'Connector disabled'
|
73 |
-
);
|
74 |
-
die('['.serialize($result).']');
|
75 |
-
}
|
76 |
$authFlag = false;
|
77 |
//Check direct link
|
78 |
$authFlag = $this->_checkDirectLink();
|
@@ -88,6 +80,14 @@ class AW_Onpulse_Model_Credentials extends Mage_Core_Model_Abstract
|
|
88 |
);
|
89 |
// echo '['.serialize($result).']';
|
90 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
$aggregator = Mage::getSingleton('awonpulse/aggregator')->Aggregate();
|
92 |
$output = Mage::helper('awonpulse')->processOutput($aggregator);
|
93 |
echo serialize($output);
|
65 |
|
66 |
public function checkAuthorization()
|
67 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
$authFlag = false;
|
69 |
//Check direct link
|
70 |
$authFlag = $this->_checkDirectLink();
|
80 |
);
|
81 |
// echo '['.serialize($result).']';
|
82 |
} else {
|
83 |
+
if (Mage::getStoreConfig('advanced/modules_disable_output/AW_Onpulse')) {
|
84 |
+
$result = array(
|
85 |
+
'result'=>false,
|
86 |
+
'error'=>4,
|
87 |
+
'message'=>'Connector disabled'
|
88 |
+
);
|
89 |
+
die('['.serialize($result).']');
|
90 |
+
}
|
91 |
$aggregator = Mage::getSingleton('awonpulse/aggregator')->Aggregate();
|
92 |
$output = Mage::helper('awonpulse')->processOutput($aggregator);
|
93 |
echo serialize($output);
|
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.13</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>
|
@@ -9,11 +9,11 @@
|
|
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.
|
11 |
</description>
|
12 |
-
<notes
|
13 |
<authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
|
14 |
-
<date>2013-07-
|
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="08b4ef40a59046502997acfde2bf4d03"/><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="
|
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.13</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://onpulse.info/TOS.pdf">EULA</license>
|
7 |
<channel>community</channel>
|
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.
|
11 |
</description>
|
12 |
+
<notes>+ performance improvements</notes>
|
13 |
<authors><author><name>AW_Core_Team</name><user>aheadworks</user><email>no-reply@aheadworks.com</email></author></authors>
|
14 |
+
<date>2013-07-29</date>
|
15 |
+
<time>09:12:23</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="08b4ef40a59046502997acfde2bf4d03"/><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="e64a74103ab7b6c9cd93267b00dd5f79"/><file name="Statistics.php.orig" hash="919ccaa59b981eb624387937fa4390f1"/></dir></dir><file name="Aggregator.php" hash="fcb4342d583403a99ca7bc245115854f"/><file name="Credentials.php" hash="526d3b476480552ae03f38696bd6fc93"/></dir><dir name="etc"><file name="config.xml" hash="5f74ee63e9bb1ea38089125622df0d0a"/><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>
|