evolution.x Posted September 13, 2010 Share Posted September 13, 2010 Hi,Does anyone know if prestashop is able to use two separate contact forms, for example i need the general contact form located at contact-form.php then i need another one on maybe a CMS page for a trade application??I think it may be possible to use the current contact form but duplicate it and call all relevant files/hooks/calls contact-form2 for example. It needs to have all the same functions and maybe a dedicated back office page.Basically i need contact-form.php and contact-form2.php which work completely separate to each other.Any help off you guys on this matter would be greatly appreciated!!!Thanks in advance.Adam Link to comment Share on other sites More sharing options...
jhnstcks Posted September 13, 2010 Share Posted September 13, 2010 Yes, you just need to duplicate the contact-form.php that is in the root folder and the contact-form.tpl in the theme, change the names of the files to match each other. At the bottom of the php file, you need to change the file that is called to the tpl you renamed. 1 Link to comment Share on other sites More sharing options...
shagpun Posted September 29, 2010 Share Posted September 29, 2010 Yes, you just need to duplicate the contact-form.php that is in the root folder and the contact-form.tpl in the theme, change the names of the files to match each other. At the bottom of the php file, you need to change the file that is called to the tpl you renamed. excellent. This seems to work but I'm wondering how I might go about embedding a form into a CMS page. I want the client to be able to add content to the page via the backend CMS feature but I want the contact form to be hard-coded below that content so they can't screw things up with it. Right now I'm using: {if $smarty.get.id_cms == '13'} to control content on specific pages (not sure if that's the best technique or not but works well). So I'd like to embed another contact form into the tpl file that only appears on certain pages. I tried copying from and hacking up the code from contact-form.tpl and adding to my cms.tpl file but I can't get it to work. I've also had a ton of problems using generic (non-presta) contact forms within the cms.tpl file. Any help would be greatly appreciated.thanks, Shag Link to comment Share on other sites More sharing options...
shagpun Posted September 30, 2010 Share Posted September 30, 2010 excellent. This seems to work but I'm wondering how I might go about embedding a form into a CMS page. I want the client to be able to add content to the page via the backend CMS feature but I want the contact form to be hard-coded below that content so they can't screw things up with it. Right now I'm using: {if $smarty.get.id_cms == '13'} to control content on specific pages (not sure if that's the best technique or not but works well). So I'd like to embed another contact form into the tpl file that only appears on certain pages. I tried copying from and hacking up the code from contact-form.tpl and adding to my cms.tpl file but I can't get it to work. I've also had a ton of problems using generic (non-presta) contact forms within the cms.tpl file. Never mind. I hadn't "hacked" hard enough. I was able to embed a contact form on certain CMS pages using the conditional logic described above and using the code below which utilizes the standard contact-form.php out of the box. I just hard-coded some of the values in the form. Only catch is that after the form is submitted, the user gets redirected to the contact-form.php page. I'm sure that's fixed easily enough but I can live with it for now. Here's the (completely hacked and probably not the best way to do it) code I used in my cms.tpl file...(note the hard-coded form action and hidden "id_contact" field to control who the form submits to)> {if isset($confirmation)} {l s='Your message has been successfully sent to our team.'} </pre> <ul> {l s='Home'} </ul> <br>{else}<br><p>{l s='For questions about an order or for information about our products'}.</p> <br><br> {include file=$tpl_dir./errors.tpl}<br> <form action="/dev/contact-form.php" method="post" class="std"><br> <input type="hidden" name="id_contact" value="2" /><br><br><p> {l s='E-mail address :'} <input type="text" id="email" name="from" value="{$email}" /> </p> <br><p> {l s='Message :'} <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> <br><p> <input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send'}" class="button" /> </p> <br><br></form><br>{/if Link to comment Share on other sites More sharing options...
marioperaltas Posted September 12, 2016 Share Posted September 12, 2016 what about prestashop 1.6? Link to comment Share on other sites More sharing options...
dirtrider118 Posted September 7, 2017 Share Posted September 7, 2017 For 1.6 do the following: Duplicate ContactController.php and rename to ex. NewContactController Change class name from ContactControllerCore to ex. NewContactControllerCore Change the php self variable to ex. newcontact on line 29 Duplicate contact-form.tpl and rename to ex. new-contact-form.tpl Point to your new template file by editing $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); on line 255 Delete class_index.php in cache folder in root directory Login to admin backend and add page to SEO & URLS. Access the page URL by http://example.com/i...ller=newcontact This is how i got a second contact page to display. Adding new form fields and variables is up to you. Cheers! 1 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