Out of curiousity, what is your highest customer ID and how much does it go up each day?
4349036 in less than a month
I know i can change to long but it bothers me on a personal level
FROM Inserted ca
LEFT JOIN Customer c on c.Id = ca.Customer_id
LEFT JOIN Address ON ca.Address_id = Address.Id
if (_cachedCustomer != null)
return _cachedCustomer;
Customer customer = null;
if (_httpContext != null)
{
//check whether request is made by a search engine
//in this case return built-in customer record for search engines
//or comment the following two lines of code in order to disable this functionality
if (_webHelper.IsSearchEngine(_httpContext))
customer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);
//registered user
if (customer == null || customer.Deleted || !customer.Active)
{
customer = _authenticationService.GetAuthenticatedCustomer();
}
// impersonate user if required (currently used for 'phone order' support)
if (customer != null && !customer.Deleted && customer.Active)
{
int? impersonatedCustomerId = customer.GetAttribute<int?>(SystemCustomerAttributeNames.ImpersonatedCustomerId);
if (impersonatedCustomerId.HasValue && impersonatedCustomerId.Value > 0)
{
var impersonatedCustomer = _customerService.GetCustomerById(impersonatedCustomerId.Value);
if (impersonatedCustomer != null && !impersonatedCustomer.Deleted && impersonatedCustomer.Active)
{
//set impersonated customer
_originalCustomerIfImpersonated = customer;
customer = impersonatedCustomer;
}
}
}
if (customer != null && !customer.Deleted && customer.Active)
{
_cachedCustomer = customer;
return _cachedCustomer;
}
//load guest customer
if (customer == null)
{
var customerCookie = GetCustomerCookie();
if (customerCookie != null && !String.IsNullOrEmpty(customerCookie.Value))
{
Guid customerGuid;
if (Guid.TryParse(customerCookie.Value, out customerGuid))
{
var customerByCookie = _customerService.GetCustomerByGuid(customerGuid);
if (customerByCookie != null && !customerByCookie.IsRegistered())
{
customer = customerByCookie;
_cachedCustomer = customer;
return _cachedCustomer;
}
}
}
}
}
//validation
if (customer != null && !customer.Deleted && customer.Active)
{
_cachedCustomer = customer;
return _cachedCustomer;
}
var guestSearchCustomer = _customerService.GetCustomerBySystemName(SystemCustomerNames.SearchEngine);
if (guestSearchCustomer == null)
throw new NopException("No customer found for the rule searchengine");
SetCustomerCookie(guestSearchCustomer.CustomerGuid);
_cachedCustomer = guestSearchCustomer;
return _cachedCustomer;
}