Post by nbdevelopdreece » Wed Dec 23, 2020 3:53 am

Hello everyone.

On OC 2.3.0.2 when a new order is completed by the customer, most of the time the confirmation email is not sent and I can see in the order menu "Notified customer > No". This does not happen 100% of the time. More like 80% of the time and I have not figured out the pattern. Please note that the rest of the emails are sent normally.

I tried to look in the error log and found 3 'errors'/PHP Notice the time the order was made:

Code: Select all

PHP Notice:  Undefined index: fax in /catalog/controller/checkout/guest.php on line 273
PHP Notice:  Undefined index: address_2 in /catalog/controller/checkout/guest.php on line 285
PHP Notice:  Undefined index: address_2 in /catalog/controller/checkout/guest.php on line 336
So it appears to be an empty variable on each line and I replaced it with checks:

Code: Select all

//line 273 had:
$this->session->data['guest']['fax'] = $this->request->post['fax'];

//replaced 273 with:
if($this->request->post['address_2']==NULL || !isset($this->request->post['address_2'])){
	$this->session->data['payment_address']['address_2'] = "";
}else{
	$this->session->data['payment_address']['address_2'] = $this->request->post['address_2'];
}


//line 285 had:
$this->session->data['payment_address']['address_2'] = $this->request->post['address_2'];

//replaced 285 with:
if($this->request->post['address_2']==NULL || !isset($this->request->post['address_2'])){
	$this->session->data['payment_address']['address_2'] = "";
}else{
	$this->session->data['payment_address']['address_2'] = $this->request->post['address_2'];
}


//line 336 had:
$this->session->data['shipping_address']['address_2'] = $this->request->post['address_2'];

//replaced 336  with:
if($this->request->post['address_2']==NULL || !isset($this->request->post['address_2'])){
	this->session->data['shipping_address']['address_2'] = "";
}else{
	$this->session->data['shipping_address']['address_2'] = $this->request->post['address_2'];
}
Cleared cache and made another test order. The 'PHP Notice' was gone but no email sent. I still think that having these checks is the correct way to go but what can I do to find out why the customer is not notified with a confirmation email?

My firsth thought is to make an order.log where on each line is the exact date and time with the order id. That way I can gather data through the error log to see what is wrong.

Can somebody help me with the emails or the order log? Should I be looking something else?


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by ADD Creative » Wed Dec 23, 2020 7:51 pm

Those errors are probably related to your theme, which could be missing the fax the address 2 fields.

For the order confirmation emails, these are always sent. The Customer Notified being No in the history, does not men the email wasn't sent, it just means there was no message/comment for the customer. This only applies to the order confirmation email, not status updates.

The Customer Notified will be set by the payment module use. For example the Bank Transfer module will set Customer Notified to yes with the instructions whereas the Cash On Delivery will set it to no. What payment modules are you using?

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by nbdevelopdreece » Wed Dec 23, 2020 9:33 pm

I did not know that the notification depends on the payment. Good to know!

However! I do know for a fact that not all emails are sent because I have made test orders myself (with my own email) and I have customers calling all the time for confirmation.

Anyway the payments I use are:
-Cash on delivery
-Bank transfer
-Credit card payment
-Paypal

As far as the fax and address_2 errors are concerned, I thought they were conected with any way to the sent of the emails but they are fixed which is a small win. Hehe... ::)


Posts

Joined
Tue Oct 08, 2019 10:42 pm

Post by ADD Creative » Thu Dec 24, 2020 12:46 am

Some of those payment modules will set Customer Notified to yes and some no. So that where the difference comes from.

If some order confirmation emails are delivered and some aren't, it could be that they are being rejected as spam. Check both the OpenCart error log and also the PHP error log.

Next, if you can check your mails server logs to see if OpenCart passes on the emails to be sent.

If no errors check you errors with an online 'email deliverability checker'.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 12 guests