Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

auto capitilization on customer registration forms Rate Topic   - - - - -

 
  • xcomm
  • Member
  • Members
  • Join Date: 17-Dec 11
  • 18 posts

Posted 22 December 2011 - 06:05 AM #1

We have an auto capitilization mod we are currently using in our zen cart store. Great if you have OCD and like to keep a clean, uniform database.

I cannot stand things like this getting through:

john sMith
14 south street
sYDNEY 2000
australia

the mod changes each word to scentence case as the customer types it in to the registration form, so all you ever end up with is nice tidy records from scratch, eg:

John Smith
14 South Street
Sydney 2000
Australia

The mod for zen cart is available here http://www.zen-cart....products_id=441

has anyone ported this for use with cs-cart? does cs-cart have a similar mod available? if not how would we go about getting this setup

 
  • plinkplink
  • Member
  • Members
  • Join Date: 25-Apr 10
  • 156 posts

Posted 16 January 2012 - 03:42 AM #2

I was just reading how to do this in the Smarty Documentation:

<?php
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
?>

Where the template is:

{$articleTitle}
{$articleTitle|capitalize}
{$articleTitle|capitalize:true}

Will output:

next x-men film, x3, delayed.
Next X-Men Film, x3, Delayed.
Next X-Men Film, X3, Delayed.


I guess you could just go through your templates and stick |capitalize on everything that you want to format.
My site: 3-Ring Binders and Organization at UniKeep.com.

 

Posted 09 March 2013 - 01:23 AM #3

Hi every one, i'm in need of a little help, i want to capitalize the letters on addresses and peoples names with i have succeeded. But did run to a little problem.

Now using {text-transform:capitalize;} does the job but it will not save the names with capitalize in the database, it will only out put them on screen.

I have used the following {$value|capitalize} witch works but unlike {text-transform:capitalize;} witch will transform the first letter right away, {$value|capitalize} will only transform the first letter when you press save. The first save it will save it untransform making you having to press save twice for it to save it to the database.

Anyone knows any solution for this?

 

Posted 10 March 2013 - 10:42 PM #4

Heee

OK i have come up with a much better way if any one is intrested.

<script type="text/javascript">
//<![CDATA[
{literal}
function ucwords(str,force) {
	str=force ? str.toLowerCase() : str;  
	return str.replace(/(\<img src='http://forum.cs-cart.com/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' />([a-zA-Z])/g,
	function(firstLetter) {
	return firstLetter.toUpperCase();
  });
}
$('#elm_6, #elm_7, #elm_8, #elm_14, #elm_15, #elm_16, #elm_17, #elm_18, #elm_19, #elm_20, #elm_21, #elm_22, #elm_23, #elm_24, #elm_25').keyup(function(evt) {
	var cp_value= ucwords($(this).val(),true);
	$(this).val(cp_value);
});
$('#elm_28, #elm_29').keyup(function() {
	$(this).val($(this).val().toUpperCase());
});
$('#elm_11, #elm_47, #elm_48, #email').keyup(function() {
	$(this).val($(this).val().toLowerCase());
});
{/literal}
//]]>
</script>

Then you just need to add the #elm_ with the id to as the example above.