*

katalin2k

  • ***
  • 57 posts
Admin listings views not working
« on: January 05, 2025, 05:04:56 PM »
In admin backend when I go to see all listings view count is not working: https://prnt.sc/wr_HZoi81FEj
I use latest OSC.

*

MB Themes

Re: Admin listings views not working
« Reply #1 on: January 08, 2025, 11:06:02 AM »
Views are not counted for users logged-in as admin.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 57 posts
Re: Admin listings views not working
« Reply #2 on: January 08, 2025, 09:08:42 PM »
I understand that but I also browse incognito to make tests and it seems that it doesn't count any of that also. As you can see in the attached image it shows 0 for all and some show 0x0x, which is very strange.

*

MB Themes

Re: Admin listings views not working
« Reply #3 on: January 11, 2025, 08:47:33 PM »
There could be some issue, try to debug osclass and see errors. Also database logs.

Check this section in oc-includes/osclass/controller/item.php

Code: [Select]
        if(!osc_is_admin_user_logged_in() && !($item['fk_i_user_id']!='' && $item['fk_i_user_id']==osc_logged_user_id())) {
          require_once(osc_lib_path() . 'osclass/user-agents.php');
          foreach($user_agents as $ua) {
            if(preg_match('|'.$ua.'|', Params::getServerParam('HTTP_USER_AGENT'))) {
              $mStats = new ItemStats();
              $mStats->increase('i_num_views', $item['pk_i_id']);
                break;

            }
          }
        }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 57 posts
Re: Admin listings views not working
« Reply #4 on: January 13, 2025, 10:18:00 PM »
Mine looks like this:
Code: [Select]
        if(!osc_is_admin_user_logged_in() && !(osc_is_web_user_logged_in() && $item['fk_i_user_id'] == osc_logged_user_id())) {
          require_once(osc_lib_path() . 'osclass/user-agents.php');
          foreach($user_agents as $ua) {
            if(preg_match('|'.$ua.'|', Params::getServerParam('HTTP_USER_AGENT'))) {
              $mStats = new ItemStats();
              $mStats->increase('i_num_views', $item['pk_i_id']);
              break;
            }
          }
        }
I tried to replace with yours but I still get 0 views in backend for each listing. Frontend views work fine, the issue is in admin backend.