This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

slaven

  • ***
  • 99 posts
After upgrading to 8.3, the search for ads by ID does not work.


/oc-admin/index.php?page=items  --->


Search by: Pattern item ID: No data available in table


Note: Pattern and Email search works!

Osclass

*

MB Themes

Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #1 on: June 05, 2025, 03:19:39 PM »
Thanks, we've identified issue with linking of one table to query.
Will be fixed in 8.3.1
I think you still can search by Id when selecting "Pattern" search.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

slaven

  • ***
  • 99 posts
Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #2 on: June 05, 2025, 03:27:37 PM »
Yes, in the search pattern, only the text search works, but not the ID number.
Osclass

*

MB Themes

Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #3 on: June 05, 2025, 03:58:59 PM »
I see thanks, I just did test and actually there was some random number in listing :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

slaven

  • ***
  • 99 posts
Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #4 on: June 09, 2025, 08:43:52 AM »
Let's not wait for an update again ... how can we fix this error ourselves?
Osclass

Marked as best answer by alexborg on October 15, 2025, 08:51:10 PM
*

krallen

  • ***
  • 48 posts
Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #5 on: October 13, 2025, 03:56:36 PM »
[FIXED] Bug in v8.3.0: Admin Search by Item ID Not Working
Hello everyone,

I'm writing to share a bug I've found after upgrading from Osclass 8.2.1 to 8.3.0, along with a working solution.

The Problem

On the admin dashboard, under Manage Listings, the filter to search for a listing by its specific Item ID no longer works in version 8.3.0.

In version 8.2.1: Searching for an Item ID (e.g., 1) correctly finds and displays the corresponding listing.

In version 8.3.0: The same search results in "No data available in table," even though the listing exists. A key detail is the message "Showing 0 to 0 of 0 results (filtered from 1 total results)," which confirms the system finds the item but incorrectly filters it out.

Root Cause Analysis

After comparing the core files between the two versions, the issue is located in the _makeSQL() function within the following file:
oc-includes/osclass/model/Search.php

In version 8.2.1, a search by Item ID was treated as a special case, bypassing all other default filters (e.g., b_active, b_enabled, etc.). This is the correct behavior.

In version 8.3.0, the logic was changed. Now, when searching by Item ID, the system also applies the default filters. If the listing you are searching for does not meet one of these other conditions (for instance, if it's inactive or blocked), the search will fail and return an empty result.

The Solution

The fix involves restoring the correct search logic from version 8.2.1. By making a small change to the Search.php file, we can ensure that an Item ID search is prioritized and executed correctly.

Warning: Always create a backup of your files before making any code changes.

Open the file:
oc-includes/osclass/model/Search.php

Locate the _makeSQL() function (around line 1215).

Find the following block of code:

PHP
Code: [Select]
$sql = '';

if($count) {
  $this->dao->select('count(DISTINCT ' . DB_TABLE_PREFIX . 't_item.pk_i_id) as count');

} else {
  $this->dao->select(sprintf('%st_item.*, %st_item.s_contact_name as s_user_name', DB_TABLE_PREFIX, DB_TABLE_PREFIX));

  if($extraFields != '') {
    $this->dao->select($extraFields);       // plugins and extra columns in select
  }
}

$this->dao->from(sprintf('%st_item', DB_TABLE_PREFIX));

// Search by item ID
if($this->withItemId) {
  $this->dao->where('pk_i_id', (int)$this->itemId);

} else {
  // ... the rest of the function continues here
Replace the entire block above with the corrected code below. This new code checks for an Item ID search first and handles it separately, just like in version 8.2.1.

PHP
Code: [Select]
$sql = '';

if($this->withItemId) {
  // add field s_user_name
  $this->dao->select(sprintf('%st_item.*, %st_item.s_contact_name as s_user_name', DB_TABLE_PREFIX, DB_TABLE_PREFIX));
  $this->dao->from(sprintf('%st_item', DB_TABLE_PREFIX));
  $this->dao->where('pk_i_id', (int)$this->itemId);

} else {
  if($count) {
    $this->dao->select('count(DISTINCT ' . DB_TABLE_PREFIX . 't_item.pk_i_id) as count');

  } else {
    $this->dao->select(DB_TABLE_PREFIX.'t_item.*, '.DB_TABLE_PREFIX.'t_item.s_contact_name as s_user_name');
    if($extraFields != '') {
      $this->dao->select($extraFields); // plugins!
    }
  }

  $this->dao->from(DB_TABLE_PREFIX.'t_item');

  // ... the rest of the function continues here

Save the file and upload it back to your server.

This change has fixed the issue on my installation, and the Item ID search now works perfectly.

I hope this solution is helpful for the community and that the developers can incorporate a permanent fix in the next official release.

Best regards.

*

slaven

  • ***
  • 99 posts
Re: After upgrading to 8.3, the search for ads by ID does not work
« Reply #6 on: October 15, 2025, 08:52:24 PM »
This works perfectly. Thank you very much!
Osclass