Order placement email

I have a strange issue with 2.1.1



When an order is placed and payment is made by bank transfer etc, the order status is Open. In the “Order Statuses” section I have for the Open status both “Notify Customer” and Notify Order Dept" ticked. This results in an email of the invoice sent to both the customer and to me…Perfect.



When an order is placed and payment is made by Credit Card, the order status defaults to “Processed”. In the “Order Statuses” section I have for the Processed status both “Notify Customer” and Notify Order Dept" ticked. This results in 2 (Two) emails of the invoice being sent to both the customer and to me…NOT Perfect. If I untick “Notify Customer” and Notify Order Dept" (thinking it would then only send 1 email to each) NO emails are sent.



I am using the Westpac payment processor for Credit Cards



Any ideas on this?

The transaction is first “Open” then, after being processed, the status is changed to “Processed”. Emails are being sent for both the “Open” status and the “Processed” status.

Thanks gginorio

However, the Open and Processed Status have different text but both emails being sent have the same text which is what was put in the Processed Status

Email is NOT sent when going “to” the Open status IF a payment processor is used for the checkout. Not sure what specific “method” you are using for “Bank transfer” but if a response is expected from a 3rd party then the Open status will not have an email sent (since a successful transaction will make the order status Processed).

[quote name=‘gginorio’]The transaction is first “Open” then, after being processed, the status is changed to “Processed”. Emails are being sent for both the “Open” status and the “Processed” status.[/QUOTE]



I am using PayPal Express, and I have set to send emails to customer and order department for both order status of “Open” and “Process”.



Upon a successful payment, and order status changed to “Processed”, only one email is sent to customer and order department.



Therefore, your statement of sending out email for both “Open” and “Processed” is incorrect.

[quote]

Therefore, your statement of sending out email for both “Open” and “Processed” is incorrect.

[/quote]

@guts_glory Not sure what post your response is directed at but I believe mine clearly states that if there is a payment processor associated with the order that there is NO email sent on the transition from Backordered to Open, it is only sent when it moves from Open to Processed.



However, if this is a check, phone, fax, purchase_order or any other kind of order where there is not an outside processor then the email will be sent on the transition from Backordered to Open (note: all orders start out as Backordered).

I’m also experiencing this problem. Duplicate e-mails are sent to both the customer and the orders department. It’s especially confusing for customers who are concerned that they’ve paid twice!



I’ve just tried upgrading to 2.1.2 to see if that helps and it hasn’t.



Does anyone have any ideas?



Many thanks

I’ve seen a few threads which mention this issue in older versions, together with proposed fixes. Unfortunately they don’t really apply to the latest version of CS-Cart.



Also, the following bug report describes the exact problem and was apparently ‘fixed in next version’. Looks like there must be several different bugs with the same symptoms and some still exist, including mine.



[url]http://forum.cs-cart.com/vbugs.php?do=view&vbug_id=1844[/url]



It seems it’s only the e-mail confirming payment after the payment processor completes that’s being duplicated. I’m using Barclays ePDQ. No idea if it’s isolated to certain payment processors or not…

check all your Orders/Order statuses.

You should only be sending notifications to customers for Open and Processed order statuses. (Note: Open is skipped internally if there’s a payment processor).



My guess is that you have “Notify customer” set for statuses you don’t want it set for.

Thanks for the reply, but I don’t see how that could be the case. The e-mails are exact duplicates. They both relate to exactly the same transition to the processed status. The e-mails are also sent at the same time.

[QUOTE]The e-mails are also sent at the same time[/QUOTE]



Are you certain they are not only seconds (or even fractions of a second) apart??

I’ve just had a quick look and in the example I checked, the e-mails were 4 seconds apart. The fact that both of the e-mails have the subject and body for the e-mail associated with the ‘Processed’ status says to me that both the e-mails were generated by the same status change. Could I be wrong in thinking that?



I’ve checked all the order statuses and their notification prefs already and also checked e-mail subjects, etc. They’re all correct.

The 4 seconds could easily be due to the delay in processing each SMTP transaction I’d imagine.

I have a client that uses ePDQ and they were seeing dups as well. We turned all email off in the cart and only send from the back-end.



So it’s a bug in the ePDQ processing as it relates to the callback being performed.

Ah, ok. I might take a look at it at some point then. I’ve already had to have my head in the ePDQ processor code a couple of times in the past so I’m not completely unfamiliar with it. If I do come up with a fix I’ll let everyone know on here.



Thanks again

Probably look for things like return values from the callback and/or where it might be calling fn_finish_payment() multiple times or where it might be calling fn_change_order_status() multiple times with the from and to status being the same.

Thanks for the tips. I think you’re probably right. Also, I know my ePDQ sends a postback as soon as the transaction is authorised in addition to when redirecting the user back to CS Cart once the customer clicks ‘Finish’ on the last page.

Given that a lot of this stuff happens asynchronously, it is quite possible the the callback is being received before the order processing is complete.



I can many times see an email from Authorize.net informing me of a charge before the order processing completes on the site.



But it would be very difficult to ensure that the timing dependency is always happening if you were thinking of modifying the call back. But you could probably make a DB call to see if the payment data has been written to the order_data table for the order_id that was returned in the callback.