Jump to content

Formulaire de contact, ne pas envoyer de mail de confirmation. Presta 1.6


Recommended Posts

Bonjour,

Lorsque qu'on utilise le formulaire de contact pour me contacter, cela envoie un mail de confirmation à la personne qui me contacte. J'aimerai supprimer l'envoi de cette confirmation.

J'ai cherché si une option existe dans le back office (comme pour les statuts de commandes où l'on peut choisir d'envoyer ou non le mail) mais je ne trouve rien. Peut-être que je cherche aux mauvais endroits. :mellow:

Quelqu'un sait où se trouve cette option ou comment faire autrement si ce n'est pas possible depuis le BO ?

Merci

Link to comment
Share on other sites

Non il n'y a pas d'option de ce type.

Il faut aller dans /controllers/front/contactController.php et commenter ce bloc comme suit:

                    /*
                    if (empty($contact->email)) {
                        Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment);
                    } else {
                        if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
                            $var_list, $contact->email, $contact->name, null, null,
                                    $file_attachment, null,    _PS_MAIL_DIR_, false, null, null, $from) ||
                                !Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email)) {
                            $this->errors[] = Tools::displayError('An error occurred while sending the message.');
                        }
                    }*/

 

  • Thanks 1
Link to comment
Share on other sites

Merci :-)

Ça fonctionne.

Trop bien même car je ne reçois plus l'alerte comme quoi on m'a laissé un message. Je ne sais pas si l'envoi des 2 mails peuvent être être dissociés (la confirmation au "client" + la notification au marchand) pour ne garder que la notif au marchand sans rentrer dans des modifications complexes.

En attendant ça m'ira comme ça, je me connecterais plus souvent au BO pour vérifier les éventuels contacts.

Link to comment
Share on other sites

Alors après le bloc commenté, écrivez ceci:

if (!empty($contact->email)) {
      Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
      $var_list, $contact->email, $contact->name, null, null,
      $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from);
}

 

  • Thanks 1
Link to comment
Share on other sites

  • 2 years later...

Bonjour,

C'est bizarre car moi je voulais l'inverse avec une confirmation de commande envoyé au client car je n'en avais pas...

En 1.6.1.24 dans contactController.php il y a ceci :

if (!empty($contact->email)) {
                        if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
                            $var_list, $contact->email, $contact->name, null, null,
                                    $file_attachment, null,    _PS_MAIL_DIR_, false, null, null, $from)) {
                            $this->errors[] = Tools::displayError('An error occurred while sending the message.');
                        }
                    }

J'ai donc modifié la condition par celle @Eolia à savoir :

if (empty($contact->email)) {
                        Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment);
                    } else {
                        if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]',
                            $var_list, $contact->email, $contact->name, null, null,
                                    $file_attachment, null,    _PS_MAIL_DIR_, false, null, null, $from) ||
                                !Mail::Send($this->context->language->id, 'contact_form', ((isset($ct) && Validate::isLoadedObject($ct)) ? sprintf(Mail::l('Your message has been correctly sent #ct%1$s #tc%2$s'), $ct->id, $ct->token) : Mail::l('Your message has been correctly sent')), $var_list, $from, null, null, null, $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $contact->email)) {
                            $this->errors[] = Tools::displayError('An error occurred while sending the message.');
                        }
                    }

Et j'ai désormais les confirmations de commande envoyées aux clients.

Étrange non ? ^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...