Optimize uc_order_usearch

Posts: 20
Joined: 09/05/2007
Uber DonorBug Finder

This function could be optimized with something like that:

    $fields = array (
      'billing_first_name',
      'billing_last_name',
      'billing_company',
      'delivery_first_name',
      'delivery_last_name',
      'delivery_company',   
    );   
    for ($i = 5; $i < 11; $i++) {
      $arg[$i] = str_replace('*', '%', check_plain(arg($i)));
      if ($arg[$i] !== '0' && $arg[$i] !== '%') {
        $where .= " AND LOWER(o.".$fiels[($i-5)].") LIKE LOWER('". $arg[$i] ."')";
      }
    }

what do you think?

regards pebosi

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Do you think you can also investigate my use of % in this query? I believe I may need to be using %% syntax, and I wonder if that is causing the searches to fail for folks that have reported the issues in the past.

Posts: 20
Joined: 09/05/2007
Uber DonorBug Finder

I got no problems searching orders but maybe i dont understand you ?!?
Where are such issues?

regards pebosi

Posts: 5378
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

kulvik and then today Sara let me know that when they search for customers by name, it usually fails to find the person they're looking for. However, if they browse the DB, they find it no problem. Both their sites have large numbers of customers, so that could very well be the trouble. In that case, the query definitely should be optimized.

Come to think of it... it might be b/c there are no indexes on customer names. I might have to recommend that to them to see if it helps.