Statistics are broken.

10.04.2013 13:59
#1
kovoks
Joomshopping forum user no avatar
Name: kovoks
28.03.2012
Posts: 30
Quote
Statistics are broken.

administrator/index.php?option=com_jshopping&controller=statistic

is broken for the columns this week and this month. The code does not take into account the year, so you retrieve all orders for the month '4', regardless of the year. This means you also get orders from april 2012 in the column 'this month'. Suggested patch is attached.


--- administrator/components/com_jshopping/models/statistic.php.orig 2013-04-10 13:56:38.000000000 +0200
+++ administrator/components/com_jshopping/models/statistic.php 2013-04-10 13:57:20.000000000 +0200
@@ -28,6 +28,9 @@
if ($time=='week') $where=" WEEK(DATE_FORMAT(ord.`order_date`,'%Y-%m-%d'))=WEEK(DATE_FORMAT(NOW(),'%Y-%m-%d')) ";
if ($time=='month') $where=" MONTH(DATE_FORMAT(ord.`order_date`,'%Y-%m-%d'))=MONTH(DATE_FORMAT(NOW(),'%Y-%m-%d')) ";
if ($time=='year') $where=" YEAR(DATE_FORMAT(ord.`order_date`,'%Y-%m-%d'))=YEAR(DATE_FORMAT(NOW(),'%Y-%m-%d')) ";
+
+ if ($time=='month' || $time == 'week') $where .=" and YEAR(DATE_FORMAT(ord.`order_date`,'%Y-%m-%d'))=YEAR(DATE_FORMAT(NOW(),'%Y-%m-%d')) ";
+

$query = "SELECT count(ord.`order_id`) AS amount, SUM(ord.`order_total`/ord.`currency_exchange`) AS total_sum, ord.`order_status`, s.`".$lang->get('name')."` as status_name FROM `#__jshopping_order_status` AS s
LEFT JOIN `#__jshopping_orders` AS ord ON s.`status_id` = ord.`order_status`
@@ -124,4 +127,4 @@
}
}



Joomla: latest
JoomShopping: latest
PHP: whatever
MySQL: whatever
Website Url: anonymous.
 
10.04.2013 20:12
#2
webdesigner
(Support Team)
User webdesigner
Name: Admin
05.08.2010
Posts: 19071
Quote
Aw: Statistics are broken.

Thanks.

 


Copyrights MAXXmarketing GmbH. All Rights Reserved
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.