Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default UTF8 problems with Advanced Search

    I am using UTF8 encoding for my English/Bulgarian zen-cart.The problem is that when I insert Cyrillic text in the keywords field in Advanced Search i always get "There is no product that matches the search criteria."If I use Latin keywords everything works fine.In my database all the products names and descriptions are written in the correct Cyrillic and Latin characters.
    Any help on this issue would be much appreciated!

  2. #2
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    In \includes\functions\functions_general.php i removed the STRTOLOWER() part by changing

    PHP Code:
    function zen_parse_search_string($search_str '', &$objects) {
    $search_str trim(strtolower($search_str)); 
    to

    PHP Code:
     function zen_parse_search_string($search_str '', &$objects) {
    $search_str trim($search_str); 
    and it seems to be working fine with both Cyrillic and English chars but i guess it may lead to some other kind of problems with the search modlue.Any suggestions of a better solution to this issue are welcome.

  3. #3
    Join Date
    Oct 2006
    Posts
    24
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    Hi, I also run Englsih/Bulgarian ZenCart on UTF-8 and even with that tweak the search does not work for cyrillic characters. You say you only have problems with the advanced search, I have problems with the advanced search as well as with the simple search sidebox. Any one can help, please?

  4. #4
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    Simple search directs you to advanced search so i refer as advanced search to both of them:)

    If you use utf8 for your English/Bulgarian zen-cart you should do some other changes before everything works correct.

  5. #5
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    1.All of your mysql tables must use utf8 charset and be in utf8_general_ci collation

    2.Your language files (English.php Bulgarian.php) must contain :

    PHP Code:
    define('CHARSET''utf-8'); 
    3.your /includes/classes/db/mysql/query_factory.php about line 37 must be changed from

    PHP Code:
    function connect($zf_host$zf_user$zf_password$zf_database$zf_pconnect 'false'$zp_real false) {
    //@TODO error class required to virtualise & centralise all error reporting/logging/debugging
        
    $this->database $zf_database;
        if (!
    function_exists('mysql_connect')) die ('Call to undefined function: mysql_connect().  Please install the MySQL Connector for PHP');
        if (
    $zf_pconnect != 'false') {
          
    $this->link = @mysql_connect($zf_host$zf_user$zf_passwordtrue);
        } else {
        
    // pconnect disabled ... leaving it as "connect" here instead of "pconnect"
          
    $this->link = @mysql_connect($zf_host$zf_user$zf_passwordtrue);
        }
        if (
    $this->link) {
          if (@
    mysql_select_db($zf_database$this->link)) {
            
    $this->db_connected true;
            return 
    true;
          } else {
            
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
            return 
    false;
          }
        } else {
          
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
          return 
    false;
        }
      } 
    to

    PHP Code:
    function connect($zf_host$zf_user$zf_password$zf_database$zf_pconnect 'false'$zp_real false) {
    //@TODO error class required to virtualise & centralise all error reporting/logging/debugging
        
    $this->database $zf_database;
        if (!
    function_exists('mysql_connect')) die ('Call to undefined function: mysql_connect().  Please install the MySQL Connector for PHP');
        if (
    $zf_pconnect != 'false') {
          
    $this->link = @mysql_connect($zf_host$zf_user$zf_passwordtrue);
        } else {
        
    // pconnect disabled ... leaving it as "connect" here instead of "pconnect"
          
    $this->link = @mysql_connect($zf_host$zf_user$zf_passwordtrue);
        }
        if (
    $this->link) {
          if (@
    mysql_select_db($zf_database$this->link)) {

                if (
    version_compare(mysql_get_server_info(), '4.1.0''>=')) {
                
    mysql_query('SET NAMES "utf8"'$this->link);}
             
           
    $this->db_connected true;
            return 
    true;
          } else {
            
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
            return 
    false;
          }
        } else {
          
    $this->set_error(mysql_errno(),mysql_error(), $zp_real);
          return 
    false;
        }
      } 
    4.You must ensure that your bulgarian.php defines are written in utf-8 or they will come up as monkeys :)

  6. #6
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    Its also a good idea to take a look at your mysql tables using phpmyadmin or some other mysql administrator tool and see if your cyrillic symbols are displayed correctly.

  7. #7
    Join Date
    Oct 2006
    Posts
    24
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    Thanks a lot, it turned out that the collation of my database/tables was wrong. Now that is corrected, my simple and advanced searches are working fine.

    It is interesting to note that the search is working without modifying query_factory.php

  8. #8
    Join Date
    Jul 2007
    Posts
    12
    Plugin Contributions
    1

    Default Re: UTF8 problems with Advanced Search

    Hi, I had the same problem, and I solved it as I changed my site to utf-8, and followed your steps. However there came another problem. Almost everywhere in Bulgarian part there is "Your profile was created" instead for example "Welcome to our shop!" and "Home: creating profile" instead "Home : advanced search". In English this is OK Any help is appreciated.

  9. #9
    Join Date
    Aug 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: UTF8 problems with Advanced Search

    Check the files in "includes/languages/bulgarian/your_template/" and "includes/languages/your_template/bulgarian.php" maybe they are not translated correctly.

 

 

Similar Threads

  1. Modify Advanced Search Fields
    By JimRoster in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 9 Oct 2011, 07:41 AM
  2. Advanced Search
    By dencom in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 10 Sep 2009, 12:34 PM
  3. Advanced Search out of memory
    By goshman in forum Installing on a Linux/Unix Server
    Replies: 9
    Last Post: 5 Aug 2007, 07:52 AM
  4. Can Advanced Search include separate Subcategory dropdown?
    By creative in forum Customization from the Admin
    Replies: 0
    Last Post: 24 Jul 2007, 08:59 PM
  5. Music included in advanced search
    By Timacek in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Dec 2006, 12:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •