2

We add custom option in contact page:

<div class="field ordernumber">
                            <div class="control">
                                <input placeholder="<?php echo __('Order Number') ?>" name="ordernumber" id="ordernumber"
                                       title="<?php /* @escapeNotVerified */
                                       echo __('Order Number') ?>" value="" class="input-text" type="text"/>
                            </div>
                        </div>
                                                        <div class="field rodzajzgloszenia">
                <div class="control">
                    <input placeholder="<?php echo __('Rodzaj zgloszenia') ?>" name="rodzajzgloszenia" id="rodzajzgloszenia"
                           title="<?php /* @escapeNotVerified */
                           echo __('Rodzaj zgloszenia') ?>" value="" class="input-text" type="text"/>
                </div>
            </div>

email Template:

<tr>
           <td><strong>{{trans "Order Number"}}</strong></td>
        <td>{{var data.ordernumber}}</td>
    </tr>
<tr>
           <td><strong>{{trans "Rodzaj zgloszenia"}}</strong></td>
        <td>{{var data.rodzajzgloszenia}}</td>
    </tr>

But how to create in field: Rodzaj zgłoszenia dropdown with select option and forward in email selected option?

1 Answer 1

2

Go to this file form.phtml and write the code :-

<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>

After run the command :-

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:f

And last add this code your contact email Template

<tr>
    <td><b>{{trans "Region"}}</b></td>
    <td>{{var data.dropdown}}</td>
</tr>

And more useful link :-

Add custom Select to contact form Magento 2 - Theme Luma

Hope this help

Thanks ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.