About Club osCommerce

Showcasing osCommerce…the good, the bad and the ugly!

Follow osc_pro on Twitter

Show Firstname and Surname in osCommerce greeting

Written By Gary on Jan 27 2009 · Comments (2) Follow osc_pro on Twitter

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:
  1. $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 it to this:

PHP:
  1. $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 this:

PHP:
  1. $customer_first_name = $check_customer['customers_firstname'];

Change it to this:

PHP:
  1. $customer_first_name = $check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'];

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.


Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive - and you get a link from my homepage to your site. Cheers!


2 Comments

  1. 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??

    Comment by matt — May 17, 2009 @ 9:29 pm


  2. 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.

    Comment by Gary — May 18, 2009 @ 11:08 am


Leave a comment

RSS feed for comments on this post · TrackBack URL

Hot 100 osCommerce Shops

View the osCommerce HOT 100These are the best looking, most exceptional osCommerce Stores as voted for by you.

New to osCommerce - get inspiration from these beautiful shops. Reckon your site has what it takes to become a member of the HOT 100? Submit it!