keith13908 Posted April 19, 2012 Share Posted April 19, 2012 Hi there, I'm making a website in Prestashop and I'm trying to personalize my contact form. The makers of the theme says to modify the contact-form.tpl file. So far I've managed to rewrite the texts but still don't know how to modify the drop down box and choose the email where the message is sent. :-\ Would you guys know how to solve this? For some reason I believe it isn't difficult, just have to find which part of the code to modify. I'll attach an image for it. Any help would be very much appreciated. Keith Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/ Share on other sites More sharing options...
keith13908 Posted April 19, 2012 Author Share Posted April 19, 2012 There seems to be two contact-form.tpl files. There is also one contact-form.php file. What do you guys think? TPL File 1 {capture name=path}{l s='Contact'}{/capture} {include file=$tpl_dir./breadcrumb.tpl} <h2>{l s='Contact us'}</h2> <div id="contact_us"> {if isset($confirmation)} <p>{l s='Your message has been successfully sent to our team.'}</p> <ul class="footer_links"> <li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li> </ul> {else} <p class="contact_text">{l s='For questions about an order or for information about our products'}.</p> {include file=$tpl_dir./errors.tpl} <form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std"> <fieldset> <p class="select"> <label for="id_contact">{l s='Subject :'}</label> <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> {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} <p> <label for="email">{l s='E-mail address :'}</label> <input type="text" id="email" name="from" value="{$email}" /> </p> <p class="textarea"> <label for="message">{l s='Message :'}</label> <textarea id="message" name="message" rows="7" cols="35">{if isset($smarty.post.message)}{$smarty.post.message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea> </p> <p class="submit"> <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button" /> </p> </fieldset> </form> {/if} </div> TPL File 2 {capture name=path}{l s='Contact'}{/capture} {include file=$tpl_dir./breadcrumb.tpl} <h2>{l s='Contact us'}</h2> {if isset($confirmation)} <p>{l s='Your message has been successfully sent to our team.'}</p> <ul class="footer_links"> <li><a href="{$base_dir}"><img class="icon" alt="" src="{$img_dir}icon/home.gif"/></a><a href="{$base_dir}">{l s='Home'}</a></li> </ul> {else} <p class="bold">{l s='For questions about an order or for information about our products'}.</p> {include file=$tpl_dir./errors.tpl} <form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std"> <fieldset> <h3>{l s='Send a message'}</h3> <p class="select"> <label for="id_contact">{l s='Subject'}</label> <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} <p class="text"> <label for="email">{l s='E-mail address'}</label> <input type="text" id="email" name="from" value="{$email}" /> </p> <p class="textarea"> <label for="message">{l s='Message'}</label> <textarea id="message" name="message" rows="7" cols="35">{if isset($smarty.post.message)}{$smarty.post.message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea> </p> <p class="submit"> <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button_large" onclick="$(this).hide();" /> </p> </fieldset> </form> {/if} PHP File <?php $useSSL = true; include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/header.php'); $errors = array(); $smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang))); if (Tools::isSubmit('submitMessage')) { if (!($from = Tools::getValue('from')) OR !Validate::isEmail($from)) $errors[] = Tools::displayError('invalid e-mail address'); elseif (!($message = nl2br2(Tools::getValue('message')))) $errors[] = Tools::displayError('message cannot be blank'); elseif (!Validate::isMessage($message)) $errors[] = Tools::displayError('invalid message'); elseif (!($id_contact = intval(Tools::getValue('id_contact'))) OR !(Validate::isLoadedObject($contact = new Contact(intval($id_contact), intval($cookie->id_lang))))) $errors[] = Tools::displayError('please select a contact in the list'); else { if (intval($cookie->id_customer)) $customer = new Customer(intval($cookie->id_customer)); if (Mail::Send(intval($cookie->id_lang), 'contact', 'Message from contact form', array('{email}' => $from, '{message}' => stripslashes($message)), $contact->email, $contact->name, $from, (intval($cookie->id_customer) ? $customer->firstname.' '.$customer->lastname : $from))) $smarty->assign('confirmation', 1); else $errors[] = Tools::displayError('an error occurred while sending message'); } } $email = Tools::safeOutput(Tools::getValue('from', ((isset($cookie) AND isset($cookie->email) AND Validate::isEmail($cookie->email)) ? $cookie->email : ''))); $smarty->assign(array( 'errors' => $errors, 'email' => $email )); $smarty->display(_PS_THEME_DIR_.'contact-form.tpl'); include(dirname(__FILE__).'/footer.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1338666 Share on other sites More sharing options...
keith13908 Posted April 30, 2012 Author Share Posted April 30, 2012 Is there anybody that can help? :-\ Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1341668 Share on other sites More sharing options...
PFMaBiSmAd Posted April 30, 2012 Share Posted April 30, 2012 The template should only define the layout/style and in this case the text legends. The actual data is defined elsewhere. I would guess in the '/config/config.inc.php' file. Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1341670 Share on other sites More sharing options...
PFMaBiSmAd Posted April 30, 2012 Share Posted April 30, 2012 It's also highly likely that you configure the selections through the Prestashop admin panel. Have you tried asking on their help Forum? Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1341671 Share on other sites More sharing options...
Jessica Posted April 30, 2012 Share Posted April 30, 2012 $smarty->assign('contacts', Contact::getContacts(intval($cookie->id_lang))); Is the line in the php file that gets the contacts you can select from (which is the subject drop down). If it's not in the config file as PFM suggests, it's probably in a table in your DB. Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1341676 Share on other sites More sharing options...
LiTuNi Posted January 15, 2013 Share Posted January 15, 2013 ... So far I've managed to rewrite the texts but still don't know how to modify the drop down box and choose the email where the message is sent. :-\ ... ... If it's not in the config file as PFM suggests, it's probably in a table in your DB. This thread seems a little old, but had the same problem and though I should share the answer that worked for me: The mail where it's sent can be configured in the backend (at least in prestashop 1.5). You can find it in "Customer"->"Contact" Quote Link to comment https://forums.phpfreaks.com/topic/261230-anyone-knows-hisher-way-around-prestashop-contact-forms/#findComment-1405811 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.