Andrejkov Posted February 12, 2024 Share Posted February 12, 2024 Hi, I have problem with my stores fresh installation. I dont know why Dashboard statistic does not work. I have Sales, orders, visits and conversion in store but dashboard stats showing 0. How to fix it? Regards. Link to comment Share on other sites More sharing options...
Olivier CLEMENCE Posted February 12, 2024 Share Posted February 12, 2024 Hello i don't know why your dashboard doesn't work but becareful all data are not accurate in default PrestaShop statistic module. You can try my module if you want more accurate data : https://addons.prestashop.com/en/analytics-statistics/90621-opart-stat-reliable-and-useful-ecommerce-statistics.html Link to comment Share on other sites More sharing options...
ZikmaSolutions Posted February 10 Share Posted February 10 Maybe its too late. But there is fix. Prestashop count only orders with generated invoice. If you want to avoid that change code in /controller/AdminStatsController.php on line 267. public static function getOrders($date_from, $date_to, $granularity = false) { if ($granularity == 'day') { $orders = []; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( ' SELECT LEFT(`date_add`, 10) AS date, COUNT(*) AS orders FROM `' . _DB_PREFIX_ . 'orders` o WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" ' . Shop::addSqlRestriction(false, 'o') . ' GROUP BY LEFT(`date_add`, 10)' ); foreach ($result as $row) { $orders[strtotime($row['date'])] = $row['orders']; } return $orders; } elseif ($granularity == 'month') { $orders = []; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS( ' SELECT LEFT(`date_add`, 7) AS date, COUNT(*) AS orders FROM `' . _DB_PREFIX_ . 'orders` o WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" ' . Shop::addSqlRestriction(false, 'o') . ' GROUP BY LEFT(`date_add`, 7)' ); foreach ($result as $row) { $orders[strtotime($row['date'] . '-01')] = $row['orders']; } return $orders; } else { $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue( ' SELECT COUNT(*) AS orders FROM `' . _DB_PREFIX_ . 'orders` o WHERE `date_add` BETWEEN "' . pSQL($date_from) . ' 00:00:00" AND "' . pSQL($date_to) . ' 23:59:59" ' . Shop::addSqlRestriction(false, 'o') ); } return $orders; } 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now