Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to Format the Address Fields


Benjjj6

Recommended Posts

Hi

 

How can I modify the address fields so that customer address details are all written in 'Title Case' (Capitalising the first letter of each word) and the Postcode/Zip Code is always CAPITALISED.

 

I don't mind if this happens when they sign up, or if only the address on the invoice.php file is affected as that is the only need for it.

 

 

Thank you,

 

Ben

Link to comment
Share on other sites

Use these PHP functions:

 

ucwords — Uppercase the first character of each word in a string

 

strtoupper — Make a string uppercase

 

You'd need to do this in the top PHP portion of /catalog/create_account.php and /catalog/account_edit.php

 

Take for example the street address.

 

To ensure it's "Title Case" the existing code:

 

	$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);

Would become:

 

	$street_address = ucwords( tep_db_prepare_input($HTTP_POST_VARS['street_address']) );

To make the postcode ALL CAPS, the exising code:

 

	$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

Becomes:

	$postcode = strtoupper( tep_db_prepare_input($HTTP_POST_VARS['postcode']) );

You should always make backups before editing any file.

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

Other than changinig them manually, you'd have to use a MYSQL query to fetch the info, modify it, then write it back.

 

Since I'm basically MYSQL illiterate I won't be any help.

 

Sorry...

:blush:

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

Archived

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

×
×
  • Create New...