Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Autopopulate "Contact Form" form fields

By
Lucia
on 6/29/16, 10:35 AM 288 views

Hello everyone, I am using Odoo 9 and I have been trying to autopopulate the "Subject" field of the website's contact form.

So far, each product of the shop has an "Add to cart" button, and I have added a "Contact us" button as well. When the user clicks on the "Contact us" button, the user is sent to the Contact Form. In this scenario, I wish to autopopulate the Subject field of the contact form with the product's name that the customer was checking out before clicking on the contact button.For example, if the user is checking out the product named "Computer" and clicks on the corresponding Contact us" button, the subject field should be autopopulated with "Computer".

The nuance to this is that if a customer enters the website for the first time and goes directly to the Contact Form, the Subject field should be empty, since he is not interested in a specific product.


So far I have tried the following code on the "Product" xml template

<a t-att-href="/page/contactus?name=#{product.name}" class="btn btn-primary btn-lg mt8 js_check_product a-submit"> <font style="font-size: 18px;">Contact us</font> </a>

But this instead of populating the form with the product's name, it populates the form with the word "product.name". Does anyone have any idea how to solve this?

0

Axel Mendoza

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 6/29/16, 4:53 PM

You need to extends the Contact Form controller to pass the product object record to the template rendering, also that controller need to receive the product id to be able to retrieve their name or if you like you could pass the name directly for the Contact Us link

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/29/16, 10:35 AM
Seen: 288 times
Last updated: 6/29/16, 4:53 PM