close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

New online order sends previous email receipt

Thread began 6/02/2015 8:22 am by jlowery | Last modified 6/04/2015 9:57 am by Ray Borduin | 2402 views | 8 replies |

jlowery

New online order sends previous email receipt

My client has had a vexing problem we just diagnosed. After a customer completes an order and is directed to the checkout success page, Authorize.net automatically sends an order confirmation to the client and a receipt is sent to the customer. I have the system set up to send another email - more of a user friendly version of the Authorize.net email ("the Order") - to the client. Since we transitioned and I changed from a remote to local checkout, the Order has been coming after the initial Authorize.net notice, often significantly, like 24 hours or even several days. I finally figured out that the Order email is only sent when another new order is placed; it's one behind in the queue.

How do I correct this problem? I'm not sure which files to send you to take a look - please let me know.

Thanks - Joe

Sign in to reply to this post

Ray BorduinWebAssist

I'll take a look, but that makes no sense. I'm thinking it must be a strange issue with the SMTP server.

Create a blank page on your site with the code:

php:
<?php

@session_start();
var_dump($_SESSION);
?>



Then complete a transaction and browse to that page.

It will show you the contents of the email you just tried to send (with a bunch of other junk you can ignore).

Is the email body listed on that page from the previous order or the current one? If it is from the previous order, then there is an issue with your code, if it is from the current then it is an odd issue with the SMTP server and you can ask your hosting company to debug the strange delay.

Sign in to reply to this post
Did this help? Tips are appreciated...

jlowery

I posted the page with that code and then ran a transaction. Unfortunately, I only got this on my session page:
array(0) { }

What next?

Sign in to reply to this post

Ray BorduinWebAssist

Your payment success page must be clearing the session. Comment out that code for debugging purposes and run the test again.

Sign in to reply to this post
Did this help? Tips are appreciated...

jlowery

That worked. So, weirdly, I'm getting both - the raw session information is from my checkout (like ["eCartCheckoutForm_shipping_lastname"]=> string(6) "Lowery" ["eCartCheckoutForm_shipping_firstname"]=> string(6) "Joseph" [) but the email form is from (evidently) the previous order. (See attached files and screen grab). You can see the most recent order is #8303 ("muirhead_OrderID"]=> int(8303)), but the Order # on the email is 8302.

I've also attached my checkout_success.php page in hopes you can spot what's going wrong.

Attached Files
checkout_success.php
session-results.html
Sign in to reply to this post

Ray BorduinWebAssist

The page that actually sends the email is probably confirm.php. I'd like to see a copy of that as well as the page that is used to define the email body.

Sign in to reply to this post
Did this help? Tips are appreciated...

jlowery

Files attached.

Attached Files
confirm.php
muirhead_receipt.php
waue_confirm_1.php
Sign in to reply to this post

Ray BorduinWebAssist

Yes, it is just a code ordering issue.

You send the email before you store the order in the database, and generate the email contents from the most recently inserted order, which would be the one before the current.

The solution is to move the email code on the confirm page below the database inserts on the confirm.php page.

So move lines 476-562 below the last database insert that currently ends on line 737

Sign in to reply to this post
Did this help? Tips are appreciated...

jlowery

That did it! Thanks so much for your help.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...