// Cannot use analytics real time at this time since it is in private beta
This commit is contained in:
@@ -85,8 +85,6 @@ class Dashactivity extends Module
|
||||
$visits = $result[0]['metrics']['visits'];
|
||||
$unique_visitors = $result[0]['metrics']['visitors'];
|
||||
}
|
||||
if ($result = $gapi->requestReportData('', 'ga:activeVisitors', null, null, null, null, 1, 1))
|
||||
$online_visitor = $result[0]['metrics']['activeVisitors'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -96,26 +94,29 @@ class Dashactivity extends Module
|
||||
WHERE `date_add` BETWEEN "'.pSQL($params['date_from']).'" AND "'.pSQL($params['date_to']).'"
|
||||
'.Shop::addSqlRestriction(false));
|
||||
extract($row);
|
||||
|
||||
if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP'))
|
||||
$maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))));
|
||||
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
|
||||
$sql = 'SELECT COUNT(DISTINCT c.id_connections)
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections
|
||||
WHERE TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
|
||||
AND cp.`time_end` IS NULL
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '');
|
||||
else
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE TIME_TO_SEC(TIMEDIFF(NOW(), `date_add`)) < 900
|
||||
'.Shop::addSqlRestriction(false).'
|
||||
'.($maintenance_ips ? 'AND ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '');
|
||||
$online_visitor = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
// Online visitors is only available with Analytics Real Time still in private beta at this time (October 18th, 2013).
|
||||
// if ($result = $gapi->requestReportData('', 'ga:activeVisitors', null, null, null, null, 1, 1))
|
||||
// $online_visitor = $result[0]['metrics']['activeVisitors'];
|
||||
if ($maintenance_ips = Configuration::get('PS_MAINTENANCE_IP'))
|
||||
$maintenance_ips = implode(',', array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))));
|
||||
if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS'))
|
||||
$sql = 'SELECT COUNT(DISTINCT c.id_connections)
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections_page` cp ON c.id_connections = cp.id_connections
|
||||
WHERE TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
|
||||
AND cp.`time_end` IS NULL
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
'.($maintenance_ips ? 'AND c.ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '');
|
||||
else
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE TIME_TO_SEC(TIMEDIFF(NOW(), `date_add`)) < 900
|
||||
'.Shop::addSqlRestriction(false).'
|
||||
'.($maintenance_ips ? 'AND ip_address NOT IN ('.preg_replace('/[^,0-9]/', '', $maintenance_ips).')' : '');
|
||||
$online_visitor = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
|
||||
$pending_orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
|
||||
Reference in New Issue
Block a user