Jump to content

Contact Form Subject Heading - Make Primary E-Mail Default Selected?


Recommended Posts

I only have one contact for now (ID 2). Yet my contact form still makes my visitors select this one e-mail address. It doesn't make sense if you only have one contact option that this one e-mail is not already pre-selected. Obviously not user friendly.

 

post-1074395-0-59934700-1455373352_thumb.png

 

How can I make my one contact pre-selected. I don't want to remove the selector in case I add more e-mails in the near future. I would assume I modify codeing in mytemplate> contact-form.tpl but I just don't know how to modify this PHP code to get what I want.

 

Here is the code in my contact-form.tpl page for this selector area:

<div class="form-group selector1">
						<label for="id_contact">{l s='Subject Heading'}</label>
					{if isset($customerThread.id_contact) && $customerThread.id_contact && $contacts|count}
							{assign var=flag value=true}
							{foreach from=$contacts item=contact}
								{if $contact.id_contact == $customerThread.id_contact}
									<input type="text" class="form-control" id="contact_name" name="contact_name" value="{$contact.name|escape:'html':'UTF-8'}" readonly />
									<input type="hidden" name="id_contact" value="{$contact.id_contact|intval}" />
									{$flag=false}
								{/if}
							{/foreach}
							{if $flag && isset($contacts.0.id_contact)}
									<input type="text" class="form-control" id="contact_name" name="contact_name" value="{$contacts.0.name|escape:'html':'UTF-8'}" readonly />
									<input type="hidden" name="id_contact" value="{$contacts.0.id_contact|intval}" />
							{/if}
					</div>
					{else}
						<select id="id_contact" class="form-control" name="id_contact">
							<option value="0">{l s='-- Choose --'}</option>
							{foreach from=$contacts item=contact}
								<option value="{$contact.id_contact|intval}"{if isset($smarty.request.id_contact) && $smarty.request.id_contact == $contact.id_contact} selected="selected"{/if}>{$contact.name|escape:'html':'UTF-8'}</option>
							{/foreach}
						</select>
					</div>
						<p id="desc_contact0" class="desc_contact{if isset($smarty.request.id_contact)} unvisible{/if}"> </p>
						{foreach from=$contacts item=contact}
							<p id="desc_contact{$contact.id_contact|intval}" class="desc_contact contact-title{if !isset($smarty.request.id_contact) || $smarty.request.id_contact|intval != $contact.id_contact|intval} unvisible{/if}">
								<i class="icon-comment-alt"></i>{$contact.description|escape:'html':'UTF-8'}
							</p>
						{/foreach}
					{/if}

Help would be much appreciated.

Link to comment
Share on other sites

  • 4 months later...
Guest locen

Hi, did you solve this problem? or found a solution to don't send email unless choosing subject?

 

Thanks

Link to comment
Share on other sites

  • 1 year later...

Got the same issue and solved it doing the following (prestashop v1.6.1.17):

(Please note if you have more than 1 entry in BO->Customers->Contacts, it will select the first entry as default)

Go to themes folder and edit contact-form.tpl

Simply delete/comment out this line(mine is on line 48, 75 and 92): <option value="0">{l s='-- Choose --'}</option>

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...