X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Capitalise First Letters in Customer Info (https://forum.x-cart.com/showthread.php?t=8203)

imexhouse 02-11-2008 02:57 PM

Re: Capitalise First Letters in Customer Info
 
Question for PhilJ:

I've managed to add the street directions, SE, SW, NE, NW and the rural road RR, but I can't make RR stay in caps if they are the first two characters of the line.

Any ideas?

littlebird1111 03-30-2010 02:53 PM

Re: Capitalise First Letters in Customer Info
 
Hello,

Has anyone out there attempted using this mod with 4.2.3?

Or do any 4.2 users have suggestions on other mods that will do the same thing: capitalize the first letter in every word that a customer inputs in their User Profile or checkout form?

Thank you kindly,

Lisa

peggyr 08-12-2010 02:06 PM

Re: Capitalise First Letters in Customer Info
 
Hi,

I'm on 4.1.11 Gold and trying to put this mod on.

My fields that I replace all end in a ** |escape} ***

<input type="text" id="s_firstname" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname|escape}" />

I thought I'd ask a question before making mods to the different modules in case someone knows the answer --

Do I just 'overlay' the
|escape
with the
|capitalize:true}" onChange="capitalizeMe(this);" />

eg, the above

<input type="text" id="s_firstname" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname|capitalize:true}" onChange="capitalizeMe(this);" />

If someone doesn't know, I'll go and make updates to the different modules and run a test --

Thanks in advance for ideas.

Peggy

a1deano 08-16-2010 04:51 AM

Re: Capitalise First Letters in Customer Info
 
Would be nice if this could be made to work on v4.4

Colin Mills 03-16-2011 12:55 AM

Re: Capitalise First Letters in Customer Info
 
Quote:

Originally Posted by peggyr
I thought I'd ask a question before making mods to the different modules in case someone knows the answer --

Do I just 'overlay' the
|escape
with the
|capitalize:true}" onChange="capitalizeMe(this);" />

eg, the above

<input type="text" id="s_firstname" name="s_firstname" size="32" maxlength="32" value="{$userinfo.s_firstname|capitalize:true}" onChange="capitalizeMe(this);" />

If someone doesn't know, I'll go and make updates to the different modules and run a test --

Thanks in advance for ideas.

Peggy

Sorry I've come to this quite late, but I really could do with this mod! I have the same prob Peggy did you get this working? I got to the stage where I could test it in the register_personal_info but the first name did not capitalise.

peggyr 03-16-2011 08:31 AM

Re: Capitalise First Letters in Customer Info
 
Hi,

I ended up adding a routine to my 'post processing' code 'outside' of X-cart, to handle the capitalization.

So, sorry I don't have an 'X-cart' mod to give you.

Good luck.

Peggy

Colin Mills 03-18-2011 12:13 AM

Re: Capitalise First Letters in Customer Info
 
Looks as though we will do something with .php to overcome this. Thanks for the reply.

cflsystems 09-15-2011 08:14 AM

Re: Capitalise First Letters in Customer Info
 
Here is a lot more easier and safer way to do it without having to modify files - 4.3.x (may work on 4.2.x) and 4.4.x

1. Download this file - http://plugins.jquery.com/project/namecase - and copy to skin/common_files/js (skin1/js)

2. Create new file in your_skin/customer - capitalize_first.tpl - and copy the following in it

4.4.x
Code:

{load_defer file="js/jquery.namecase.js" type="js"}

<script type="text/javascript">
//<![CDATA[
{literal}
        $(document).ready(function() {
        $('#firstname, #lastname, #company, #b_firstname, #b_lastname, #b_address, #b_address_2, #b_city, #s_firstname, #s_lastname, #s_address, #s_address_2, #s_city').namecase();
        });
{/literal}
//]]>
</script>


4.3.x
Code:

<script type="text/javascript" src="skin1/js/jquery.namecase.js"></script>

<script type="text/javascript">
//<![CDATA[
{literal}
        $(document).ready(function() {
        $('#firstname, #lastname, #company, #b_firstname, #b_lastname, #b_address, #b_address_2, #b_city, #s_firstname, #s_lastname, #s_address, #s_address_2, #s_city').namecase();
        });
{/literal}
//]]>
</script>


3. Open home.tpl and just above </head> add

Code:

{include file="customer/capitalize_first.tpl"}

Vacman 05-17-2013 10:27 AM

Re: Capitalise First Letters in Customer Info
 
Ok folks - If you are running 4.5.5 (and I am assuming 4.5.4, I with the help of another good friend have figured out how to make this work.

1. In your skin/customer/home.tpl you will add the following code before the </head>

Code:

{literal}
<script>
function ValidatePhone(elem) {
  var pn = elem.value;
  if (pn == "") return;
    pn = pn.replace(/\D/g,"");
    if (pn.length == 7)
      elem.value = pn.replace(/(\d{3})(\d{4})/,"$1-$2");
    else if (pn.length == 10)
      elem.value = pn.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");
    else {
      alert('The '+elem.name+' must be a 7 or 10 digit phone number');
      elem.focus();
      return false;
    }
  }
</script>
<script type="text/javascript">
  String.prototype.toTitleCase = function() {
  var words = this.split(" ");
  for(var i = 0; i < words.length; ++i)
  words[i] = words[i].charAt(0).toUpperCase() + words[i].substring(1).toLowerCase();
return words.join(" ");
  };
</script>
{/literal}


2. In your skin/common_files/One_Page_Checkout/profile/address_fields.tpl add the following code around line #61 just after the line where it says default_city.

Code:

        {elseif $fname eq 'phone'}
          <input type="text" id="{$id_prefix}{$fname}" name="{$name_prefix}[{$fname}]" size="32" maxlength="255" value="{$address.$fname|escape}" OnBlur="ValidatePhone(this)" />
        {else}
          <input type="text" id="{$id_prefix}{$fname}" name="{$name_prefix}[{$fname}]" size="32" maxlength="255" value="{$address.$fname|escape}" onBlur="this.value = this.value.toTitleCase();" />


Thomasb134 05-17-2013 11:02 AM

Re: Capitalise First Letters in Customer Info
 
Quote:

1. Download this file - http://plugins.jquery.com/project/namecase - and copy to skin/common_files/js (skin1/js)
I can't find this file (repository has changed). So a revised link to the file would be grand.


All times are GMT -8. The time now is 06:59 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.