Jump to content

Change customizable field from textarea to input on product.tpl


Recommended Posts

Hello,

 

when I change the textarea customizable field:

<textarea name="textField{$field.id_customization_field}" class="form-control customization_block_input" id="textField{$customizationField}" rows="3" cols="20">{strip}
											{if isset($textFields.$key)}
												{$textFields.$key|stripslashes}
											{/if}
										{/strip}</textarea>

to:

<input name="textField{$field.id_customization_field}" class="" value="{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}" id="textField{$customizationField}">

It shows an error after click on Add to cart button "Please fill in all the required fields before saving your customization."

 

Does anyone have any idea why it happens?

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

you need to change in two files product.tpl and tools.js

 

In product.tpl need to change

<input name="textField{$field.id_customization_field}" class="form-control customization_block_input" id="textField{$customizationField}" rows="3" cols="20" value="{strip}
										{if isset($textFields.$key)}
												{$textFields.$key|stripslashes}
											{/if}{/strip}">
									</li>
									{counter}
								{/if}
							{/foreach}
							</ul>
						</div>
					{/if}

and in tools.js

Replace

if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '' ||  $('#' + customizationFields[i][0]).text() != $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class')))

with

if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).val() == '' ||  $('#' + customizationFields[i][0]).text() == $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class')))
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...