Jimbo50 Posted February 18, 2011 Share Posted February 18, 2011 Why is it that when I look in Back Office it shows the number of people on line eg 7, but when I look in Stats at Visitors or View People on Line it bears no resemblance to the figure 7? Link to comment Share on other sites More sharing options...
shokinro Posted February 18, 2011 Share Posted February 18, 2011 here is what I understand1. the visitors online at "Home Page" of your back office include customer (logged in) and none customer (guest).2. At "Stats Tab", visitors online means guest only and customers online means logged in customersUsually you(we) will think that it should be: total of 1 = total of 2 but the result is different because the data is corrected in different criteria.If you understand SQL, you will find out why they are different.Just for your reference, here are the SQL code (from PS version 1.3.2.3)Home - on line visitors return Db::getInstance()->getValue(' SELECT COUNT(DISTINCT cp.`id_connections`) FROM `'._DB_PREFIX_.'connections_page` cp WHERE TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900'); Stats Tab - Visitors Online return Db::getInstance()->ExecuteS(' SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, pt.name as page FROM `'._DB_PREFIX_.'connections` c LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections LEFT JOIN `'._DB_PREFIX_.'page` p ON p.id_page = cp.id_page LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest WHERE (g.id_customer IS NULL OR g.id_customer = 0) AND cp.`time_end` IS NULL AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900 GROUP BY c.id_connections ORDER BY c.date_add DESC'); Stats Tab - Customers Online return Db::getInstance()->ExecuteS(' SELECT u.id_customer, u.firstname, u.lastname, pt.name as page FROM `'._DB_PREFIX_.'connections` c LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections LEFT JOIN `'._DB_PREFIX_.'page` p ON p.id_page = cp.id_page LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer WHERE cp.`time_end` IS NULL AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900 GROUP BY c.id_connections ORDER BY u.firstname, u.lastname'); 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