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
  #11  
Old 12-20-2004, 04:20 AM
 
zefon zefon is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 86
 

Default

Here is the code to "proper case" multiple word fields like the address line in your existing database.

Code:
<? @include_once "./top.inc.php"; if (!defined('DIR_CUSTOMER')) @include_once "../top.inc.php"; if (!defined('DIR_CUSTOMER')) die("ERROR: Cannot find application! Please check the configuration."); include_once $xcart_dir."/config.php"; $field = "%FIELD_HERE%"; $table = "%TABLE_HERE%"; $data = func_query("SELECT $field FROM $table"); foreach ($data as $k) { db_query("UPDATE $table SET $field ='".ucwords($k[$field])."' WHERE $field ='$k[$field]';"); echo "Convert: ".$k[$field]." => ".ucwords($k[$field])." "; } ?>

Create a php file with this code. Repalce %FIELD_HERE% and %TABLE_HERE% strings with name of field you want to modify and name of table where this field is stored.

For example you can replace :

$field = "%FIELD_HERE%";
$table = "%TABLE_HERE%";

with

$field = "b_address";
$table = "xcart_customers";


Then just upload the file and run it. You will get an on-screen look at all the field changes. It takes a minute or to to run so be patient.
__________________
X-Cart Gold 4.1.8
Reply With Quote
  #12  
Old 07-08-2006, 12:40 AM
  shishapipe's Avatar 
shishapipe shishapipe is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: London
Posts: 47
 

Default not working for me

i installed this mod

it is working in the contact us

but not in the register new customer etc
i dont have ez checout like mentioned before
i have checked and checked but cant find out where i am going wrong

any help will be appreciated
__________________
Regards Maxking

SERVER: Microsoft-IIS/5.0
MYSQL Server: 4.0.18-NT
PERL: 5.006001
PHP: 4.3.6
X-CART pro: 4.3
X-AOM: 4..3
X-RMA: 4..3X-FancyCategories 4.3
Skin: Own Design
Marketing Manager Professional 3.0 Bundle
Reply With Quote
  #13  
Old 07-08-2006, 01:33 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default

I'm probably being a bot thick here, but could you not acheive a similar effect using text-transform: capitalize in the css?
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #14  
Old 07-08-2006, 08:19 AM
  Vacman's Avatar 
Vacman Vacman is offline
 

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

Default

I don't know what to say. This little mod rocks! Very cool and I have no idea how I missed seeing this 6 months ago! Very cool...
__________________
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
  #15  
Old 10-28-2006, 10:45 AM
 
bigmaggot bigmaggot is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 74
 

Default Re: Capitalise First Letters in Customer Info

Use smarty variable modifiers:

Use the following for Firstname / Lastname etc:
|capitalize:true

and |upper for Post Code

Examples:

<INPUT type="text" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname|capitalize:true}">

<INPUT type="text" id="s_zipcode" name="s_zipcode" size="32" maxlength="32" value="{$userinfo.s_zipcode|upper}" onChange="check_zip_code()">

But haven't figure out where the the County |capitalize:true goes? Any ideas?

Andy
__________________
X-Cart Gold v4.1.11
Reply With Quote
  #16  
Old 05-14-2007, 02:57 PM
  shishapipe's Avatar 
shishapipe shishapipe is offline
 

Advanced Member
  
Join Date: Dec 2004
Location: London
Posts: 47
 

Default Re: Capitalise First Letters in Customer Info

i have tried thsi mod

it just dosnt seem to work on 4.1.7

i have had it working on version 4.0.17

tried and trie dno joy

has anybody got a working version for 4.1.7?

would really appreciate it

thanks in advance
__________________
Regards Maxking

SERVER: Microsoft-IIS/5.0
MYSQL Server: 4.0.18-NT
PERL: 5.006001
PHP: 4.3.6
X-CART pro: 4.3
X-AOM: 4..3
X-RMA: 4..3X-FancyCategories 4.3
Skin: Own Design
Marketing Manager Professional 3.0 Bundle
Reply With Quote
  #17  
Old 05-14-2007, 08:13 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Capitalise First Letters in Customer Info

why the loop through all the letters?

use split and then do a
o[i].charAt(0).toUpperCase()+o[i].substr(1).toLowerCase()
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #18  
Old 05-22-2007, 07:44 PM
 
kitplum kitplum is offline
 

Newbie
  
Join Date: Jul 2006
Location: Malibu, California
Posts: 1
 

Default Re: Capitalise First Letters in Customer Info

Phil

You do the most amazing mods. This is exactly what I am looking for, but to modify litecommerce not xcart. Can you give me an idea of the complications I may run into.

Thanks

Kit
__________________
Kit Plumridge
kitplum@earthlink.net
Reply With Quote
  #19  
Old 05-27-2007, 09:22 AM
  just_me's Avatar 
just_me just_me is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: Spain
Posts: 69
 

Default Re: Capitalise First Letters in Customer Info

heh, neat mod. I got it working in conrtact.php but not in the rest.

I have a copybilling mod that also uses onChange function in register_personal_info.tpl
This is my code:
Code:
<INPUT type="text" id="firstname" name="firstname" size="32" maxlength="32" value="{$userinfo.firstname}"onChange="populateProfile(); Proper(this); return true;">

Anyone know how to properly combine the two actions for onChange?
__________________
Cordially,
Just me
X-Cart Gold
Version 4.2.3
Multilingual shop: Spanish, French and US English
Reply With Quote
  #20  
Old 08-21-2007, 04:19 PM
  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

Anybody get this to work in 4.1.x? I used the same code we used in 4.0.x but it will not work.
__________________
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
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 07:18 PM.

   

 
X-Cart forums © 2001-2020