ltempest Posted May 29, 2012 Share Posted May 29, 2012 HELP, How do I disable the Subject heading drop down on the contact form. I do not need the two options of webmaster or customer service. PLEASE HELP, my client is very unhappy! Thanks Lee Link to comment Share on other sites More sharing options...
codegrunt Posted May 29, 2012 Share Posted May 29, 2012 (edited) 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 May 29, 2012 by codegrunt (see edit history) 1 Link to comment Share on other sites More sharing options...
ltempest Posted May 30, 2012 Author Share Posted May 30, 2012 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 More sharing options...
codegrunt Posted May 30, 2012 Share Posted May 30, 2012 Can you post the URL of the page in question? Link to comment Share on other sites More sharing options...
ltempest Posted May 30, 2012 Author Share Posted May 30, 2012 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 More sharing options...
artofadornment Posted March 29, 2013 Share Posted March 29, 2013 I have this concern as well, and am hoping someone can offer a solution. Like Itempest, I've tried adding the code suggested by codegrunt, but am having the same problem. The "please select a subject from the list" error shows up when I try to send. Ideas? Link to comment Share on other sites More sharing options...
noesac Posted April 1, 2013 Share Posted April 1, 2013 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 More sharing options...
artofadornment Posted April 1, 2013 Share Posted April 1, 2013 ...and noesac adds the final piece! Works great now (using 1.5.3), thanks everyone! Link to comment Share on other sites More sharing options...
noesac Posted April 1, 2013 Share Posted April 1, 2013 Ah glad I could help. Awesome:) Link to comment Share on other sites More sharing options...
vekia Posted April 2, 2013 Share Posted April 2, 2013 thanks for the solution and nice know how :-) Im convinced that this will be helpfull for other forum members i decided to mark this topic as solved thanks ! Link to comment Share on other sites More sharing options...
samsonv_05 Posted October 13, 2015 Share Posted October 13, 2015 Any way to do this with PS 1.6.1.1? When i test the form, after hiding the drop down, I get the error: There is 1 error Please select a subject from the list provided.website: valeriesamsondesign.ca/test Thanks! Link to comment Share on other sites More sharing options...
gabiferbe Posted June 18, 2019 Share Posted June 18, 2019 Hi i need the same for prestashop 1.7 please HELP! 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