I have figured out a way to change the "Email" box in manage customers to a "Name or Email" box. It requires some editing and some SQL work.
Step 1.
Run this in your SQL program:
Update Nop_LocaleStringResource
SET ResourceValue = 'Name/Email: '
WHERE LocaleStringResourceID = '8222'
Update Nop_LocaleStringResource
SET ResourceValue = 'The name or email of the customer.'
WHERE LocaleStringResourceID = '8223'
Step 2.
Run this in your SQL program:
USE [yourdatabasename]
ALTER PROCEDURE [dbo].[Nop_CustomerLoadAll]
(
@StartTime datetime = NULL,
@EndTime datetime = NULL,
@Name nvarchar(200),
@Email nvarchar(200),
@Username nvarchar(200),
@DontLoadGuestCustomers bit = 0,
@PageSize int = 2147483644,
@PageIndex int = 0,
@TotalRecords int = null OUTPUT
)
AS
BEGIN
SET @Name = isnull(@Email, '')
SET @Name = '%' + rtrim(ltrim(@Email)) + '%'
SET @Email = isnull(@Email, '')
SET @Email = '%' + rtrim(ltrim(@Email)) + '%'
SET @Username = isnull(@Username, '')
SET @Username = '%' + rtrim(ltrim(@Username)) + '%'
--paging
DECLARE @PageLowerBound int
DECLARE @PageUpperBound int
DECLARE @RowsToReturn int
DECLARE @TotalThreads int
SET @RowsToReturn = @PageSize * (@PageIndex + 1)
SET @PageLowerBound = @PageSize * @PageIndex
SET @PageUpperBound = @PageLowerBound + @PageSize + 1
CREATE TABLE #CustomerName
(
IndexID int IDENTITY (1, 1) NOT NULL,
CustomerID int NOT NULL,
CustomerName nvarchar(200) NOT NULL,
RegDate datetime NOT NULL,
)
INSERT INTO #CustomerName(CustomerID, CustomerName, RegDate)
SELECT f.CustomerId as 'CusId', (f.Value + ' ' +l.Value) as 'Name', c.RegistrationDate as 'RegDate'
FROM [Nop_CustomerAttribute] as f
LEFT OUTER JOIN [Nop_CustomerAttribute] as l
ON f.CustomerId = l.CustomerId
LEFT OUTER JOIN [Nop_Customer] as c
ON f.CustomerId = c.CustomerID
WHERE f.[Key] = 'FirstName' AND l.[Key] = 'LastName'
ORDER BY c.RegistrationDate desc
CREATE TABLE #PageIndex
(
IndexID int IDENTITY (1, 1) NOT NULL,
CustomerID int NOT NULL,
RegistrationDate datetime NOT NULL,
)
INSERT INTO #PageIndex (CustomerID, RegistrationDate)
SELECT DISTINCT
c.CustomerID, c.RegistrationDate
FROM [Nop_Customer] c with (NOLOCK)
WHERE
(@StartTime is NULL or @StartTime <= c.RegistrationDate) and
(@EndTime is NULL or @EndTime >= c.RegistrationDate) and
(patindex(@Email, isnull(c.Email, '')) > 0) and
(patindex(@Username, isnull(c.Username, '')) > 0) and
(@DontLoadGuestCustomers = 0 or (c.IsGuest=0)) and
c.deleted=0
order by c.RegistrationDate desc
IF @@rowcount = 0
INSERT INTO #PageIndex (CustomerID, RegistrationDate)
SELECT CustomerID, RegDate
FROM #CustomerName
WHERE CustomerName LIKE @Name
SET @TotalRecords = @@rowcount
SET ROWCOUNT @RowsToReturn
SELECT
c.CustomerId,
c.CustomerGuid,
c.Email,
c.Username,
c.PasswordHash,
c.SaltKey,
c.AffiliateId,
c.BillingAddressId,
c.ShippingAddressId,
c.LastPaymentMethodId,
c.LastAppliedCouponCode,
c.GiftCardCouponCodes,
c.CheckoutAttributes,
c.LanguageId,
c.CurrencyId,
c.TaxDisplayTypeId,
c.IsTaxExempt,
c.IsAdmin,
c.IsGuest,
c.IsForumModerator,
c.TotalForumPosts,
c.Signature,
c.AdminComment,
c.Active,
c.Deleted,
c.RegistrationDate,
c.TimeZoneId,
c.AvatarId
FROM
#PageIndex [pi]
INNER JOIN [Nop_Customer] c on c.CustomerID = [pi].CustomerID
WHERE
[pi].IndexID > @PageLowerBound AND
[pi].IndexID < @PageUpperBound
ORDER BY
IndexID
SET ROWCOUNT 0
DROP TABLE #CustomerName
DROP TABLE #PageIndex
END
Step 3.
In "Customers.ascx.cs" (administration/modules) at line 74 is this:
string email = txtEmail.Text.Trim();
Add this right below it on the next line:
string name = txtEmail.Text.Trim();
At line 80 add "name" between "endDate" and "email"
Step 4.
In "CustomerManager.cs" (Nop.BusinessLogic/Customer)...
Line 842 add "string.Empty" after the third "null" (there should end up being two "string.Emptys")
Right after line 850 add: "/// <param name="Name">Customer Name</param>"
Line 860 add "string Name" after "DateTime? registrationTo"
Line 881 add "Name" after "registrationTo"
Step 5.
In "NopObjectContext.cs" (Nop.BusinessLogic/Data)...
Line 1727 add "string name" right after "DateTime? registrationTo"
Right after line 1750 add "ObjectParameter nameParameter = new ObjectParameter("name", name);"
Line 1761 add "nameParameter" after "endTimeParameter"
Step 6.
In NopModel.edmx (Nop.BusinessLogic/Data)...
Right after line 3835 add "<Parameter Name="Name" Type="nvarchar" Mode="In"/>"
That is all... you should now be able to put in a customer's name and have it return results based off of their name. I used the "LIKE" operator so you don't have to have the customer's whole name or have it spelled correctly.
If you search for "Ron" it will return "Ronald", "Ronnie", etc.
Hope this helps!