Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Capitalise First Letters in Customer Info

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 08-29-2007, 10:21 AM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Default Re: Capitalise First Letters in Customer Info

Please, do it for 4.1.7
Very useful mod!

Thank you!
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote
  #22  
Old 08-31-2007, 09:40 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Capitalise First Letters in Customer Info

Had a hard time trying to implement this mod in v4.1.8 so I started from scratch and made several changes to make it work.

1 - Create a file and call it capitalise2.js and place it in the /skin1 directory

Place the following code in this file:
Code:
function capitalizeMe(obj) { val = obj.value; newVal = ''; val = val.split(' '); for(var c=0; c < val.length; c++) { newVal += val[c].substring(0,1).toUpperCase() + val[c].substring(1,val[c].length) + ' '; } obj.value = newVal; }

2) Then find xcart/skin1/customer/home.tpl

Add this code between <head> and </head>

Code:
Code:
<script language=JavaScript1.3 src="{$SkinDir}/capitalise2.js"></script>

3) Then locate the following templates in the xcart/skin1/main directory

register_personal_info.tpl
register_billing_address.tpl
register_shipping_address.tpl

also locate
xcart/skin1/help/contactus.tpl

Call the script by changing/adding this code to the end of the input fields:

|capitalize:true}" onChange="capitalizeMe(this);" />

For instance:
Change the existing code shown as commented code {* ...*} with the one under it in skin1/main/register_personal_info.tpl:
Code:
{* <input type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}" /> *} <input type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname}" /> *} <input type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname|capitalize:true}" onChange="capitalizeMe(this);" />

You can test it out now to see if it works by starting up X-Cart and clicking on the 'register' button located on the 'Authentication' menu.
In the 'First Name' box enter a name in lowercase, and then press the tab key or go to the 'Last Name' box and you can see that the first letter has changed to uppercase.
Test the 'Last Name' box also to make sure your code has been correctly entered.

Now also change the code in skin1/main/register_billing_address.tpl:

Code:
{* <input type="text" name="b_firstname" size="32" maxlength="32" value="{$userinfo.b_firstname}" /> *} <input type="text" name="b_firstname" size="32" maxlength="32" value="{$userinfo.b_firstname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" name="b_lastname" size="32" maxlength="32" value="{$userinfo.b_lastname}" /> *} <input type="text" name="b_lastname" size="32" maxlength="32" value="{$userinfo.b_lastname | capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address}" /> *} <input type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2}" /> *} <input type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city}" /> *} <input type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city|capitalize:true}" onChange="capitalizeMe(this);" />

Since the register_billing_address.tpl file is still open, you can also change the zip code to make sure that it will always be upper case by changing the following code:
Code:
{* <input type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode}" onchange="check_zip_code()" /> *} <input type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode}" onChange="this.value=this.value.toUpperCase();" onchange="check_zip_code();" />

Do the same with skin1/main/register_shipping_address.tpl:
Code:
{* <input type="text" id="s_firstname" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname}" /> *} <input type="text" id="s_firstname" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="s_lastname" name="s_lastname" size="32" maxlength="32" value="{$userinfo.s_lastname}" /> *} <input type="text" id="s_lastname" name="s_lastname" size="32" maxlength="32" value="{$userinfo.s_lastname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="s_address" name="s_address" size="32" maxlength="64" value="{$userinfo.s_address}" /> *} <input type="text" id="s_address" name="s_address" size="32" maxlength="64" value="{$userinfo.s_address|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="s_address_2" name="s_address_2" size="32" maxlength="64" value="{$userinfo.s_address_2}" /> *} <input type="text" id="s_address_2" name="s_address_2" size="32" maxlength="64" value="{$userinfo.s_address_2|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="s_city" name="s_city" size="32" maxlength="64" value="{$userinfo.s_city}" /> *} <input type="text" id="s_city" name="s_city" size="32" maxlength="64" value="{$userinfo.s_city|capitalize:true}" onChange="capitalizeMe(this);" />

And this is the code to make the zip code all upper case:
Code:
{* <input type="text" id="s_zipcode" name="s_zipcode" size="32" maxlength="32" value="{$userinfo.s_zipcode}" onchange="check_zip_code()" /> *} <input type="text" id="s_zipcode" name="s_zipcode" size="32" maxlength="32" value="{$userinfo.s_zipcode}" onChange="this.value=this.value.toUpperCase();" onchange="check_zip_code();" />

And finally the code in skin1/help/contactus.tpl:
Code:
{* <input type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}" /> *} <input type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname}" /> *} <input type="text" id="lastname" name="lastname" size="32" maxlength="32" value="{$userinfo.lastname|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address}" /> *} <input type="text" id="b_address" name="b_address" size="32" maxlength="64" value="{$userinfo.b_address|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2}" /> *} <input type="text" id="b_address_2" name="b_address_2" size="32" maxlength="64" value="{$userinfo.b_address_2|capitalize:true}" onChange="capitalizeMe(this);" /> {* <input type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city}" /> *} <input type="text" id="b_city" name="b_city" size="32" maxlength="64" value="{$userinfo.b_city|capitalize:true}" onChange="capitalizeMe(this);" />

And the code for upper case zip codes:
Code:
{* <input type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode}" onchange="javascript: check_zip_code(document.getElementById('b_country'), this);" /> *} <input type="text" id="b_zipcode" name="b_zipcode" size="32" maxlength="32" value="{$userinfo.b_zipcode}" onchange="this.value=this.value.toUpperCase();" onchange="javascript: check_zip_code(document.getElementById('b_country'), this);" />

All the modifications above were made on templates that had no previous modifications. Hope you like it and thanks to PhilJ for the inspiration.

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #23  
Old 09-01-2007, 12:49 AM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Default Re: Capitalise First Letters in Customer Info

that Is Great!
Thank You For Your Hard Work!

Works Perfect In 4.1.7
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote
  #24  
Old 09-01-2007, 07:22 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Capitalise First Letters in Customer Info

Now I don't know what to think. I am running 4.1.8, followed the exact steps, cleared the template cache, does not work for me. So I went back and checked each step, and same results. The only step I did not do is the zip code step as we're here in the U.S. and do not do any over-seas business.

BTW: Checked it placing a sample order as a customer would.

Here is the weird thing, the contact form does work, but the checkout process does not.
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #25  
Old 09-01-2007, 07:38 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: Capitalise First Letters in Customer Info

If you're using Fastlane Checkout, you'll need to add the...

Code:
<script language=JavaScript1.3 src="{$SkinDir}/capitalise2.js"></script>

to...

Code:
skin1/modules/Fast_Lane_Checkout/home.tpl

also.
__________________
xcartmods.co.uk
Reply With Quote
  #26  
Old 09-01-2007, 08:40 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Capitalise First Letters in Customer Info

Quote:
Originally Posted by PhilJ
If you're using Fastlane Checkout, you'll need to add the...

Code:
<script language=JavaScript1.3 src="{$SkinDir}/capitalise2.js"></script>

to...

Code:
skin1/modules/Fast_Lane_Checkout/home.tpl

also.


Bingo! Ah - Order is once again restored to the world!

Thanks PhilJ, and thanks MoonDog!
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #27  
Old 09-20-2007, 10:11 AM
  a1deano's Avatar 
a1deano a1deano is offline
 

X-Adept
  
Join Date: Oct 2004
Posts: 745
 

Default Re: Capitalise First Letters in Customer Info

"What a top man" one of my biggest hates was people writing the first letter of any line in lower case making you alter it manualy - tops marks.

Many thanks for your hard work on this.

Regards Dean
__________________
--------------
V4.6.1
xcartmods - Reboot Template

X-cart - X-PDF

Altered Cart - Checkout one
Reply With Quote
  #28  
Old 10-04-2007, 03:06 PM
 
chris.barber chris.barber is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 74
 

Default Re: Capitalise First Letters in Customer Info

Can I just say many thanks for great and easy mod...

but now I'm really confused, I saw this thread yesterday, made a mental note to do the mod today, came back to the thread and never went past page 1, followed all the steps and with no trouble at all got it working first time straight out of the box on 4.1.8.

Made a second mental note to come back to say thanks, here I am, and read page 2 and 3, only to discover others were unable to get it to work on that version... I guess I am just lucky

Oh and thanks for pointing me to the Postcode mod too, I did them both and I am one happy bunny, I hate people who don't capitalise properly, and I just have to fix it, now I don't need to worry.

Thanks again.
__________________
Chris Barber
Version 4.1.9
MOD - BCSE Shipping Estimator
MOD - Shopzilla Feed
MOD - Price Match with Captcha
MOD - Links Manager 2008
MOD - One Page Checkout
MOD - Sitemap
Reply With Quote
  #29  
Old 12-02-2007, 10:07 AM
  imexhouse's Avatar 
imexhouse imexhouse is offline
 

eXpert
  
Join Date: May 2006
Location: Canada
Posts: 377
 

Default Re: Capitalise First Letters in Customer Info

I wonder how the address field could be modified so street direction, like SW, NW stay in upper case, instead of Sw and Nw.
Any idea?
__________________
Jack@AquasanaCA
X-CART GOLD 4.0.19 Live
DSEFU, AOM, ezCheckout, ezUpsell, ezRecommends, RememberMe, RememberAnonCarts
AquasanaCanada.com - Aquasana╝ - #1 Rated Water Filters in America!
X-CART GOLD 4.4.5 Live
CDSEO Pro v. 1.8.4
AquasanaMontreal.com
Aquasana╝ & Rhino Water Filtration Systems
Reply With Quote
  #30  
Old 01-14-2008, 03:28 PM
 
Chill-Tek Chill-Tek is offline
 

Advanced Member
  
Join Date: Jun 2003
Posts: 42
 

Default Re: Capitalise First Letters in Customer Info

this works a treat on 4.1.9. I am fed up with the usual.....

mr joe bloggs

23 west bloggs drive etc et........


When i order stuff on the net i always make sure the details of address are clear and formatted correctly to make sure i get the goods, not someone down the road.


Thanks again.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:03 PM.

   

 
X-Cart forums © 2001-2020