Add custom Select to contact form Magento 2 - Theme Luma The 2019 Stack Overflow Developer Survey Results Are InAdd custom field to contact form Magento 2?Luma theme mobile menu errorAdd a “Contact us” form on each productMagento 2 Add new field to Magento_User admin formHow to add subject and attachment field in contact form?contact form edit fieldsAdd checkbox required in checkout page Magento 2 LumaAdd new custom field in magento 2 contact formSend Contact Form To Different Email, Depending on Select Value?magento 2 luma theme - container names
How come people say “Would of”?
How to type this arrow in math mode?
Mathematics of imaging the black hole
Why does the nucleus not repel itself?
Button changing its text & action. Good or terrible?
Worn-tile Scrabble
What is preventing me from simply constructing a hash that's lower than the current target?
Deal with toxic manager when you can't quit
How to support a colleague who finds meetings extremely tiring?
What do hard-Brexiteers want with respect to the Irish border?
Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?
Why is the maximum length of OpenWrt’s root password 8 characters?
Is it okay to consider publishing in my first year of PhD?
What is the most efficient way to store a numeric range?
How to notate time signature switching consistently every measure
Geography at the pixel level
Can we generate random numbers using irrational numbers like π and e?
Can I have a signal generator on while it's not connected?
Likelihood that a superbug or lethal virus could come from a landfill
Does HR tell a hiring manager about salary negotiations?
What do I do when my TA workload is more than expected?
What is this sharp, curved notch on my knife for?
How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Add custom Select to contact form Magento 2 - Theme Luma
The 2019 Stack Overflow Developer Survey Results Are InAdd custom field to contact form Magento 2?Luma theme mobile menu errorAdd a “Contact us” form on each productMagento 2 Add new field to Magento_User admin formHow to add subject and attachment field in contact form?contact form edit fieldsAdd checkbox required in checkout page Magento 2 LumaAdd new custom field in magento 2 contact formSend Contact Form To Different Email, Depending on Select Value?magento 2 luma theme - container names
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
following other guides, I added in the page form to
/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml
and I added the code
<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>
I adjusted the template that I get email but the field is always empty.
trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment
What am I doing wrong? how can i fix it?
magento2 magento-2.1 forms luma-theme contact-form
add a comment |
following other guides, I added in the page form to
/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml
and I added the code
<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>
I adjusted the template that I get email but the field is always empty.
trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment
What am I doing wrong? how can i fix it?
magento2 magento-2.1 forms luma-theme contact-form
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
Don't update the core modules files, you have to override themodule-contact
then you update the phtml as you need in a new one !
– PЯINCƏ
Mar 21 '18 at 19:49
how can i do this?
– Alessandro
Mar 21 '18 at 20:34
add a comment |
following other guides, I added in the page form to
/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml
and I added the code
<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>
I adjusted the template that I get email but the field is always empty.
trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment
What am I doing wrong? how can i fix it?
magento2 magento-2.1 forms luma-theme contact-form
following other guides, I added in the page form to
/httpdocs/vendor/magento/module-contact/view/frontend/templates/form.phtml
and I added the code
<div class="field selezione required">
<label class="label" for="subject"><span><?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?></span></label>
<div class="control">
<select selectname="selezione" id="selezione" title="<?php /* @escapeNotVerified */ echo __('Come hai conosciuto AvaloItalia?') ?>" data-validate="required:true" value="ciao">
<option value="facebook">Facebook</option>
<option value="google">Google</option>
<option value="altro">Altro</option>
</select>
</div>
</div>
I adjusted the template that I get email but the field is always empty.
trans "Name: %name" name=$data.name
trans "Email: %email" email=$data.email
trans "Phone Number: %telephone" telephone=$data.telephone
trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione
trans "Comment: %comment" comment=$data.comment
What am I doing wrong? how can i fix it?
magento2 magento-2.1 forms luma-theme contact-form
magento2 magento-2.1 forms luma-theme contact-form
edited Mar 21 '18 at 18:43
Alessandro
asked Mar 19 '18 at 17:37
AlessandroAlessandro
75110
75110
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
Don't update the core modules files, you have to override themodule-contact
then you update the phtml as you need in a new one !
– PЯINCƏ
Mar 21 '18 at 19:49
how can i do this?
– Alessandro
Mar 21 '18 at 20:34
add a comment |
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
Don't update the core modules files, you have to override themodule-contact
then you update the phtml as you need in a new one !
– PЯINCƏ
Mar 21 '18 at 19:49
how can i do this?
– Alessandro
Mar 21 '18 at 20:34
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
Don't update the core modules files, you have to override the
module-contact
then you update the phtml as you need in a new one !– PЯINCƏ
Mar 21 '18 at 19:49
Don't update the core modules files, you have to override the
module-contact
then you update the phtml as you need in a new one !– PЯINCƏ
Mar 21 '18 at 19:49
how can i do this?
– Alessandro
Mar 21 '18 at 20:34
how can i do this?
– Alessandro
Mar 21 '18 at 20:34
add a comment |
1 Answer
1
active
oldest
votes
I did this in Magento 2.2.X
1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:
<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>
2) Run this code:
php bin/magento setup:upgrade
php bin/magento cache:flush
3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one
4) In Load default template choose a template in this case Contact Form and click on the button Load Template.
5) Add a name to the template.
6) In template content Open a space in the code and place this:
<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>
7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f218935%2fadd-custom-select-to-contact-form-magento-2-theme-luma%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I did this in Magento 2.2.X
1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:
<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>
2) Run this code:
php bin/magento setup:upgrade
php bin/magento cache:flush
3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one
4) In Load default template choose a template in this case Contact Form and click on the button Load Template.
5) Add a name to the template.
6) In template content Open a space in the code and place this:
<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>
7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.
add a comment |
I did this in Magento 2.2.X
1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:
<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>
2) Run this code:
php bin/magento setup:upgrade
php bin/magento cache:flush
3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one
4) In Load default template choose a template in this case Contact Form and click on the button Load Template.
5) Add a name to the template.
6) In template content Open a space in the code and place this:
<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>
7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.
add a comment |
I did this in Magento 2.2.X
1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:
<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>
2) Run this code:
php bin/magento setup:upgrade
php bin/magento cache:flush
3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one
4) In Load default template choose a template in this case Contact Form and click on the button Load Template.
5) Add a name to the template.
6) In template content Open a space in the code and place this:
<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>
7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.
I did this in Magento 2.2.X
1) Put this in your app/design/frontend/[theme-provider]/[theme-name]/Magento_Contact/templates/form.phtml and modify it to your liking, for example add a new select box as follows:
<div class="field region input-box">
<label for="dropdown"><span><?php /* @escapeNotVerified */ echo __('Region') ?></span></label>
<select name="dropdown" id="dropdown">
<option value="selected">select…</option>
<option name="retail" value="Retail">Retail</option>
<option name="wholesale" value="Wholesale">Wholesale</option>
<option name="customerservice" value="CustomerService">Customer Service</option>
<option name="logistics" value="logistics">Logistics</option>
<option name="general" value="General">General</option>
</select>
</div>
2) Run this code:
php bin/magento setup:upgrade
php bin/magento cache:flush
3) In your dashboard go to > Marketing > Email Templates, you need to create a new template if you don't have one
4) In Load default template choose a template in this case Contact Form and click on the button Load Template.
5) Add a name to the template.
6) In template content Open a space in the code and place this:
<tr>
<td><b>trans "Region"</b></td>
<td>var data.dropdown</td>
</tr>
7) in your dashboard go to > STORES > Configuration > General Contacts > Email Options > Email Template, choose your new email template and save.
edited 4 mins ago
Abdelkebir ELHARFALI
468
468
answered Oct 9 '18 at 21:11
MauriceMaurice
232
232
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f218935%2fadd-custom-select-to-contact-form-magento-2-theme-luma%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you share what variable you have added in your email template ?
– Pawan
Mar 20 '18 at 4:52
I went into Marketing-> Email Templates and I created a new model using the default one, I added the variable trans "Come hai conosciuto AvalonItalia?: %selezione" selezione=$data.selezione and I used this template as default. I modify question with code Template Email.
– Alessandro
Mar 20 '18 at 8:43
Don't update the core modules files, you have to override the
module-contact
then you update the phtml as you need in a new one !– PЯINCƏ
Mar 21 '18 at 19:49
how can i do this?
– Alessandro
Mar 21 '18 at 20:34