Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Aug 2005
    Posts
    336
    Plugin Contributions
    0

    Default Searching in multiple languages

    The search currently only looks for words within the current language. I'd like to allow searching with any language, regardless of the current language.

    For instance, a customer could search with "cheese", "queso" or "fromage", if I had english, spanish, and french on my site.

    Any way to do this?
    Currently using ZEN CART v. 1.3.6

  2. #2
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: Searching in multiple languages

    At first, how can you easily tell the browser which part is english, spanish, and french on your site, and on the input field?

    In the first thought, to easy the task and all the languages should be in same encoding, the UTF-8 for example,
    A New Starter again

  3. #3
    Join Date
    Aug 2005
    Posts
    336
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    I switched the encoding to UTF-8 but nothing changed. In fact, I checked out another zen cart site using multiple languages and discovered it didn't allow searching in the unselected languages.

    Let me explain again, in case what I wrote earlier was confusing. If a customer has selected English, (and I also have french on my site), and they search for fromage, nothing comes up. They can only search by the chosen language -- cheese. Fromage will only bring up results if the customer has selected french as their language.

    It should find the products with the keywords from any language. Anybody know how to fix this?
    Currently using ZEN CART v. 1.3.6

  4. #4
    Join Date
    Jun 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    bump!

    I was looking at the same problem. We keep getting clients arriving from search engines, they search one term in the "wrong" language, and leave when they get no results.

  5. #5
    Join Date
    Jun 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    Change /includes/modules/pages/advanced_search/header.php, lines 200 to 207:

    $from_str = "FROM " . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_MANUFACTURERS . " m
    USING(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
    LEFT JOIN " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd
    ON mtpd.products_id= p2c.products_id";
    /* AND mtpd.language_id = :languagesID"; */

    /* $from_str = $db->bindVars($from_str, ':languagesID', $_SESSION['languages_id'], 'integer'); */

    In a quick test it seems to work.

  6. #6
    Join Date
    Aug 2005
    Posts
    336
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    Thanks dvdguy! I could have never tracked this down, so thanks for sharing.

    I'm surprised not many others care about this search limitation -- but I guess most are in a 1-language environment. Keep the thread posted if you come across any problems and I'll do the same.
    Currently using ZEN CART v. 1.3.6

  7. #7
    Join Date
    Jun 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    My partner advised me it wasn't totally working. There's a few other language selectors to remove in that same file. I don't know if this breaks anyhting else so keep your original file handy.

  8. #8
    Join Date
    Aug 2005
    Posts
    336
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    Yeah, I just noticed that it wasn't working right. Can we crack it? And by 'we', I mean you. I think this is way past my abilities, but I'm going to give it a shot.

    Also, for our viewers following along at home, I think you meant:
    includes/modules/pages/advanced_search_result/header.php
    Currently using ZEN CART v. 1.3.6

  9. #9
    Join Date
    Jun 2006
    Posts
    19
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    Hi Magicpants,

    It is working as far as I can tell. I just got back from a late-night courvoisier/saki/lobster feast so take it for what it's worth...

    Here's the other changes:


    Around line 228 comment out:
    /* mod: remove language selector :mod
    $where_str = " WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languagesID
    AND p.products_id = p2c.products_id
    AND p2c.categories_id = c.categories_id ";

    $where_str = $db->bindVars($where_str, ':languagesID',
    $_SESSION['languages_id'], 'integer'); */


    insert:


    $where_str = " WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND p.products_id = p2c.products_id
    AND p2c.categories_id = c.categories_id ";

    /* $where_str = $db->bindVars($where_str, ':languagesID', $_SESSION['languages_id'], 'integer'); */





    Around line 260 comment out :
    /* mod: remove language selector :mod
    $where_str .= " AND p2c.products_id = p.products_id
    AND p2c.products_id = pd.products_id
    AND pd.language_id = :languagesID
    AND p2c.categories_id = :categoriesID";

    $where_str = $db->bindVars($where_str, ':categoriesID', $_GET['categories_id'], 'integer');
    $where_str = $db->bindVars($where_str, ':languagesID', $_SESSION['languages_id'], 'integer'); */



    replace with or insert after:


    $where_str .= " AND p2c.products_id = p.products_id
    AND p2c.products_id = pd.products_id
    AND p2c.categories_id = :categoriesID";

    $where_str = $db->bindVars($where_str, ':categoriesID', $_GET['categories_id'], 'integer');


    If you are new to modifying files I suggest you keep good records or leave a standardized note to yourself so in 6 months you can remember what you did.

  10. #10
    Join Date
    Aug 2005
    Posts
    336
    Plugin Contributions
    0

    Default Re: Searching in multiple languages

    Thanks dvdguy,

    I installed it and tested it a bit -- seems to work fine except for one thing.

    It displays the product title in the language that matched the search term.

    For instance, if "milk" is used as a search term when spanish is the chosen language. The title for the product found will be 'Milk 1 Liter'. When clicking on the product, it takes you to the product info page, and it is correctly called 'Leche 1 Liter'. It should show up on the product listing page as 'Leche 1 Liter', since Spanish is the chosen language.

    It's strange mostly because you could have search results listing products in different languages right next to each other. Is there a way to fix this? So it searches through the product name in all languages but displays the name in the currently-selected language?

    That's the only weirdness I have found so far.
    Currently using ZEN CART v. 1.3.6

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Advanced searching of multiple categories
    By wackjum in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 21 Sep 2008, 02:11 AM
  2. ZenCart in multiple languages
    By lieven23 in forum General Questions
    Replies: 0
    Last Post: 26 Aug 2008, 01:23 PM
  3. Replies: 1
    Last Post: 24 Jan 2008, 07:45 PM
  4. Multiple (flash) headers with multiple languages
    By jurjenruben in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 29 Dec 2007, 11:18 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