Jump to content

[solved] Remove contact us drop down


ltempest

Recommended Posts

The contact form sends to a "contact" as configured in the back office so this field is needed internally by Prestashop. However, you could embed a known contact ID as a hidden variable in the form and then comment out the unwanted subject layout.

 

in {theme_dir}/contact-form.tpl you currently should have a section like this:

 

<p class="select">
			<label for="id_contact">{l s='Subject Heading'}</label>
{if isset($customerThread.id_contact)}
{foreach from=$contacts item=contact}
 {if $contact.id_contact == $customerThread.id_contact}
  <input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />
  <input type="hidden" name="id_contact" value="{$contact.id_contact}" />
 {/if}
{/foreach}
  </p>
  {else}
<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">
 <option value="0">{l s='-- Choose --'}</option>
{foreach from=$contacts item=contact}
 <option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
  </p>
  <p id="desc_contact0" class="desc_contact"> </p>
{foreach from=$contacts item=contact}
 <p id="desc_contact{$contact.id_contact|intval}" class="desc_contact" style="display:none;">
  <label> </label>{$contact.description|escape:'htmlall':'UTF-8'}
 </p>
{/foreach}
  {/if}

 

What you would need to change it to is something like:

 

{if isset($customerThread.id_contact)}
			<input type="hidden" name="id_contact" value="{$customerThread.id_contact}" />
		{else}
			<input type="hidden" name="id_contact" value="1234" />
		{/if}

 

where "1234" is the id of the contact you want the messages to go to. So if not contact is already set, it gets hardcoded to 1234 otherwise it uses what was passed in the form variable.

 

Cheers

Edited by codegrunt (see edit history)
  • Like 1
Link to comment
Share on other sites

Codegrunt,

Thanks for the reply and code, I have tried inserting this into my template file as shown, it now does not display the dropdwon field, but it errors when the send button is clicked it is still asking for the selection. I have changed the 1234 number, is there something in the validation file that needs changing?

 

Thanks for the help

 

Lee

Link to comment
Share on other sites

Unfortunately I can't the website is not currently live and the client does not want the rest of the world, or google to find it until they approve the site.

 

Sorry, I could give you access if I knew your IP address, but not sure you want to post that publically on here!

Link to comment
Share on other sites

  • 9 months later...

The contact form sends to a "contact" as configured in the back office so this field is needed internally by Prestashop. However, you could embed a known contact ID as a hidden variable in the form and then comment out the unwanted subject layout.

 

in {theme_dir}/contact-form.tpl you currently should have a section like this:

 

<p class="select">
			<label for="id_contact">{l s='Subject Heading'}</label>
{if isset($customerThread.id_contact)}
{foreach from=$contacts item=contact}
 {if $contact.id_contact == $customerThread.id_contact}
  <input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />
  <input type="hidden" name="id_contact" value="{$contact.id_contact}" />
 {/if}
{/foreach}
  </p>
  {else}
<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">
 <option value="0">{l s='-- Choose --'}</option>
{foreach from=$contacts item=contact}
 <option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
  </p>
  <p id="desc_contact0" class="desc_contact"> </p>
{foreach from=$contacts item=contact}
 <p id="desc_contact{$contact.id_contact|intval}" class="desc_contact" style="display:none;">
  <label> </label>{$contact.description|escape:'htmlall':'UTF-8'}
 </p>
{/foreach}
  {/if}

 

What you would need to change it to is something like:

 

{if isset($customerThread.id_contact)}
			<input type="hidden" name="id_contact" value="{$customerThread.id_contact}" />
		{else}
			<input type="hidden" name="id_contact" value="1234" />
		{/if}

 

where "1234" is the id of the contact you want the messages to go to. So if not contact is already set, it gets hardcoded to 1234 otherwise it uses what was passed in the form variable.

 

Cheers

 

 

perfect worked for me, i just had to change the variable to my actual contact type (I just set it to 1 instead of 1234). Thanks!

Link to comment
Share on other sites

  • 2 years later...
  • 3 years later...

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