findaprezzie Posted April 5, 2012 Share Posted April 5, 2012 When I upload the products in the catalogue is it possible to set the max characters in the attributes section ? For example I want the customers to be able to personalise the product with their name but to the max of 12 characters? Link to comment Share on other sites More sharing options...
phrasespot Posted April 7, 2012 Share Posted April 7, 2012 Locate the file /themes/your_theme/product.tpl, towards the very end of the file, around line 520 find the line which reads {if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea> and replace it with {if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" maxlength="12" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea> (we are adding maxlength attribute to textarea element) This is not fool-proof; one can by-pass it either by messing with the form or the submission. A server side check should also be done but in this case it is unlikely anyone will bother. Link to comment Share on other sites More sharing options...
findaprezzie Posted April 11, 2012 Author Share Posted April 11, 2012 Locate the file /themes/your_theme/product.tpl, towards the very end of the file, around line 520 find the line which reads {if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea> and replace it with {if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" maxlength="12" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea> (we are adding maxlength attribute to textarea element) This is not fool-proof; one can by-pass it either by messing with the form or the submission. A server side check should also be done but in this case it is unlikely anyone will bother. Ive done that but im now confused as it doesnt look like its made any difference in the BO or in the shop its self Link to comment Share on other sites More sharing options...
phrasespot Posted April 11, 2012 Share Posted April 11, 2012 Make sure it is not a caching effect. If not, then provide a URL where I can see the problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now