Hi guys,
I want to share a small mod to set the max number of characters for product option text fields. I was asked about this feature several times in the last week and here it is.
Example: Monogram field for each product - 3 characters max.
http://regalfav.finestshops.com/store/customer/product.php?productid=149
Here is the code:
skin1/modules/Product_Options/product_options.tpl
change this one:
Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" size=32>
to this:
Code:
<input type=text name="product_options[{$product_options[product_option].optclass}]" size={$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""} maxlength={$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""}>
Max: {$product_options[product_option].optclass|regex_replace:"/[[a-z]|[A-Z]|_/":""} character(s)
Now, just use "optionclass_maxlength" format for product option class.
Like "Message_10" to restrict "Message" filed to 10 characters or
"Monogram_3" field to restrict Monogram field to 3 characters.
Hope this will help somebody. Should work in any version.