Hello
I'm missing the ability to have a copy of what the customer requests on the form sent to them.
Currently, there's only a warning message stating that the request has been received, which is great, but the customer needs to be able to remember the purpose of their request if we contact them.
So I implemented it myself, but for the moment, it's only an option on the add-on's administration side; it's therefore not an option that appears on the customer form side.
Hope this will be added in future version.
DISCLAIMER
You use and apply this code at your own risk. Under no circumstances will Joomshaper or I be liable for its use or support.
Here you are what I've done to do so
- components/com_sppagebuilder/addons/ajax_contact/site.php
Just after :
$show_label = (isset($settings->show_label) && $settings->show_label) ? $settings->show_label : false;
Add :
$send_copy_to_sender = (isset($settings->send_copy_to_sender) && $settings->send_copy_to_sender) ? $settings->send_copy_to_sender : 0;
Just after :
$from_name = base64_decode($decrypted_data->from_name);
Add :
$send_copy = isset($decrypted_data->send_copy) ? $decrypted_data->send_copy : 0;
Just after :
if ($mail->sendMail($senderMail, $senderName, $recipient, $mailSubject, $mailBody, $isHtmlMode, $cc, $bcc, $attachment, $email, $name)) {
Add :
// If the send copy option is enabled, send a copy to the requester
if ($send_copy) {
// Create a new email for the copy
$copyMail = Factory::getMailer();
// Create a topic for copying
$copySubject = Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_COPY_SUBJECT') . ' ' . $subject;
// Create a message for the copy with a header explaining that it is a copy
$copyBody = '<p>' . Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_COPY_MESSAGE') . '</p>';
$copyBody .= $mailBody;
// Send the copy to the applicant
$copyMail->sendMail($senderMail, $senderName, $email, $copySubject, $copyBody, $isHtmlMode);
}
- components/com_sppagebuilder/addons/ajax_contact/admin.php
Juste after (line 53) :
'std' => '0',
],
Add :
'send_copy_to_sender' => [
'type' => 'checkbox',
'title' => Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND_COPY'),
'desc' => Text::_('COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND_COPY_DESC'),
'std' => 0
],
And last add translations strings as languages overrides or in the respective files from the languges you need :
administrator/language/en-GB/en-GB.com_sppagebuilder.ini
language/en-GB/en-GB.com_sppagebuilder.ini
With :
COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND_COPY="Send a copy to the applicant"
COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_SEND_COPY_DESC="If enabled, a copy of the message will be sent to the requester's email address."
COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_COPY_SUBJECT="Copy of your message:"
COM_SPPAGEBUILDER_ADDON_AJAX_CONTACT_COPY_MESSAGE="This is a copy of the message you sent:"
And you'll get a checkbox on the settings to send or not a copy to the requester.
Regards