Zen Cart Logo
Forums / General Questions / Customers Name - Last Name, First Name

Customers Name - Last Name, First Name

Views: 2,715

Results 1 to 9 of 9
8 May 2014, 1:31 PM
#1
cjcraven avatar

cjcraven

Zen Follower

Join Date:
Aug 2004
Location:
Osaka Japan
Posts:
149
Plugin Contributions:
0

Customers Name - Last Name, First Name

In the script there are a few places where customers_name is used instead of first_name last_name. It seems if customers_name is used the name order becomes first last name.

With Japanese the name order should be last first name.

In the DB table address_format I can set the correct name order and it seems to work except in at least 2 cases where customers_name seems to be referenced. How do I change this?

  1. email\email_template_order_status.html
<div>$EMAIL_CUSTOMERS_NAME sama</div>
  1. admin\orders.php, invoice.php, & packinglist.php
    I happen to be using Super Orders and the name order in orders.php, invoice.php, & packinglist.php is First Name Last Name

NOTE
If the customer is placing the order in English the name order should be first name last name.

9 May 2014, 2:51 AM
#2
cjcraven avatar

cjcraven

Zen Follower

Join Date:
Aug 2004
Location:
Osaka Japan
Posts:
149
Plugin Contributions:
0

Re: Customers Name - Last Name, First Name

Would changing includes/classes/order.php work?

Line 595 'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],

To

Line 595 'customers_name' => $this->customer['lastname'] . ' ' . $this->customer['firstname'],

That would change all languages, is there a language specific way to change name order?

9 May 2014, 6:04 AM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customers Name - Last Name, First Name

You would have to find the language the order was placed in (not sure how without researching), but once you know that, you can make a test based on the language id, something like:```php
//look up order language, get its id - before the statement that includes line 595
//then test and set order
if ($order_language_id == '3') {//use the id for Japanese
$customers_name_order = $this->customer['lastname'] . ' ' . $this->customer['firstname'];
} else {
$customers_name_order = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
}

//line 595
'customers_name' => $customers_name_order,

9 May 2014, 6:13 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customers Name - Last Name, First Name

If this e-mail is being processed in real time when the order is placed, the current language id will be the correct one. That makes it easy.

if ($_SESSION['languages_id'] == '3') {//use the id for Japanese 

Anything being processed at a later time will have to be handled differently; I don't know if the language in use when the order was placed is even saved for later reference.

9 May 2014, 7:05 AM
#5
cjcraven avatar

cjcraven

Zen Follower

Join Date:
Aug 2004
Location:
Osaka Japan
Posts:
149
Plugin Contributions:
0

Re: Customers Name - Last Name, First Name

Japanese language ID is 7, I will give it a shot and report back.

9 May 2014, 2:39 PM
#6
cjcraven avatar

cjcraven

Zen Follower

Join Date:
Aug 2004
Location:
Osaka Japan
Posts:
149
Plugin Contributions:
0

Re: Customers Name - Last Name, First Name

It became as follows;
$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
//modification for Japanese name order
if ($order_language_id == '7') {
$customers_name_order = $this->customer['lastname'] . ' ' . $this->customer['firstname'];
} else {
$customers_name_order = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
}
'customers_name' => $customers_name_order,
//'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
'customers_company' => $this->customer['company'],

Unfortunately it does not seem to change the name order.

14 May 2014, 6:59 AM
#7
cjcraven avatar

cjcraven

Zen Follower

Join Date:
Aug 2004
Location:
Osaka Japan
Posts:
149
Plugin Contributions:
0

Re: Customers Name - Last Name, First Name

Ouch, actually this coding caused a problem with the ordering process and results in an error. The customer cannot complete the order.

14 May 2014, 12:50 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Customers Name - Last Name, First Name

Look in your store's /logs directory. If you (or your customers) are receiving errors or whitescreens, then a myDEBUG*.log file will contain the details of the cause.

14 May 2014, 3:08 PM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Customers Name - Last Name, First Name

The order assignment needs to happen before the statement that contains the name assignment, not inside the statement. ```php
//modification for Japanese name order
if ($_SESSION['languages_id'] == '7') {
$customers_name_order = $this->customer['lastname'] . ' ' . $this->customer['firstname'];
} else {
$customers_name_order = $this->customer['firstname'] . ' ' . $this->customer['lastname'];
}

$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
'customers_name' => $customers_name_order,
'customers_company' => $this->customer['company'],


You also need to use the session variable $_SESSION['languages_id'].