*

krallen

  • ***
  • 37 posts
latest-search code is not working.
« on: December 21, 2023, 06:37:27 PM »
I upgraded my osclass site from 3.8.0 to 8.2.1. It was working in 3.8.0, but 8.2.1 does not appear. The "Recently searched" section does not work after the upgrade.

On the demo site at https://epsilon.mb-themes.com/, the latest-search section under the "search bar" does not work.

latest-search code does not work in other themes.

I think this is a bug and needs to be fixed.

*

MB Themes

Re: latest-search code is not working.
« Reply #1 on: December 22, 2023, 08:51:08 AM »
Make sure its enabled and check DB tables for this functionality if it has correct structure.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

krallen

  • ***
  • 37 posts
Re: latest-search code is not working.
« Reply #2 on: December 24, 2023, 07:53:50 AM »
I have tested. I installed a fresh osclass 8.2.1 and installed the Epsilon theme. "latest-search" does not show results. But the old 3.8.0 version of osclass also shows recent searches in the search bar. Please test it yourself.

*

MB Themes

Re: latest-search code is not working.
« Reply #3 on: December 25, 2023, 09:04:21 AM »
Make sure its enabled and check DB tables for this functionality if it has correct structure.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

krallen

  • ***
  • 37 posts
Re: latest-search code is not working.
« Reply #4 on: May 10, 2024, 02:07:50 AM »
latest-search code is not working. A bug has occurred.

In the sample epsilon theme, there was a "latest-search" section under the search bar, but this section does not work even on demo sites. Please let's solve an important issue in terms of SEO.


*

MB Themes

Re: latest-search code is not working.
« Reply #5 on: May 13, 2024, 04:22:10 PM »
I think there is bug in Osclass core for long long time, but started to be issue now (for some reason).

In oc-includes/osclass/model/LatestSearches.php, try to replace your getSearches function with:

Code: [Select]
  public function getSearches($limit = 20, $sort = 'd_date') {
    $this->dao->select('s_search, MAX(d_date) as d_date, COUNT(s_search) as i_total');
    $this->dao->from($this->getTableName());
    $this->dao->groupBy('s_search');
    $this->dao->orderBy($sort, 'DESC');
    $this->dao->limit($limit);
    $result = $this->dao->get();

    if($result == false) {
      return false;
    }

    $data = $result->result();
    $output = array();
   
    if(is_array($data) && count($data) > 0 && osc_latest_searches_restriction() <> 0 && osc_latest_searches_words() <> '') {
      foreach($data as $row) {
        $word = osc_latest_search_filter($row['s_search']);
       
        if($word <> '') {
          $output[] = $row;
        }
      }
     
      return $output;
    }   
   
    return $data;
  }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots