*

katalin2k

  • ***
  • 90 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

  • ***
  • 90 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

  • ***
  • 90 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.

*

MB Themes

Re: Admin listings views not working
« Reply #5 on: January 21, 2025, 07:54:41 AM »
I have not told to replace, just pointed you where to look and debug.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 90 posts
Re: Admin listings views not working
« Reply #6 on: January 23, 2025, 08:30:17 PM »
Ok but I am not very experienced so I can’t make it work…

*

MB Themes

Re: Admin listings views not working
« Reply #7 on: January 27, 2025, 07:24:25 AM »
You should have tech person that can help you with such issues or look for developer.
Unfortunately, for open-source there is never dedicated support that would solve your specific issues.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 90 posts
Re: Admin listings views not working
« Reply #8 on: January 27, 2025, 08:52:35 PM »
You should have tech person that can help you with such issues or look for developer.
Unfortunately, for open-source there is never dedicated support that would solve your specific issues.
But this is a bug from osclass, don't you think some developer that helped build it should try and help me fix the issue?

*

MB Themes

Re: Admin listings views not working
« Reply #9 on: January 28, 2025, 09:48:52 PM »
No, as it looks like issue on your side (never seen anyone having such problem). You must debug by yourself.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 90 posts
Re: Admin listings views not working
« Reply #10 on: February 09, 2025, 05:31:38 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;

            }
          }
        }
Isn't this code for adding new views to listings? I said I see 0x views in admin backend under Listings section.

*

MB Themes

Re: Admin listings views not working
« Reply #11 on: February 10, 2025, 09:36:39 AM »
Correct, it is, so you should debug it and identify which part it does not like.
My guess is that it might be related to user agents.

Try this.
Go to oc-includes/osclass/user-agents.php

Replace old list:
Code: [Select]
$user_agents = array(
  'MSIE ([0-9].*)$',
  '^Mozilla/[0-9].([^c][^o][^m].)$',
  '^Mozilla/5.*Gecko',
  '^Mozilla/5.(PLAYSTATION.)',
  'Safari',
  'Omni',
  'iCab',
  'Opera',
  'Konqueror',
  'AOL',
  'MSN',
  'WebTV',
  'BlackBerry.*'
);

With new list:
Code: [Select]
  $user_agents = array(
    'MSIE ([0-9].*)$',
    '^Mozilla/[0-9].([^c][^o][^m].)$',
    '^Mozilla/5.*Gecko',
    '^Mozilla/5.(PLAYSTATION.)',
    'Safari',
    'Omni',
    'iCab',
    'Opera',
    'Konqueror',
    'AOL',
    'MSN',
    'WebTV',
    'BlackBerry.*',
    'Trident/.*rv:11\.0',
    'Chrome',
    'CriOS',
    'FxiOS',
    'Edge',
    'Edg/',
    'OPR',
    'Firefox',
    'SamsungBrowser',
    'UCBrowser'
  );
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 90 posts
Re: Admin listings views not working
« Reply #12 on: February 10, 2025, 06:27:44 PM »
Correct, it is, so you should debug it and identify which part it does not like.
My guess is that it might be related to user agents.

Try this.
Go to oc-includes/osclass/user-agents.php

Replace old list:
Code: [Select]
$user_agents = array(
  'MSIE ([0-9].*)$',
  '^Mozilla/[0-9].([^c][^o][^m].)$',
  '^Mozilla/5.*Gecko',
  '^Mozilla/5.(PLAYSTATION.)',
  'Safari',
  'Omni',
  'iCab',
  'Opera',
  'Konqueror',
  'AOL',
  'MSN',
  'WebTV',
  'BlackBerry.*'
);

With new list:
Code: [Select]
  $user_agents = array(
    'MSIE ([0-9].*)$',
    '^Mozilla/[0-9].([^c][^o][^m].)$',
    '^Mozilla/5.*Gecko',
    '^Mozilla/5.(PLAYSTATION.)',
    'Safari',
    'Omni',
    'iCab',
    'Opera',
    'Konqueror',
    'AOL',
    'MSN',
    'WebTV',
    'BlackBerry.*',
    'Trident/.*rv:11\.0',
    'Chrome',
    'CriOS',
    'FxiOS',
    'Edge',
    'Edg/',
    'OPR',
    'Firefox',
    'SamsungBrowser',
    'UCBrowser'
  );
Replaced code but I still see 0x views for all listings in admin Manage listings: https://prnt.sc/wzzSMAc6S-Dm

*

MB Themes

Re: Admin listings views not working
« Reply #13 on: February 12, 2025, 03:09:29 PM »
>>> database debug.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

katalin2k

  • ***
  • 90 posts
Re: Admin listings views not working
« Reply #14 on: February 12, 2025, 09:22:05 PM »
>>> database debug.
A little more specific please?