Results 1 to 5 of 5
  1. #1

    Default Case sensitive sreach

    Hi,
    I notice that search is case sensitive. If in description of the products there is a word "Good" and i run a search for word "good", the search return zero results, but if i type "Good" the search results contains all products with this word.
    How i can make this search to be not case sensitive?
    Thank you in advance

  2. #2

    Default Re: Case sensitive sreach

    Any suggestions?

  3. #3
    Join Date
    Apr 2009
    Posts
    25
    Plugin Contributions
    0

    Default Re: Case sensitive search (Search not working right)

    Hey there. I ran into the same problem. Did a little searching through the php files and found one that needed a few lines code altered. Here is the file and the location:

    includes/modules/pages/advanced_search_result/header_php.php

    Obviously, back up your file before making this change.

    I changed mainly two things. First I convert the string of text entered by the user to lower case. Next I convert all of the database fields being searched to lower case. That's it. Here is a block of code where the changes are. It starts around line 292.

    copy code from below here ====================

    if (isset($keywords) && zen_not_null($keywords)) {
    if (zen_parse_search_string(stripslashes($_GET['keyword']), $search_keywords)) {

    $keywords = strtolower($keywords);

    $where_str .= " AND (";
    for ($i=0, $n=sizeof($search_keywords); $i<$n; $i++ ) {
    switch ($search_keywords[$i]) {
    case '(':
    case ')':
    case 'and':
    case 'or':
    $where_str .= " " . $search_keywords[$i] . " ";
    break;
    default:
    $where_str .= "(lower(pd.products_name) LIKE '%:keywords%'
    OR lower(p.products_model)
    LIKE '%:keywords%'
    OR lower(m.manufacturers_name)
    LIKE '%:keywords%'";

    $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');
    // search meta tags
    $where_str .= " OR (lower(mtpd.metatags_keywords)
    LIKE '%:keywords%'
    AND mtpd.metatags_keywords !='')";

    $where_str = $db->bindVars($where_str, ':keywords', $search_keywords[$i], 'noquotestring');

    $where_str .= " OR (lower(mtpd.metatags_description)
    LIKE '%:keywords%'
    AND mtpd.metatags_description !='')";

    copy code from above here ========================


    Hope that helps. I'm glad I could finally make a contribution. This forum has helped me many times.

    - Michael Stein

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Case sensitive search (Search not working right)

    Remember that strtolower() is only reliable with latin language encoding. It does not work with multibyte language charactersets.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Feb 2011
    Posts
    1
    Plugin Contributions
    0

    Default Re: Case sensitive search (Search not working right)

    Quote Originally Posted by DrByte View Post
    Remember that strtolower() is only reliable with latin language encoding. It does not work with multibyte language charactersets.
    Then what should I do if I have the same problem but with unicode characters? Actually, the problem is not quite the same: my search is working fine (it is not case-sensitive) with simple characters, but the special Hungarian vowels seem to be case-sensitive.

    E.g. both pir and Pir work for piros but
    űrk does not work for Űrkutatás

    I'm using v1.3.9h, and I just can't figure this out..

    Any suggestions?

    Thanks in advance!

 

 

Similar Threads

  1. v139h Coupon Codes Case Sensitive
    By sports guy in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 2
    Last Post: 13 Feb 2013, 04:19 PM
  2. v138a Search is case sensitive
    By Vix332 in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 4 Jan 2013, 05:51 PM
  3. v139h Why is my URL case sensitive?
    By mdostal in forum General Questions
    Replies: 2
    Last Post: 23 Oct 2012, 05:37 PM
  4. Case by case CSS button override. Possible?
    By runlikeagirl in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 3 Aug 2011, 02:34 AM
  5. Case Sensitive Password
    By Andy_GS in forum General Questions
    Replies: 4
    Last Post: 16 Mar 2009, 12:06 PM

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