I just made up this function, which you can place into the theme folder file called functions.php. This function simply adds-up all item views for all items.
function site_total_views() {
$conn = getConnection();
$results=$conn->osc_dbFetchResults("SELECT i_num_views FROM %st_item_stats", DB_TABLE_PREFIX);
if(count($results)>0){
$view_count = 0;
foreach($results as $result){
$view_count += $result['i_num_views']; // Add-up all item views stored in database
}
}
return $view_count;
}
Then, you can call this function from anywhere on your website:
Total item views:
<?php echo site_total_views(); ?>
Note: since the above code only adds up individual item page views, it does NOT show total view to your site, including any visitors to your "main" page, search pages, or any other non-item page.