Statistics are broken.

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


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
(Support Team)
User admin
Name: Admin
Posts: 21477
Aw: Statistics are broken.



Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
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.