I have tried multiple different options and am just going to use the submit_time field as the OrderID. The problem is, I need the initial email sent to include the OrderID and can’t figure out where to make that happen.
I tried changing the saveFormData($cf7) script by adding the following code right at the line that says return true;
//====CUSTOM CODE========
$message = '<html><head><title>Form Submission</title></head>';
$message .= '<body style="font-family:arial, verdana;"> <p>';
$message .= '</p><table cellpadding=2 width=600>';
require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CFDBFormIterator.php');
$exp2 = new CFDBFormIterator();
$exp2->export('Orders', array('filter' => "submit_time=$time"));
while ($row2 = $exp2->nextRow()) {
foreach ($row2 as $name2 => $value2) {
if($name2 != "Submitted Login" && $name2 != "Submitted From" && $name2 != "submit_time") {
$name2 = str_replace("-", " ", $name2);
$name2 = str_replace("OrderID", "Order ID", $name2);
$message .= "<tr><td bgcolor='#EEEEEE' width='180'>". ucwords($name2) . "</td><td bgcolor='#CCCCCC'><b>". strip_tags($value2) . "</b></td></tr>";
}
}
}
$message .= "</table><br><br>Sent from Ordering system.</body></html>";
//*
//==========MAIL SCRIPT=========
$to = '[email protected]';
$subject = 'RECEIVED - Order ID: ' . $time;
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: [email protected]' . "\n";
$result = mail($to, $subject, $message, $headers); // */
//=========END CUSTOM CODE==========
I also tried adding the same above code to the CF7DBPlugin.php file after the $didSaveFile query, but neither of those send out an email.