Show Firstname and Surname in osCommerce greeting

By | January 27, 2009

When an existing customer logs into your osCommerce shop, a nice little message is displayed, like this:

Welcome back John! Would you like to see which new products are available to purchase?

Obviously assumes that you have not removed or amended this message! In the osCommerce forum someone requested that the message show both firstname and surname, so here is how I would do it for maximum portability and compactness of code!

Open up login.php in your favourite text editor…

Find this:
[php]$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) . “‘”);[/php]

Change it to this:
[php]$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) . “‘”);[/php]

Find this:
[php]$customer_first_name = $check_customer[‘customers_firstname’];[/php]

Change it to this:
[php]$customer_first_name = $check_customer[‘customers_firstname’] . ‘ ‘ . $check_customer[‘customers_lastname’];[/php]

Save the file and upload. If you are logged in, log out, and log back in. Firstname and surname now show in the greeting, as so;

Welcome back John doe! Would you like to see which new products are available to purchase?

Easy as 123.

2 thoughts on “Show Firstname and Surname in osCommerce greeting

  1. matt

    hi sir,
    i tried this, it didnt work. i havent changed anything, but thats not to say the file hasnt been deleted. Purely because i have brought the orginal site from ebay, and its not the first time something opbvious doesnt work.
    Any ideas what i can do to get it work??

  2. Gary Post author

    Matt, a shop bought from eBay could have any number of unknown changes…so you’d probably need to get 1-on-1 help to work out the best way to do this.

Leave a Reply

Your email address will not be published. Required fields are marked *