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)
-   -   limit the number of characters allowed on address line 1 (https://forum.x-cart.com/showthread.php?t=78355)

keystone 01-19-2022 12:39 PM

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.

PhilJ 01-20-2022 12:23 AM

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.

keystone 01-20-2022 06:54 AM

Re: limit the number of characters allowed on address line 1
 
Beautiful, thanks Phil. Exactly what I needed.


All times are GMT -8. The time now is 12:53 AM.

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