Jump to content

Order confirmation is sometimes sent with placeholders


telefontastatur

Recommended Posts

Hello,

we have been working with PrestaShop 1.6 for a couple of years and decided to switch over to the latest version 1.7.6 (especially because of PHP 7). Everything works fine but we experience a strange problem with the order confirmation that is sent after an order has been placed. Every day, we have several orders but about once a week, the order confirmation does not contain the right values of that order (names, products and so on) but only the placeholders from the mail template (see screenshot). The shop logo (image) is also sent as an attachment but is not directly included in the mail body. Furthermore: When paying with PayPal, the invoice is attached as a PDF file — and it includes the real values! This is really, really strange ...

Has anyone else experienced that behaviour?

order_conf.png

Edited by telefontastatur
Added tags (see edit history)
Link to comment
Share on other sites

  • 8 months later...

Hi, did you solve this problem? I've same issue...

On 8/26/2019 at 11:31 AM, telefontastatur said:

Hello,

we have been working with PrestaShop 1.6 for a couple of years and decided to switch over to the latest version 1.7.6 (especially because of PHP 7). Everything works fine but we experience a strange problem with the order confirmation that is sent after an order has been placed. Every day, we have several orders but about once a week, the order confirmation does not contain the right values of that order (names, products and so on) but only the placeholders from the mail template (see screenshot). The shop logo (image) is also sent as an attachment but is not directly included in the mail body. Furthermore: When paying with PayPal, the invoice is attached as a PDF file — and it includes the real values! This is really, really strange ...

Has anyone else experienced that behaviour?

order_conf.png

 

Link to comment
Share on other sites

  • 5 months later...
1 minute ago, RoadToSuccess said:

This is happening to us as well in 1.7 version.  Random but indeed crazy making. Any resolution?

 

On 8/26/2019 at 5:31 AM, telefontastatur said:

Hello,

we have been working with PrestaShop 1.6 for a couple of years and decided to switch over to the latest version 1.7.6 (especially because of PHP 7). Everything works fine but we experience a strange problem with the order confirmation that is sent after an order has been placed. Every day, we have several orders but about once a week, the order confirmation does not contain the right values of that order (names, products and so on) but only the placeholders from the mail template (see screenshot). The shop logo (image) is also sent as an attachment but is not directly included in the mail body. Furthermore: When paying with PayPal, the invoice is attached as a PDF file — and it includes the real values! This is really, really strange ...

Has anyone else experienced that behaviour?

order_conf.png

This is happening to us as well in 1.7 version.  Random but indeed crazy making. Any resolution?

Link to comment
Share on other sites

Yes, we were able to find the reason for this problem. It occurs when the e-mail address of the recipient contains uppercase letters. Maybe, that problem has already been solved by an update. If not, you can do the following: Create an override for the file classes/Mail.php und change the function "send" by adding this code after calling the actionEmailSendBefore hook ($hookBeforeEmailResult = Hook::exec('actionEmailSendBefore', ...);):

$toModified=array();
if (is_array($to) && isset($to)) {
    foreach ($to as $key => $addr) {
      $toModified[$key]=strtolower($addr);
    }
    $to=$toModified;
} else {
  $to=strtolower($to);
}

This converts all e-mail addresses to lowercase. Creating an override is probably not the best solution but it did the trick for us.

Link to comment
Share on other sites

Thank you so much.  I would like to try this hoping it resolves this issue for me.

Here is what I have in the mail.php that you are referring to:

What is it you are stating to do? Could you copy this section of your mail.php to demonstrate?

 

     $hookBeforeEmailResult = Hook::exec(
            'actionEmailSendBefore',
            [
                'idLang' => &$idLang,
                'template' => &$template,
                'subject' => &$subject,
                'templateVars' => &$templateVars,
                'to' => &$to,
                'toName' => &$toName,
                'from' => &$from,
                'fromName' => &$fromName,
                'fileAttachment' => &$fileAttachment,
                'mode_smtp' => &$mode_smtp,
                'templatePath' => &$templatePath,
                'die' => &$die,
                'idShop' => &$idShop,
                'bcc' => &$bcc,
                'replyTo' => &$replyTo,
            ],
            null,
            true
        );

 

 

Link to comment
Share on other sites

Add my code directly after your code:

$hookBeforeEmailResult = Hook::exec(
      'actionEmailSendBefore',
      [
          'idLang' => &$idLang,
          'template' => &$template,
          'subject' => &$subject,
          'templateVars' => &$templateVars,
          'to' => &$to,
          'toName' => &$toName,
          'from' => &$from,
          'fromName' => &$fromName,
          'fileAttachment' => &$fileAttachment,
          'mode_smtp' => &$mode_smtp,
          'templatePath' => &$templatePath,
          'die' => &$die,
          'idShop' => &$idShop,
          'bcc' => &$bcc,
          'replyTo' => &$replyTo,
      ],
      null,
      true
);

$toModified=array();
if (is_array($to) && isset($to)) {
    foreach ($to as $key => $addr) {
      $toModified[$key]=strtolower($addr);
    }
    $to=$toModified;
} else {
  $to=strtolower($to);
}

 

  • Like 1
Link to comment
Share on other sites

I cannot thank you enough for your help, it was like looking for a needle in a haystack.  I made the recommended change so we will see over time.

The most recent two that this happened to, the customer email in admin shows email with all lower case.  With these two, in addition to the placeholders in confirmation, when I send shipping notification from admin it too does the same. 

Again, thank you. I will post back a status in future.

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...