Thread: Instant Search

Results 1 to 10 of 248

Threaded View

  1. #11
    Join Date
    Feb 2012
    Location
    Croatia
    Posts
    1
    Plugin Contributions
    0

    Default Re: Instant Search

    Quote Originally Posted by AyoobG View Post
    Hi, the json_encode() function is a php function which sends data from php format into javascript format.

    If some of the products contain foreign characters like è then json_encode won't work properly, and the product containing the character will stop instant search from functioning properly, hence the error.

    However if you open searches.php and replace:

    echo json_encode($results);

    with:

    Code:
    echo json_encode(utf8json($results));
    
    function utf8json($inArray) {
    
        static $depth = 0;
    
        /* our return object */
        $newArray = array();
    
        /* safety recursion limit */
        $depth ++;
        if($depth >= '30') {
            return false;
        }
    
        /* step through inArray */
        foreach($inArray as $key=>$val) {
            if(is_array($val)) {
                /* recurse on array elements */
                $newArray[$key] = utf8json($val);
            } else {
                /* encode string values */
                $newArray[$key] = utf8_encode($val);
            }
        }
    
        /* return utf8 encoded array */
        return $newArray;
    }

    then it will be able to convert these foreign characters properly.
    I have similar problem. I am using utf-8_general_ci in zencart database, Instant search works fine for me, but when i enter special character like (čćžšđ) if wont display anything.
    Here is a two picture below. Please help!
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	search.jpg 
Views:	82 
Size:	27.2 KB 
ID:	10315   Click image for larger version. 

Name:	search1.jpg 
Views:	113 
Size:	24.2 KB 
ID:	10316  

 

 

Similar Threads

  1. Instant Quote
    By Congerman in forum General Questions
    Replies: 2
    Last Post: 15 Aug 2012, 12:29 PM
  2. Instant Coupon
    By Mickmo68 in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 4
    Last Post: 22 Dec 2008, 08:19 PM
  3. Instant Delivery?
    By eaglewu in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 30 Jul 2007, 09:30 AM
  4. changes instant
    By chufty bill in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Sep 2006, 07:12 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR