1. Osclass Forum
  2. General
  3. Pagination in osclass categories is not working in rtl langu...

Pagination in osclass categories is not working in rtl languages ar or zh etc...

Started by medmodir, October 24, 2024, 9:04 pm

  • 1

medmodir

Hello,

Pagination in osclass categories is not working in rtl languages ar or zh etc...
I also noticed this error in all themes demo and osclass demo

The error appears with pagination 1 2 3or next in categories.
For example, when moving from page 1 to 2, the page does not open and the error type does not appear in the error log.

Example url for ar

Example url for zh

Please suggest a solution for the problem.

Thanks



medmodir

Does anyone know what file is responsible for this glitch in the above mentioned problem.. so I can work on fixing it?

calinbehtuk

I didn't have time to check but i will make some tests.

medmodir

Thank you for trying to help and I hope you share your experience. I am waiting for you.
Best regards

medmodir

Hello
Is there anything new if you can provide a solution to this error it will be appreciated
Thank you

calinbehtuk

I made some investigation, and i think i found a bug in the code, but i am not sure 100%.

In oc-includes/osclass/model/search.php around line 100 it's a condition that will run if all the code above will not set the category

Code: [Select]
​$category = Category::newInstance()->findBySlug($search_uri);

And this code will search for the category slug from the link but if the name of the category is urlencode already in the link the function that search after slug will urlencode again the category


Code: [Select]
​  public function findBySlug($slug)
  {
    $slug = trim((string)$slug);
    if($slug!='') {
      if(isset($this->_slugs[$slug])) {
        return $this->findByPrimaryKey($this->_slugs[$slug]);
      }
      $slug = urlencode($slug);

      // $this->dao->where('b.s_slug', $slug);
      // end specific condition

      $results = $this->listWhere('b.s_slug = %s', $slug);
      if (count($results) > 0) {
        $this->_slugs[$slug] = $results[0]['pk_i_id'];
        return $results[0];
      }
    }
    return array();
  }






  • << Last edit: November 5, 2024, 11:33 am by calinbehtuk >>
  • Quote

medmodir

Thank you very much for your effort. Your concern is appreciated.
But I have not reached a solution yet. I will review this file in case I reach a solution.
Regards

calinbehtuk

A temporary solution


Old code

Code: [Select]
​ try {
              $category = Category::newInstance()->findBySlug($search_uri);
            } catch (Exception $e) {
            }
           
            if(count($category) === 0) {
              $this->do404();
            }
           
            Params::setParam('sCategory', $search_uri);



New code


Code: [Select]
​            try {
              $sD= urldecode($search_uri);
              $category = Category::newInstance()->findBySlug($sD);
            } catch (Exception $e) {
            }
           
            if(count($category) === 0) {
              $this->do404();
            }
           
            Params::setParam('sCategory', $sD);


But this is only temporary, I haven't had time to test to see if everything is fine.

medmodir

Thank you for helping me find a solution but I see some differences in the file code oc-includes/osclass/model/search.php
What version of osclass are you using?
I am using the latest version is Osclass 8.2.1

medmodir

The solution was done through the last code and now I am testing everything. Thank you very much for the excellent technical support. You are a genius. My regards to you.

  • 1
Subscribe
X

Subscribe!

Subscribe to get the latest listings, updates and special offers delivered directly in your inbox.