Black Friday 2026 50% off every plan Our biggest deal of the year on #1 Joomla products.
Ends in 12d 04h 01m 48s
Claim 50% off
Solved SP Page Builder

Ajax contact addon : Option for the applicant to receive a copy of their application

Asked by Grégory 1 year ago Last activity 1 year ago

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

  1. 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);
    }
  1. 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

Accepted answer

Marked as the solution
Atick Eashrak Shuvo Staff

Thank you very much for your feedback.

We recommend considering the use of the 'Form Builder' addon, as it provides more options, including the ability to add an email header and send the form submission to the customer by including their email in CC.

If you prefer to continue using the modified 'Contact Form', we advise against altering the core component code, as updates to the component may overwrite your changes. Instead, we suggest using an add-on override. You can refer to the following documentation for guidance on how to override SP Page Builder addons: SP Page Builder Add-on Override Documentation.

Let us know if you need further assistance!

Log in to reply.