Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change Greeting with Last Name


muzik

Recommended Posts

Posted

Normally Osc greets existing user with first name on home page. If you want to greet your existing customers with last name you need to edit two files:

 

1. includes/functions/general.php

Find this code:

// Return a customer greeting
 function tep_customer_greeting() {
   global $customer_id, $customer_[b]first[/b]_name;

   if (tep_session_is_registered('customer_[b]first[/b]_name') && tep_session_is_registered('customer_id')) {
     $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_[b]first[/b]_name), tep_href_link(FILENAME_PRODUCTS_NEW));

and replace with this:

// Return a customer greeting
 function tep_customer_greeting() {
   global $customer_id, $customer_[b]last[/b]_name;

   if (tep_session_is_registered('customer_[b]last[/b]_name') && tep_session_is_registered('customer_id')) {
     $greeting_string = sprintf(TEXT_GREETING_PERSONAL, tep_output_string_protected($customer_[b]last[/b]_name), tep_href_link(FILENAME_PRODUCTS_NEW));

 

2. catalog/login.php

Find this code:

// Check if email exists
   $check_customer_query = tep_db_query("select customers_id, customers_[b]first[/b]_name, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
   if (!tep_db_num_rows($check_customer_query)) {
     $error = true;
   } else {
     $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
     if (!tep_validate_password($password, $check_customer['customers_password'])) {
       $error = true;
     } else {
       if (SESSION_RECREATE == 'True') {
         tep_session_recreate();
       }

       $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
       $check_country = tep_db_fetch_array($check_country_query);

       $customer_id = $check_customer['customers_id'];
       $customer_default_address_id = $check_customer['customers_default_address_id'];
       $customer_[b]first[/b]_name = $check_customer['customers_[b]first[/b]name'];
       $customer_country_id = $check_country['entry_country_id'];
       $customer_zone_id = $check_country['entry_zone_id'];
       tep_session_register('customer_id');
       tep_session_register('customer_default_address_id');
       tep_session_register('customer_[b]first[/b]_name');
       tep_session_register('customer_country_id');
       tep_session_register('customer_zone_id');

and replace this:

// Check if email exists
   $check_customer_query = tep_db_query("select customers_id, customers_[b]last[/b]name, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
   if (!tep_db_num_rows($check_customer_query)) {
     $error = true;
   } else {
     $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
     if (!tep_validate_password($password, $check_customer['customers_password'])) {
       $error = true;
     } else {
       if (SESSION_RECREATE == 'True') {
         tep_session_recreate();
       }

       $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
       $check_country = tep_db_fetch_array($check_country_query);

       $customer_id = $check_customer['customers_id'];
       $customer_default_address_id = $check_customer['customers_default_address_id'];
       $customer_[b]last[/b]_name = $check_customer['customers_[b]last[/b]name'];
       $customer_country_id = $check_country['entry_country_id'];
       $customer_zone_id = $check_country['entry_zone_id'];
       tep_session_register('customer_id');
       tep_session_register('customer_default_address_id');
       tep_session_register('customer_[b]last[/b]_name');
       tep_session_register('customer_country_id');
       tep_session_register('customer_zone_id');

That's all. It's fine working... By the other words, replace all "first" with "last" both two files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...