rschram Posted January 26, 2009 Share Posted January 26, 2009 Can anyone help explain how I can greet a customer using both their first and last names instead of just their first? Thanks! For example: "Welcome back John Smith!" instead of "Welcome back John!" I see the following line in /includes/languages/english.php define('TEXT_GREETING_PERSONAL', 'Welcome back <span class="greetUser">%s!</span>'); and I see the following function in /includes/functions/general.php // Return a customer greeting function tep_customer_greeting() { global $customer_id, $customer_first_name; if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW)); } else { $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); } return $greeting_string; } Link to comment Share on other sites More sharing options...
germ Posted January 26, 2009 Share Posted January 26, 2009 //// // Return a customer greeting function tep_customer_greeting() { global $customer_id, $customer_first_name; if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) { // added / modified code required to get last name and put in greeting $name_query = tep_db_query("select customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'"); $name = tep_db_fetch_array($name_query); $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name) . ' ' . tep_output_string_protected($name['customers_lastname']) , tep_href_link(FILENAME_PRODUCTS_NEW)); // // original code below // $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_first_name), tep_href_link(FILENAME_PRODUCTS_NEW)); } else { $greeting_string = sprintf(TEXT_GREETING_GUEST, tep_href_link(FILENAME_LOGIN, '', 'SSL'), tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); } return $greeting_string; } I tried this. It worked for me. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
rschram Posted January 27, 2009 Author Share Posted January 27, 2009 Thanks Jim... worked great! Link to comment Share on other sites More sharing options...
burt Posted January 27, 2009 Share Posted January 27, 2009 Possibly a little more compact and portable way to do this would be to amend login.php as so; Find: $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); Change to: $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); Find: $customer_first_name = $check_customer['customers_firstname']; Change to: $customer_first_name = $check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname']; I'm not sure where else $customer_first_name is used off the top of my head - so my method might be unsuitable - is it used anywhere? Possibly in the account section somewhere? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.