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

limit the number of characters allowed on address line 1

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-19-2022, 12:39 PM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default limit the number of characters allowed on address line 1

How can I limit the number of characters allowed on address line 1 on the checkout page? I had a customer that put the street address and apartment number all in address line 1 and when I printed the label it cut off the last 2 digits of the apartment. So fedex delivered it somewhere but not to the right place.

This is for x-cart version 4.7.11 and using one page Ajax checkout.
Thanks.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
Reply With Quote
  #2  
Old 01-20-2022, 12:23 AM
 
PhilJ PhilJ is offline
 

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

Default Re: limit the number of characters allowed on address line 1

/skin/common_files/modules/One_Page_Checkout/profile/address_fields.tpl
Around line 72...
Replace...
Code:
<input type="text" id="{$id_prefix}{$fname}" name="{$name_prefix}[{$fname}]" size="32" maxlength="255" value="{$address.$fname|default:$default_value|escape}" {$autofocus} />

With...
Code:
<input type="text" id="{$id_prefix}{$fname}" name="{$name_prefix}[{$fname}]" size="32" maxlength="{if $fname eq 'address'}32{else}255{/if}" value="{$address.$fname|default:$default_value|escape}" {$autofocus} />
That will set the maximum length of address line 1 to 32 characters.

Or you could just change 255 to 32 to limit all fields maximum lengths to 32 characters.
__________________
xcartmods.co.uk
Reply With Quote

The following 2 users thank PhilJ for this useful post:
elmirage001 (01-21-2022), peggyr (01-26-2022)
  #3  
Old 01-20-2022, 06:54 AM
 
keystone keystone is offline
 

X-Adept
  
Join Date: Jul 2006
Location: USA
Posts: 787
 

Default Re: limit the number of characters allowed on address line 1

Beautiful, thanks Phil. Exactly what I needed.
__________________
www.uscandleco.com - X-Cart Version 4.7.11 Gold Plus php7.3
mods:
reCaptcha
running on UNIX

www.keystonecandle.com X-Cart Gold Plus - Version 4.7.11 php7.2
mods:
reCaptcha
cdseo pro
running on UNIX
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 08:26 PM.

   

 
X-Cart forums © 2001-2020