I don't think I ever received a confirmation mail - just the pending mail and the status change mail.
I have spend hours to try and figure out where the code for the pending mail is produced and if it could be reused for a confirmation mail with no luck. Is there somebody that can lead me in the right direction? Does a documentation for the checkout procedure exist?
I too have never seen a confirmation email or at least not a confirmation email as I would have expected. The confirmation email only indicates that the order status has changed and nothing more. Ideally it should resemble the purchase order but renamed to invoice or something similar.
What I've been able to figure out is as follows:
order is placed and the checkout process begins. We go through all the steps until we reach the final step where we click the "confirm order
" button. This process adds the order to the database, sends the purchase order to the customer and shop owner then redirects to paypal for payment.
The payment is processed and the notify.php script is executed which handles the response POST info from paypal.
require_once ( CLASSPATH . 'ps_order.php' );
$ps_order= new ps_order;
$mailsubject = "PayPal IPN txn on your site";
$mailbody = "Hello,\n\n";
$mailbody .= "a PayPal transaction for you has been made on your website!\n";
$mailbody .= "-----------------------------------------------------------\n";
$mailbody .= "Transaction ID: $txn_id\n";
$mailbody .= "Payer Email: $payer_email\n";
$mailbody .= "Order ID: $order_id\n";
$mailbody .= "Payment Status returned by PayPal: $payment_status\n";
$mailbody .= "Order Status Code: ".$d['order_status'];
vmMail($mosConfig_mailfrom, $mosConfig_fromname, $debug_email_address, $mailsubject, $mailbody );
In the notify.php script there's a call to order_status_update()
function which is defined in the ps_order.php script. The order status should be updated to "Completed", stocklevels checked and updated if required and so forth.
is called and an email is sent to the customer informing them that their order has been updated from "Pending" to "Completed".
If this logic is correct (please correct me if it's not) then we need
to do a couple of things to get this all working the way we want:
1. disable the email alert when the order is initially confirmed (final stage of the check out process).
2. modify the notify.php script so that it sends out a "final" confirmation email to the user and shop owner. (this is the pending email rehashed to remove all the "pending" phrases and changing "purchase order" to "invoice or something similar). or modify the checkout.result.php script (which is the return url as defined in the extra payment info section of the paypal configuration
"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
) to send the confirmed email (invoice) to the customer and shop owner.
The other thing I have found is that under test conditions the IPN stuff doesn't work (www.eliteweaver.co.uk/testing/ipntest.php
no longer exists - I can't seem to get to it
so order statuses are not being updated on successful test transactions.)
Am I right in my assumptions and the process flow? If so would the solution I have proposed work without affecting anything else?