Post by mystifier » Fri Apr 01, 2011 6:31 pm

My clients have complained about case-sensitivity in customer filtering in both Customers and Orders.

Since it has also been requested as support by different members, I put it here as a simple mod.

Customers
Change admin/model/sale/customer.php

In getCustomer() change:

Code: Select all

$implode[] = "CONCAT(c.firstname, ' ', c.lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
to:

Code: Select all

$implode[] = "LCASE(CONCAT(c.firstname, ' ', c.lastname)) LIKE '%" . $this->db->escape(strtolower($data['filter_name'])) . "%'";
and in getTotalCustomers() change:

Code: Select all

$implode[] = "CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
to:

Code: Select all

$implode[] = "LCASE(CONCAT(firstname, ' ', lastname)) LIKE '%" . $this->db->escape(strtolower($data['filter_name'])) . "%'";

Orders
Change admin/model/sale/order.php

In getOrders() change:

Code: Select all

$sql .= " AND CONCAT(o.firstname, ' ', o.lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
to:

Code: Select all

$sql .= " AND LCASE(CONCAT(o.firstname, ' ', o.lastname)) LIKE '%" . $this->db->escape(strtolower($data['filter_name'])) . "%'";
and in getTotalOrders() change:

Code: Select all

$sql .= " AND CONCAT(firstname, ' ', lastname) LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
to:

Code: Select all

$sql .= " AND LCASE(CONCAT(firstname, ' ', lastname)) LIKE '%" . $this->db->escape(strtolower($data['filter_name'])) . "%'";
This seems to me that it should be core behaviour because the case-sensitivity IS a bit irritating.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm
Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests