joan-coquelin Posted July 4, 2017 Share Posted July 4, 2017 (edited) Hello, First sorry if I am not posting at the right place I am very new to prestashop. Here is my problem and I would like to thank in advance each and everyone of you for trying to help me. I have a catalog I would like that when the visitors of my website hover my products they not only have access to a button "details" but also a button "Get a quote" that would be linked to a custom form. From my research it seems I have to create my custom CMS page for the form which I should be able to manage. Now my question is, how can I add this button there please ? Thank you very much, Joan Edited July 4, 2017 by joan-coquelin (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted July 4, 2017 Share Posted July 4, 2017 You can set a static link to the contact page or another page, where you have a custom contact form. As mentionned above, for lists it is the file product-list.tpl and for product details it is the file product.tpl. If your form can process GET or POST variables, it would be recommended to predefince some kind of text, preferably the product name.The default prestashop contact form is able to process these kind of variables. Otherwise you might get quotes from customers without mentionning the product itself. Link to comment Share on other sites More sharing options...
joan-coquelin Posted July 5, 2017 Author Share Posted July 5, 2017 Hi, Thank you both very much for your answer. If I get it right I edit product-list.tpl and product.tpl to add a button, from there I can point to a custom CMS page that would be my form. Now I have two questions : how do I "pass" for example, the name of the product on which the button was, to the form how can I run a script after clicking the button "Request a quote" from the form Understand I am a programmer but absolutely not a web developer. So you can assume I understand programming terminology and stuff but at the same time I know nothing as how to do that kind of things. With that in mind would any one of you be kind enough to guide me a little more. Thank you once again ! Joan Link to comment Share on other sites More sharing options...
Scully Posted July 5, 2017 Share Posted July 5, 2017 (edited) I would recommend not to create an addditional form but instead use the default contact form. You can pass parameters there like this: http://example.com/contact-us?message=request quote ... where message is the field name of the long free text field in the contact form. Translated into product.tpl, it would loke something like this around line 100 and following: Only the middle line with getPageLink is new. The other two lines just illustrate the place where I have put this in. </div> <!-- end image-block --> <h3><a href="{$link->getPageLink('contact', true)|escape:'html'}?message={l s='I request a quote for:'} {$product->name|escape:'html':'UTF-8'}" title="{l s='Request quote'}" rel="nofollow">{l s='Request your quote'}</a></h3> {if isset($images) && count($images) > 0} And the result: A new large Link which points to the contact form and the product name is already filled in like this: I request a quote for Product XYZ. Tested on prestashop 1.6.1.13. Edited July 5, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
joan-coquelin Posted July 5, 2017 Author Share Posted July 5, 2017 Hi, Thank you very much for your answer. I do see the benefits of your method. But how would I be able to get the contact information of my potential client if I use the default form because I need to ask basic information like phone number, company, email in order to reply (We do not want to use the account module as we want to make it as easy as possible for users to request a quote and therefore not having to create an account in the first place as many people are reluctant to do so). Thank you Joan Link to comment Share on other sites More sharing options...
Scully Posted July 5, 2017 Share Posted July 5, 2017 Look here: https://www.prestashop.com/forums/topic/618098-contact-form-subject-heading/ In this topic I explained how to add additional fields to the default contact form. The cool thing with my solution is that it automatically puts in the customer name and customer ID into the correesponding new form field when the user is logged in. So each time I get a message with an ID at the end, I know that this is an existing customer. Link to comment Share on other sites More sharing options...
joan-coquelin Posted July 5, 2017 Author Share Posted July 5, 2017 Cannot thank you enough for your help. Will try this asap and come back to you. Thank you Joan Link to comment Share on other sites More sharing options...
Scully Posted July 5, 2017 Share Posted July 5, 2017 Hi Joan, Your welcome. Don't forget to change your e-mail templates as well as soon as you have added the new fields. My example code adds new fiels for customer name as well as customer phone. best regards, Link to comment Share on other sites More sharing options...
joan-coquelin Posted July 5, 2017 Author Share Posted July 5, 2017 HI Scully, Excuse for me for asking that but where can I change my email templates ? Also do you know why it seems I cannot open a new topic about a different question ? Thank you Joan Link to comment Share on other sites More sharing options...
Scully Posted July 5, 2017 Share Posted July 5, 2017 No clue about your new topic issue, sorry for that. The e-mail templates are stored in the folder ../mails/xx Where xx represents your languare code. The two files relevant for you are named concat.txt contact.html These are the files used to send you or the merchant a copy of the data transmitted by contact-form. For html your additional code would look like this (around line 90) <span style="color:#333"><strong>Name Kunde:</strong></span> {custname}<br /><br /> <span style="color:#333"><strong>Telefon Kunde:</strong></span> {custphone}<br /><br /> The fields you add here must corrspond with name naming of the code above mentionned. Link to comment Share on other sites More sharing options...
joan-coquelin Posted July 5, 2017 Author Share Posted July 5, 2017 Hey Scully, Apparently my post problem solved itself. Will do as you say for my emails. Thanks so much. Have an awesome day 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