Hi
my client has a team of 1000+ employees with minimum of 100+ employees in each department. i want to customize the contact form to add the department field selection, so that each department receives only related contact inquiries. I'm ready to pay for the readymade solution for this if available. I'm in a bit hurry to implement customization of the contact form, please help me with solution.
thanks in advance
There are some Magento Extensions that may be able to help you out with this feature set. Check out:
Best of luck!
app/code/Custom/ContactForm
app/code/Custom/ContactForm/registration.php
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Custom_ContactForm', __DIR__ );
app/code/Custom/ContactForm/etc/module.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Custom_ContactForm" setup_version="1.0.0"> <sequence> <module name="Magento_Contact"/> </sequence> </module> </config>
app/code/Custom/ContactForm/Plugin/ContactPost.php
<?php namespace Custom\ContactForm\Plugin; class ContactPost { public function aroundExecute( \Magento\Contact\Controller\Index\Post $subject, \Closure $proceed ) { // Your customization logic goes here // Call the original method $result = $proceed(); return $result; } }
// Inside the aroundExecute method $request = $subject->getRequest(); $department = $request->getParam('department'); // Implement your logic based on the selected department if ($department == 'sales') { // Customize for the Sales department } elseif ($department == 'support') { // Customize for the Support department } // Call the original method $result = $proceed(); return $result;
app/code/Custom/ContactForm/etc/di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Contact\Controller\Index\Post"> <plugin name="custom_contactform_contactpost" type="Custom\ContactForm\Plugin\ContactPost" sortOrder="1"/> </type> </config>
php bin/magento setup:upgrade php bin/magento cache:flush