Working with Magento 2.1. I've hit a bit of a bump in adding a field to the review form.
These are the only requirements. An email address field added to the review form. Once the review is submitted, the email address is saved with the review. The email address is displayed ONLY with the review on the admin. Reviews can be searched in the admin by email address.
I found this question: Adding custom fields to review form but is Magento 1 and seems to go off on attaching the email to an order(?).
I listed all of the requirements, but I can't expect anyone to address each of them. I understand that, but I'm at a bit of a loss, and appreciate any help that can be given.
Best Answer
Seeing as how there's no clear answer on this yet, this might help some people. To add an e-mail field (or any other field) to the frontend review form and display it in the admin we have to create a custom module.
With this module we'll:
NOTE: Be sure to replace "Vendor" with your desired vendor name.
app\code\Vendor\ReviewEmail\registration.php
app\code\Vendor\ReviewEmail\etc\module.xml
app\code\Vendor\ReviewEmail\etc\di.xml
app\code\Vendor\ReviewEmail\etc\events.xml
app\code\Vendor\ReviewEmail\Setup\InstallSchema.php
app\code\Vendor\ReviewEmail\Model\Observer\ReviewSave.php
app\code\Vendor\ReviewEmail\Plugin\Magento\Review\Block\Adminhtml\Edit\Form.php
app\code\Vendor\ReviewEmail\view\adminhtml\ui_component\review_listing.xml (Optional, only if you want to show the field in the admin grid as well)
After this all we have left to do is add the field to the review form. In app\design\frontend\Vendor\yourtheme\Magento_Review\templates\form.phtml
Make sure to add this between the
form
tags.After installing the module and clearing your caches you should now have an e-mail field in your review form. Which should be visible in the admin grid and admin review detail view.