Zen Cart Logo
Forums / Managing Customers and Orders / Customer Search in Admin?

Customer Search in Admin?

Views: 1,305

Results 1 to 10 of 10
26 Jun 2011, 7:46 PM
#1
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Customer Search in Admin?

Using the search button under Customers in admin is it possible to search by full name or even better customer id number?

We have a lot of customer names in this section and if you need to find someone with a common surname e.g. Brown the search may give out 100+ matching entries and then you manually need to check through them all to find the right one, whereas if you could search by full name e.g. Mary Brown it would bring up far fewer results, or by the database unique customer ID number then it would bring up only the one matching record.

Thought I would check in case there is a way to do this that I just don't know about as it seems strange to only search for part of a name.

Any ideas or tips on how to do this?

27 Jun 2011, 6:52 AM
#2
gaurav10feb avatar

gaurav10feb

Zen Follower

Join Date:
Jan 2010
Location:
Australia
Posts:
243
Plugin Contributions:
1

Re: Customer Search in Admin?

if you still willing to have this .Please let me know and i might be able to modify or create a search tab for you to do so.

cheers gary

11 Oct 2015, 7:20 PM
#3
gigi3 avatar

gigi3

New Zenner

Join Date:
Oct 2015
Location:
BC, Canada
Posts:
41
Plugin Contributions:
0

Re: Customer Search in Admin?

bump
I need to be able to search customers by ID. Anyone?

TIA.

11 Oct 2015, 9:21 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Customer Search in Admin?

What about search by phone number, which is already available.

11 Oct 2015, 9:38 PM
#5
gigi3 avatar

gigi3

New Zenner

Join Date:
Oct 2015
Location:
BC, Canada
Posts:
41
Plugin Contributions:
0

Re: Customer Search in Admin?

Thanks, swguy, but for me it must be by ID....

11 Oct 2015, 9:49 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Customer Search in Admin?

OK. What version of Zen Cart do you have?

11 Oct 2015, 11:21 PM
#7
gigi3 avatar

gigi3

New Zenner

Join Date:
Oct 2015
Location:
BC, Canada
Posts:
41
Plugin Contributions:
0

Re: Customer Search in Admin?

1.5.1
Thanks!

12 Oct 2015, 12:19 AM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Customer Search in Admin?

Change line admin/customers.php line 1045-1049 from:

    if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
      $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
      $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike ':keywords:' or a.entry_company rlike ':keywords:' or a.entry_street_address rlike ':keywords:' or a.entry_city rlike ':keywords:' or a.entry_postcode rlike ':keywords:'";
      $search = $db->bindVars($search, ':keywords:', $keywords, 'regexp');
    }

to

    if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
      $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
      // CID search
      if ((strlen($keywords) < 6) && is_numeric($keywords)) {
         $cid = (int)$keywords;
         $search = "where c.customers_id = " . $cid;
      } else {
         // end CID search
         $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike ':keywords:' or a.entry_company rlike ':keywords:' or a.entry_street_address rlike ':keywords:' or a.entry_city rlike ':keywords:' or a.entry_postcode rlike ':keywords:'";
         $search = $db->bindVars($search, ':keywords:', $keywords, 'regexp');
      }
    }
12 Oct 2015, 12:35 AM
#9
gigi3 avatar

gigi3

New Zenner

Join Date:
Oct 2015
Location:
BC, Canada
Posts:
41
Plugin Contributions:
0

Re: Customer Search in Admin?

It worked! Thank you SO MUCH! Do you have a donate link I can use? Would love to support your work. :)

12 Oct 2015, 1:23 AM
#10
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: Customer Search in Admin?

LOL that's very kind of you. Please make a contribution to the Zen Cart project.

https://www.zen-cart.com/content.php?6-donate